Completed
Pull Request — master (#1047)
by Zack
22:31 queued 16:41
created
plugin-and-theme-hooks/abstract-gravityview-plugin-and-theme-hooks.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -195,7 +195,6 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @deprecated 2.0.7
197 197
 	 *
198
-	 * @param array $handles Array of meta keys to check for existence of shortcodes
199 198
 	 * @param int $post_id The ID being checked by GravityView
200 199
 	 *
201 200
 	 * @return array Meta key array, merged with existing meta keys
@@ -209,7 +208,6 @@  discard block
 block discarded – undo
209 208
 	 *
210 209
 	 * @since 2.0.7
211 210
 	 *
212
-	 * @param array $handles Array of meta keys to check for existence of shortcodes
213 211
 	 * @param \WP_Post $post The ID being checked by GravityView
214 212
 	 *
215 213
 	 * @return array Meta key array, merged with existing meta keys
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 	private function maybe_add_hooks() {
111 111
 		$class_exists = $this->class_name && class_exists( $this->class_name );
112 112
 		$function_exists = $this->function_name && function_exists( $this->function_name );
113
-		$constant_defined = $this->constant_name && defined("{$this->constant_name}");
113
+		$constant_defined = $this->constant_name && defined( "{$this->constant_name}" );
114 114
 
115
-		if( $class_exists || $function_exists || $constant_defined ) {
115
+		if ( $class_exists || $function_exists || $constant_defined ) {
116 116
 			$this->add_hooks();
117 117
 		}
118 118
 	}
@@ -124,23 +124,23 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	protected function add_hooks() {
126 126
 
127
-		if( $this->meta_keys ) {
127
+		if ( $this->meta_keys ) {
128 128
 			add_filter( 'gravityview/data/parse/meta_keys', array( $this, 'merge_meta_keys' ), 10, 2 );
129 129
 		}
130 130
 
131
-		if( $this->content_meta_keys ) {
131
+		if ( $this->content_meta_keys ) {
132 132
 			add_filter( 'gravityview/view_collection/from_post/meta_keys', array( $this, 'merge_content_meta_keys' ), 10, 3 );
133 133
 		}
134 134
 
135
-		if( $this->script_handles ) {
135
+		if ( $this->script_handles ) {
136 136
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'merge_noconflict_scripts' ) );
137 137
 		}
138 138
 
139
-		if( $this->style_handles ) {
139
+		if ( $this->style_handles ) {
140 140
 			add_filter( 'gravityview_noconflict_styles', array( $this, 'merge_noconflict_styles' ) );
141 141
 		}
142 142
 
143
-		if( $this->post_type_support ) {
143
+		if ( $this->post_type_support ) {
144 144
 			add_filter( 'gravityview_post_type_support', array( $this, 'merge_post_type_support' ), 10, 2 );
145 145
 		}
146 146
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-collection-view.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 			$meta_keys = apply_filters_ref_array( 'gravityview/view_collection/from_post/meta_keys', array( array(), $post, &$views ) );
100 100
 
101 101
 			if ( function_exists( 'apply_filters_deprecated' ) ) {
102
-				$meta_keys = (array) apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' );
102
+				$meta_keys = (array)apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' );
103 103
 			} else {
104 104
 				/**
105 105
 				 * @filter `gravityview/data/parse/meta_keys`
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 				 * @todo Require WP 4.6.0 so that `apply_filters_deprecated` is always available
108 108
 				 * @see The `gravityview/view_collection/from_post/meta_keys` filter.
109 109
 				 */
110
-				$meta_keys = (array) apply_filters( 'gravityview/data/parse/meta_keys', $meta_keys, $post->ID );
110
+				$meta_keys = (array)apply_filters( 'gravityview/data/parse/meta_keys', $meta_keys, $post->ID );
111 111
 			}
112 112
 
113 113
 			/** What about inside post meta values? */
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
 
138 138
 		/** Let's find us some [gravityview] shortcodes perhaps. */
139 139
 		foreach ( Shortcode::parse( $content ) as $shortcode ) {
140
-			if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) {
140
+			if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) {
141 141
 				continue;
142 142
 			}
143 143
 
144
-			if ( is_numeric( $shortcode->atts['id'] ) ) {
145
-				$view = View::by_id( $shortcode->atts['id'] );
144
+			if ( is_numeric( $shortcode->atts[ 'id' ] ) ) {
145
+				$view = View::by_id( $shortcode->atts[ 'id' ] );
146 146
 				if ( ! $view ) {
147 147
 					continue;
148 148
 				}
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-theme-hooks-siteorigin.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,19 +39,19 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	function merge_content_meta_keys( $meta_keys = array(), $post = null, & $views = null ) {
41 41
 
42
-		if( empty( $post->panels_data ) || empty( $post->panels_data['widgets'] ) ) {
42
+		if ( empty( $post->panels_data ) || empty( $post->panels_data[ 'widgets' ] ) ) {
43 43
 			return $meta_keys;
44 44
 		}
45 45
 
46
-		foreach ( (array) $post->panels_data['widgets'] as $widget ) {
46
+		foreach ( (array)$post->panels_data[ 'widgets' ] as $widget ) {
47 47
 
48 48
 			$views->merge( \GV\View_Collection::from_content( \GV\Utils::get( $widget, 'text' ) ) );
49 49
 
50
-			if ( empty( $widget['tabs'] ) || ! is_array( $widget['tabs'] ) ) {
50
+			if ( empty( $widget[ 'tabs' ] ) || ! is_array( $widget[ 'tabs' ] ) ) {
51 51
 				continue;
52 52
 			}
53 53
 
54
-			foreach ( $widget['tabs'] as $tab ) {
54
+			foreach ( $widget[ 'tabs' ] as $tab ) {
55 55
 
56 56
 				// Livemesh Tabs
57 57
 				$backup = \GV\Utils::get( $tab, 'tab_content' );
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 				// SiteOrigin Tabs
60 60
 				$content = \GV\Utils::get( $tab, 'content_text', $backup );
61 61
 
62
-				if( $content ) {
62
+				if ( $content ) {
63 63
 					$views->merge( \GV\View_Collection::from_content( $content ) );
64 64
 				}
65 65
 			}
Please login to merge, or discard this patch.
includes/class-common.php 1 patch
Spacing   +112 added lines, -112 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;
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
 
193 193
 			$has_transaction_data = \GV\Utils::get( $entry, $meta, false );
194 194
 
195
-			if( ! empty( $has_transaction_data ) ) {
195
+			if ( ! empty( $has_transaction_data ) ) {
196 196
 				break;
197 197
 			}
198 198
 		}
199 199
 
200
-		return (bool) $has_transaction_data;
200
+		return (bool)$has_transaction_data;
201 201
 	}
202 202
 
203 203
 	/**
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
237 237
 
238
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
238
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
239 239
 
240 240
 		return $result;
241 241
 	}
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
254 254
 	 */
255
-	public static function get_forms(  $active = true, $trash = false ) {
255
+	public static function get_forms( $active = true, $trash = false ) {
256 256
 		$forms = array();
257 257
 		if ( class_exists( 'GFAPI' ) ) {
258
-			if( 'any' === $active ) {
258
+			if ( 'any' === $active ) {
259 259
 				$active_forms = GFAPI::get_forms( true, $trash );
260 260
 				$inactive_forms = GFAPI::get_forms( false, $trash );
261 261
 				$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -286,9 +286,9 @@  discard block
 block discarded – undo
286 286
 		$has_post_fields = false;
287 287
 
288 288
 		if ( $form ) {
289
-			foreach ( $form['fields'] as $field ) {
290
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
291
-					$fields["{$field['id']}"] = array(
289
+			foreach ( $form[ 'fields' ] as $field ) {
290
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
291
+					$fields[ "{$field[ 'id' ]}" ] = array(
292 292
 						'label' => \GV\Utils::get( $field, 'label' ),
293 293
 						'parent' => null,
294 294
 						'type' => \GV\Utils::get( $field, 'type' ),
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
 					);
298 298
 				}
299 299
 
300
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
301
-					foreach ( $field['inputs'] as $input ) {
300
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
301
+					foreach ( $field[ 'inputs' ] as $input ) {
302 302
 
303
-						if( ! empty( $input['isHidden'] ) ) {
303
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
304 304
 							continue;
305 305
 						}
306 306
 
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
                          * @hack
309 309
                          * In case of email/email confirmation, the input for email has the same id as the parent field
310 310
                          */
311
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
311
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
312 312
                             continue;
313 313
                         }
314
-						$fields["{$input['id']}"] = array(
314
+						$fields[ "{$input[ 'id' ]}" ] = array(
315 315
 							'label' => \GV\Utils::get( $input, 'label' ),
316 316
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
317 317
 							'parent' => $field,
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 				}
324 324
 
325 325
 
326
-				if( GFCommon::is_product_field( $field['type'] ) ){
326
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
327 327
 					$has_product_fields = true;
328 328
 				}
329 329
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		 * @since 1.7
338 338
 		 */
339 339
 		if ( $has_post_fields ) {
340
-			$fields['post_id'] = array(
340
+			$fields[ 'post_id' ] = array(
341 341
 				'label' => __( 'Post ID', 'gravityview' ),
342 342
 				'type' => 'post_id',
343 343
 			);
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 			foreach ( $payment_fields as $payment_field ) {
351 351
 
352 352
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
353
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
353
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
354 354
 					continue;
355 355
 				}
356 356
 
357
-				$fields["{$payment_field->name}"] = array(
357
+				$fields[ "{$payment_field->name}" ] = array(
358 358
 					'label' => $payment_field->label,
359 359
 					'desc' => $payment_field->description,
360 360
 					'type' => $payment_field->name,
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$fields = array();
388 388
 
389
-		foreach ( $extra_fields as $key => $field ){
390
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
391
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
389
+		foreach ( $extra_fields as $key => $field ) {
390
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
391
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
392 392
 			}
393 393
 		}
394 394
 
@@ -428,33 +428,33 @@  discard block
 block discarded – undo
428 428
 			'search_criteria' => null,
429 429
 			'sorting' => null,
430 430
 			'paging' => null,
431
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
431
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
432 432
 			'context_view_id' => null,
433 433
 		);
434 434
 
435 435
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
436 436
 
437
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
438
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
437
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
438
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
439 439
 
440 440
 				if ( ! is_array( $filter ) ) {
441 441
 					continue;
442 442
 				}
443 443
 
444 444
 				// By default, we want searches to be wildcard for each field.
445
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
445
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
446 446
 
447 447
 				/**
448 448
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
449 449
 				 * @param string $operator Existing search operator
450 450
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
451 451
 				 */
452
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
452
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
453 453
 			}
454 454
 
455 455
 			// don't send just the [mode] without any field filter.
456
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
457
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
456
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
457
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
458 458
 			}
459 459
 
460 460
 		}
@@ -465,33 +465,33 @@  discard block
 block discarded – undo
465 465
 		 * Prepare date formats to be in Gravity Forms DB format;
466 466
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
467 467
 		 */
468
-		foreach ( array('start_date', 'end_date' ) as $key ) {
468
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
469 469
 
470
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
470
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
471 471
 
472 472
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
473
-				$date = date_create( $criteria['search_criteria'][ $key ] );
473
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
474 474
 
475 475
 				if ( $date ) {
476 476
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
477
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
477
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
478 478
 				} else {
479
-					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) );
479
+					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) );
480 480
 
481 481
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
482
-					unset( $criteria['search_criteria'][ $key ] );
482
+					unset( $criteria[ 'search_criteria' ][ $key ] );
483 483
 				}
484 484
 			}
485 485
 		}
486 486
 
487
-		if ( empty( $criteria['context_view_id'] ) ) {
487
+		if ( empty( $criteria[ 'context_view_id' ] ) ) {
488 488
 			// Calculate the context view id and send it to the advanced filter
489 489
 			if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
490
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
490
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
491 491
 			} else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
492
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
492
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
493 493
 			} else if ( 'delete' === GFForms::get( 'action' ) ) {
494
-				$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
494
+				$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
495 495
 			}
496 496
 		}
497 497
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 		 * @param array $form_ids Forms to search
502 502
 		 * @param int $view_id ID of the view being used to search
503 503
 		 */
504
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
504
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
505 505
 
506 506
 		return (array)$criteria;
507 507
 	}
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 		/** Reduce # of database calls */
532 532
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
533 533
 
534
-		if ( ! empty( $criteria['cache'] ) ) {
534
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
535 535
 
536 536
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
537 537
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
 				// Still update the total count when using cached results
541 541
 				if ( ! is_null( $total ) ) {
542
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
542
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
543 543
 				}
544 544
 
545 545
 				$return = $entries;
@@ -560,9 +560,9 @@  discard block
 block discarded – undo
560 560
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
561 561
 
562 562
 			// No entries returned from gravityview_before_get_entries
563
-			if( is_null( $entries ) ) {
563
+			if ( is_null( $entries ) ) {
564 564
 
565
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
565
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
566 566
 
567 567
 				if ( is_wp_error( $entries ) ) {
568 568
 					gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) );
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 				}
574 574
 			}
575 575
 
576
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
576
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
577 577
 
578 578
 				// Cache results
579 579
 				$Cache->set( $entries, 'entries' );
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
 		 */
681 681
 		$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
682 682
 
683
-		if( $check_entry_display ) {
683
+		if ( $check_entry_display ) {
684 684
 			// Is the entry allowed
685 685
 			$entry = self::check_entry_display( $entry );
686 686
 		}
687 687
 
688
-		if( is_wp_error( $entry ) ) {
688
+		if ( is_wp_error( $entry ) ) {
689 689
 			gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) );
690 690
 			return false;
691 691
 		}
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 	 */
714 714
 	public static function matches_operation( $val1, $val2, $operation ) {
715 715
 
716
-		$json_function = function_exists('wp_json_encode') ? 'wp_json_encode' : 'json_encode';
716
+		$json_function = function_exists( 'wp_json_encode' ) ? 'wp_json_encode' : 'json_encode';
717 717
 
718 718
 		// Only process strings
719 719
 		$val1 = ! is_string( $val1 ) ? $json_function( $val1 ) : $val1;
@@ -721,12 +721,12 @@  discard block
 block discarded – undo
721 721
 
722 722
 		$value = false;
723 723
 
724
-		if( 'context' === $val1 ) {
724
+		if ( 'context' === $val1 ) {
725 725
 
726 726
 			$matching_contexts = array( $val2 );
727 727
 
728 728
 			// We allow for non-standard contexts.
729
-			switch( $val2 ) {
729
+			switch ( $val2 ) {
730 730
 				// Check for either single or edit
731 731
 				case 'singular':
732 732
 					$matching_contexts = array( 'single', 'edit' );
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 				$json_val_1 = json_decode( $val1, true );
770 770
 				$json_val_2 = json_decode( $val2, true );
771 771
 
772
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
772
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
773 773
 
774 774
 					$json_in = false;
775 775
 					$json_val_1 = $json_val_1 ? $json_val_1 : array( $val1 );
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 						foreach ( $json_val_2 as $item_2 ) {
781 781
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
782 782
 
783
-							if( $json_in ) {
783
+							if ( $json_in ) {
784 784
 								break 2;
785 785
 							}
786 786
 						}
@@ -828,62 +828,62 @@  discard block
 block discarded – undo
828 828
 	public static function check_entry_display( $entry ) {
829 829
 
830 830
 		if ( ! $entry || is_wp_error( $entry ) ) {
831
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
831
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
832 832
 		}
833 833
 
834
-		if ( empty( $entry['form_id'] ) ) {
834
+		if ( empty( $entry[ 'form_id' ] ) ) {
835 835
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
836 836
 		}
837 837
 
838 838
 		$criteria = self::calculate_get_entries_criteria();
839 839
 
840
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
840
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
841 841
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved! No search criteria found:', array( 'data' => $criteria ) );
842 842
 			return $entry;
843 843
 		}
844 844
 
845 845
 		// Make sure the current View is connected to the same form as the Entry
846
-		if( ! empty( $criteria['context_view_id'] ) ) {
847
-			$context_view_id = intval( $criteria['context_view_id'] );
846
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
847
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
848 848
 			$context_form_id = gravityview_get_form_id( $context_view_id );
849
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
850
-				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
849
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
850
+				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
851 851
 			}
852 852
 		}
853 853
 
854
-		$search_criteria = $criteria['search_criteria'];
854
+		$search_criteria = $criteria[ 'search_criteria' ];
855 855
 
856 856
 		// check entry status
857
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
858
-			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
857
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
858
+			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
859 859
 		}
860 860
 
861 861
 		// check entry date
862 862
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
863 863
 
864 864
 		// field_filters
865
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
865
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
866 866
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved! No field filters criteria found:', array( 'data' => $search_criteria ) );
867 867
 			return $entry;
868 868
 		}
869 869
 
870
-		$filters = $search_criteria['field_filters'];
870
+		$filters = $search_criteria[ 'field_filters' ];
871 871
 
872
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
872
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
873 873
 
874 874
 		// Prevent the mode from being processed below
875
-		unset( $filters['mode'] );
875
+		unset( $filters[ 'mode' ] );
876 876
 
877
-		$form = self::get_form( $entry['form_id'] );
877
+		$form = self::get_form( $entry[ 'form_id' ] );
878 878
 
879 879
 		foreach ( $filters as $filter ) {
880 880
 
881
-			if ( ! isset( $filter['key'] ) ) {
881
+			if ( ! isset( $filter[ 'key' ] ) ) {
882 882
 				gravityview()->log->debug( '[apply_filters_to_entry] Filter key not set: {filter}', array( 'filter' => $filter ) );
883 883
 				continue;
884 884
 			}
885 885
 
886
-			$k = $filter['key'];
886
+			$k = $filter[ 'key' ];
887 887
 
888 888
 			$field = self::get_field( $form, $k );
889 889
 
@@ -891,14 +891,14 @@  discard block
 block discarded – undo
891 891
 				$field_value = isset( $entry[ $k ] ) ? $entry[ $k ] : null;
892 892
 				$field = $k;
893 893
 			} else {
894
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
894
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
895 895
 				 // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it
896 896
 				$field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? \GV\Utils::get( $field_value, $k ) : $field_value;
897 897
 			}
898 898
 
899
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
899
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
900 900
 
901
-			$is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
901
+			$is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
902 902
 
903 903
 			// Any match is all we need to know
904 904
 			if ( $is_value_match && 'any' === $mode ) {
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 
908 908
 			// Any failed match is a total fail
909 909
 			if ( ! $is_value_match && 'all' === $mode ) {
910
-				return new WP_Error('failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
910
+				return new WP_Error( 'failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
911 911
 			}
912 912
 		}
913 913
 
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved: all conditions were met' );
918 918
 			return $entry;
919 919
 		} else {
920
-			return new WP_Error('failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
920
+			return new WP_Error( 'failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
921 921
 		}
922 922
 
923 923
 	}
@@ -958,18 +958,18 @@  discard block
 block discarded – undo
958 958
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
959 959
 		 * @see GFCommon::format_date() for original code
960 960
 		 */
961
-		$date_gmt_time   = mysql2date( 'G', $date_string );
961
+		$date_gmt_time = mysql2date( 'G', $date_string );
962 962
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
963 963
 
964
-		$format  = \GV\Utils::get( $atts, 'format' );
965
-		$is_human  = ! empty( $atts['human'] );
966
-		$is_diff  = ! empty( $atts['diff'] );
967
-		$is_raw = ! empty( $atts['raw'] );
968
-		$is_timestamp = ! empty( $atts['timestamp'] );
969
-		$include_time = ! empty( $atts['time'] );
964
+		$format = \GV\Utils::get( $atts, 'format' );
965
+		$is_human = ! empty( $atts[ 'human' ] );
966
+		$is_diff = ! empty( $atts[ 'diff' ] );
967
+		$is_raw = ! empty( $atts[ 'raw' ] );
968
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
969
+		$include_time = ! empty( $atts[ 'time' ] );
970 970
 
971 971
 		// If we're using time diff, we want to have a different default format
972
-		if( empty( $format ) ) {
972
+		if ( empty( $format ) ) {
973 973
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
974 974
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
975 975
 		}
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 		// If raw was specified, don't modify the stored value
978 978
 		if ( $is_raw ) {
979 979
 			$formatted_date = $date_string;
980
-		} elseif( $is_timestamp ) {
980
+		} elseif ( $is_timestamp ) {
981 981
 			$formatted_date = $date_local_timestamp;
982 982
 		} elseif ( $is_diff ) {
983 983
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
 
1012 1012
 		$label = \GV\Utils::get( $field, 'label' );
1013 1013
 
1014
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1014
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1015 1015
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1016 1016
 		}
1017 1017
 
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
 			$form = GFAPI::get_form( $form );
1040 1040
 		}
1041 1041
 
1042
-		if ( class_exists( 'GFFormsModel' ) ){
1042
+		if ( class_exists( 'GFFormsModel' ) ) {
1043 1043
 			return GFFormsModel::get_field( $form, $field_id );
1044 1044
 		} else {
1045 1045
 			return null;
@@ -1086,19 +1086,19 @@  discard block
 block discarded – undo
1086 1086
 			$shortcodes = array();
1087 1087
 
1088 1088
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1089
-			if ( empty( $matches ) ){
1089
+			if ( empty( $matches ) ) {
1090 1090
 				return false;
1091 1091
 			}
1092 1092
 
1093 1093
 			foreach ( $matches as $shortcode ) {
1094
-				if ( $tag === $shortcode[2] ) {
1094
+				if ( $tag === $shortcode[ 2 ] ) {
1095 1095
 
1096 1096
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1097
-					$shortcodes[] = $shortcode;
1097
+					$shortcodes[ ] = $shortcode;
1098 1098
 
1099
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1100
-					foreach( $results as $result ) {
1101
-						$shortcodes[] = $result;
1099
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1100
+					foreach ( $results as $result ) {
1101
+						$shortcodes[ ] = $result;
1102 1102
 					}
1103 1103
 				}
1104 1104
 			}
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 
1286 1286
 		$directory_widgets = wp_parse_args( $view_widgets, $defaults );
1287 1287
 
1288
-		if( $json_decode ) {
1288
+		if ( $json_decode ) {
1289 1289
 			$directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' );
1290 1290
 		}
1291 1291
 
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 	 * @return string         html
1302 1302
 	 */
1303 1303
 	public static function get_sortable_fields( $formid, $current = '' ) {
1304
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1304
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1305 1305
 
1306 1306
 		if ( empty( $formid ) ) {
1307 1307
 			return $output;
@@ -1314,11 +1314,11 @@  discard block
 block discarded – undo
1314 1314
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1315 1315
 
1316 1316
 			foreach ( $fields as $id => $field ) {
1317
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1317
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1318 1318
 					continue;
1319 1319
 				}
1320 1320
 
1321
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1321
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1322 1322
 			}
1323 1323
 		}
1324 1324
 
@@ -1353,9 +1353,9 @@  discard block
 block discarded – undo
1353 1353
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1354 1354
 
1355 1355
 		// TODO: Convert to using array_filter
1356
-		foreach( $fields as $id => $field ) {
1356
+		foreach ( $fields as $id => $field ) {
1357 1357
 
1358
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1358
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1359 1359
 				unset( $fields[ $id ] );
1360 1360
 			}
1361 1361
 		}
@@ -1396,14 +1396,14 @@  discard block
 block discarded – undo
1396 1396
 	 * @param  int|array  $field field key or field array
1397 1397
 	 * @return boolean
1398 1398
 	 */
1399
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1399
+	public static function is_field_numeric( $form = null, $field = '' ) {
1400 1400
 
1401 1401
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1402 1402
 			$form = self::get_form( $form );
1403 1403
 		}
1404 1404
 
1405 1405
 		// If entry meta, it's a string. Otherwise, numeric
1406
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1406
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1407 1407
 			$type = $field;
1408 1408
 		} else {
1409 1409
 			$type = self::get_field_type( $form, $field );
@@ -1417,9 +1417,9 @@  discard block
 block discarded – undo
1417 1417
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1418 1418
 
1419 1419
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1420
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1421
-			if( true === $gv_field->is_numeric ) {
1422
-				$numeric_types[] = $gv_field->is_numeric;
1420
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1421
+			if ( true === $gv_field->is_numeric ) {
1422
+				$numeric_types[ ] = $gv_field->is_numeric;
1423 1423
 			}
1424 1424
 		}
1425 1425
 
@@ -1569,18 +1569,18 @@  discard block
 block discarded – undo
1569 1569
 		$final_atts = array_filter( $final_atts );
1570 1570
 
1571 1571
 		// If the href wasn't passed as an attribute, use the value passed to the function
1572
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1573
-			$final_atts['href'] = $href;
1572
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1573
+			$final_atts[ 'href' ] = $href;
1574 1574
 		}
1575 1575
 
1576
-		$final_atts['href'] = esc_url_raw( $href );
1576
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1577 1577
 
1578 1578
 		/**
1579 1579
 		 * Fix potential security issue with target=_blank
1580 1580
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1581 1581
 		 */
1582
-		if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1583
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1582
+		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1583
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1584 1584
 		}
1585 1585
 
1586 1586
 		// Sort the attributes alphabetically, to help testing
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1593 1593
 		}
1594 1594
 
1595
-		if( '' !== $output ) {
1595
+		if ( '' !== $output ) {
1596 1596
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1597 1597
 		}
1598 1598
 
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1620 1620
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1621 1621
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1622
-				$merged[] = $value;
1622
+				$merged[ ] = $value;
1623 1623
 			} else {
1624 1624
 				$merged[ $key ] = $value;
1625 1625
 			}
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1653 1653
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1654 1654
 		 */
1655
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1655
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1656 1656
 
1657 1657
 		return get_users( $get_users_settings );
1658 1658
 	}
@@ -1672,11 +1672,11 @@  discard block
 block discarded – undo
1672 1672
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1673 1673
 
1674 1674
     	// If $cap is defined, only show notice if user has capability
1675
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1675
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1676 1676
     		return '';
1677 1677
 	    }
1678 1678
 
1679
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1679
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1680 1680
     }
1681 1681
 
1682 1682
 	/**
Please login to merge, or discard this patch.
future/includes/class-gv-request.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public static function is_add_oembed_preview() {
47 47
 		/** The preview request is a parse-embed AJAX call without a type set. */
48
-		return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) );
48
+		return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
49 49
 	}
50 50
 
51 51
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return boolean
64 64
 	 */
65 65
 	public static function is_rest() {
66
-		return ! empty( $GLOBALS['wp']->query_vars['rest_route'] );
66
+		return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] );
67 67
 	}
68 68
 
69 69
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 		$has_field_key = $this->_has_field_key( $get );
145 145
 
146
-		return $this->is_view() && ( $has_field_key || isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] ) );
146
+		return $this->is_view() && ( $has_field_key || isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] ) );
147 147
 	}
148 148
 
149 149
 	/**
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
 
167 167
 		$meta = array();
168 168
 		foreach ( $fields as $field ) {
169
-			if( empty( $field->_gf_field_class_name ) ) {
170
-				$meta[] = preg_quote( $field->name );
169
+			if ( empty( $field->_gf_field_class_name ) ) {
170
+				$meta[ ] = preg_quote( $field->name );
171 171
 			}
172 172
 		}
173 173
 
174 174
 		foreach ( $get as $key => $value ) {
175
-			if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/ism', $key ) ) {
175
+			if ( preg_match( '/^filter_(([0-9_]+)|' . implode( '|', $meta ) . ')$/ism', $key ) ) {
176 176
 				$has_field_key = true;
177 177
 				break;
178 178
 			}
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +107 added lines, -107 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
 		}
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 
403 403
 		// If we've saved the permalink in memory, use it
404 404
 		// @since 1.3
405
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
405
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
406 406
 
407
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
407
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
408 408
 			$link = home_url();
409 409
 		}
410 410
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
 			// If not yet saved, cache the permalink.
415 415
 			// @since 1.3
416
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
416
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
417 417
 		}
418 418
 
419 419
 		// Deal with returning to proper pagination for embedded views
@@ -421,13 +421,13 @@  discard block
 block discarded – undo
421 421
 
422 422
 			$args = array();
423 423
 
424
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
425
-				$args['pagenum'] = intval( $pagenum );
424
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
425
+				$args[ 'pagenum' ] = intval( $pagenum );
426 426
 			}
427 427
 
428
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
429
-				$args['sort'] = $sort;
430
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
428
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
429
+				$args[ 'sort' ] = $sort;
430
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
431 431
 			}
432 432
 
433 433
 			$link = add_query_arg( $args, $link );
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
465 465
 
466 466
 		// Generate an unique hash to use as the default value
467
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
467
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
468 468
 
469 469
 		/**
470 470
 		 * @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}`
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
476 476
 
477 477
 		// Make sure we have something - use the original ID as backup.
478
-		if( empty( $slug ) ) {
478
+		if ( empty( $slug ) ) {
479 479
 			$slug = $id;
480 480
 		}
481 481
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 		 * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
505 505
 		 * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
506 506
 		 */
507
-		$custom = apply_filters('gravityview_custom_entry_slug', false );
507
+		$custom = apply_filters( 'gravityview_custom_entry_slug', false );
508 508
 
509 509
 		// If we're using custom slug...
510 510
 		if ( $custom ) {
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 			// If it does have a hash set, and the hash is expected, use it.
519 519
 			// This check allows users to change the hash structure using the
520 520
 			// gravityview_entry_hash filter and have the old hashes expire.
521
-			if( empty( $value ) || $value !== $hash ) {
521
+			if ( empty( $value ) || $value !== $hash ) {
522 522
 				gravityview()->log->debug( 'Setting hash for entry {entry}: {hash}', array( 'entry' => $id_or_string, 'hash' => $hash ) );
523 523
 				gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
524 524
 			}
@@ -545,15 +545,15 @@  discard block
 block discarded – undo
545 545
          * @param boolean $custom Should we process the custom entry slug?
546 546
          */
547 547
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
548
-        if( $custom ) {
548
+        if ( $custom ) {
549 549
             // create the gravityview_unique_id and save it
550 550
 
551 551
             // Get the entry hash
552
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
552
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
553 553
 
554
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
554
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
555 555
 
556
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
556
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
557 557
 
558 558
         }
559 559
     }
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
574 574
 			$entry = GVCommon::get_entry( $entry );
575
-		} else if( empty( $entry ) ) {
575
+		} else if ( empty( $entry ) ) {
576 576
 			// @deprecated path
577 577
 			$entry = GravityView_frontend::getInstance()->getEntry();
578 578
 		}
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 
593 593
 		$query_arg_name = \GV\Entry::get_endpoint_name();
594 594
 
595
-		$entry_slug = self::get_entry_slug( $entry['id'], $entry );
595
+		$entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry );
596 596
 
597
-		if ( get_option('permalink_structure') && !is_preview() ) {
597
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
598 598
 
599 599
 			$args = array();
600 600
 
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
 			 */
605 605
 			$link_parts = explode( '?', $directory_link );
606 606
 
607
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
607
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
608 608
 
609
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
609
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
610 610
 
611 611
 		} else {
612 612
 
@@ -618,22 +618,22 @@  discard block
 block discarded – undo
618 618
 		 */
619 619
 		if ( $add_directory_args ) {
620 620
 
621
-			if ( ! empty( $_GET['pagenum'] ) ) {
622
-				$args['pagenum'] = intval( $_GET['pagenum'] );
621
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
622
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
623 623
 			}
624 624
 
625 625
 			/**
626 626
 			 * @since 1.7
627 627
 			 */
628 628
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
629
-				$args['sort'] = $sort;
630
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
629
+				$args[ 'sort' ] = $sort;
630
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
631 631
 			}
632 632
 
633 633
 		}
634 634
 
635 635
 		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
636
-			$args['gvid'] = gravityview_get_view_id();
636
+			$args[ 'gvid' ] = gravityview_get_view_id();
637 637
 		}
638 638
 
639 639
 		return add_query_arg( $args, $directory_link );
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 }
655 655
 
656 656
 function gv_class( $field, $form = NULL, $entry = array() ) {
657
-	return GravityView_API::field_class( $field, $form, $entry  );
657
+	return GravityView_API::field_class( $field, $form, $entry );
658 658
 }
659 659
 
660 660
 /**
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 		$view_id = 0;
678 678
 		if ( $context->view ) {
679 679
 			$view_id = $context->view->ID;
680
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
680
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
681 681
 				$hide_until_searched = ! $context->request->is_search();
682 682
 			}
683 683
 		}
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 		$default_css_class .= ' gv-container-no-results';
706 706
 	}
707 707
 
708
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
708
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
709 709
 
710 710
 	/**
711 711
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 
733 733
 	$value = GravityView_API::field_value( $entry, $field );
734 734
 
735
-	if( $value === '' ) {
735
+	if ( $value === '' ) {
736 736
 		/**
737 737
 		 * @filter `gravityview_empty_value` What to display when a field is empty
738 738
 		 * @param string $value (empty string)
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
  */
840 840
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
841 841
 
842
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
842
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
843 843
 
844 844
 		// For the complete field value as generated by Gravity Forms
845 845
 		return $display_value;
@@ -873,16 +873,16 @@  discard block
 block discarded – undo
873 873
 		$terms = explode( ', ', $value );
874 874
 	}
875 875
 
876
-	foreach ($terms as $term_name ) {
876
+	foreach ( $terms as $term_name ) {
877 877
 
878 878
 		// If we're processing a category,
879
-		if( $taxonomy === 'category' ) {
879
+		if ( $taxonomy === 'category' ) {
880 880
 
881 881
 			// Use rgexplode to prevent errors if : doesn't exist
882 882
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
883 883
 
884 884
 			// The explode was succesful; we have the category ID
885
-			if( !empty( $term_id )) {
885
+			if ( ! empty( $term_id ) ) {
886 886
 				$term = get_term_by( 'id', $term_id, $taxonomy );
887 887
 			} else {
888 888
 			// We have to fall back to the name
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 		}
896 896
 
897 897
 		// There's still a tag/category here.
898
-		if( $term ) {
898
+		if ( $term ) {
899 899
 
900 900
 			$term_link = get_term_link( $term, $taxonomy );
901 901
 
@@ -904,11 +904,11 @@  discard block
 block discarded – undo
904 904
 			    continue;
905 905
 			}
906 906
 
907
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
907
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
908 908
 		}
909 909
 	}
910 910
 
911
-	return implode(', ', $output );
911
+	return implode( ', ', $output );
912 912
 }
913 913
 
914 914
 /**
@@ -922,8 +922,8 @@  discard block
 block discarded – undo
922 922
 
923 923
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
924 924
 
925
-	if( empty( $link ) ) {
926
-		return strip_tags( $output);
925
+	if ( empty( $link ) ) {
926
+		return strip_tags( $output );
927 927
 	}
928 928
 
929 929
 	return $output;
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 	$fe = GravityView_frontend::getInstance();
943 943
 
944 944
 	// Solve problem when loading content via admin-ajax.php
945
-	if( ! $fe->getGvOutputData() ) {
945
+	if ( ! $fe->getGvOutputData() ) {
946 946
 
947 947
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
948 948
 
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 	}
951 951
 
952 952
 	// Make 100% sure that we're dealing with a properly called situation
953
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
953
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
954 954
 
955 955
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
956 956
 
@@ -1124,11 +1124,11 @@  discard block
 block discarded – undo
1124 1124
 	 */
1125 1125
 	$is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false );
1126 1126
 
1127
-	if( $is_edit_entry ) {
1127
+	if ( $is_edit_entry ) {
1128 1128
 		$context = 'edit';
1129
-	} else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1129
+	} else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1130 1130
 		$context = 'single';
1131
-	} else if( class_exists( 'GravityView_View' ) ) {
1131
+	} else if ( class_exists( 'GravityView_View' ) ) {
1132 1132
 		$context = GravityView_View::getInstance()->getContext();
1133 1133
 	}
1134 1134
 
@@ -1158,12 +1158,12 @@  discard block
 block discarded – undo
1158 1158
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1159 1159
 	/** @define "GRAVITYVIEW_DIR" "../" */
1160 1160
 
1161
-	if( !class_exists( 'GravityView_Field' ) ) {
1162
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1161
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1162
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1163 1163
 	}
1164 1164
 
1165
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1166
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1165
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1166
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1167 1167
 	}
1168 1168
 
1169 1169
 	return GravityView_Field_FileUpload::get_files_array( $value, $gv_class, $context );
@@ -1262,21 +1262,21 @@  discard block
 block discarded – undo
1262 1262
 	} else {
1263 1263
 		// @deprecated path
1264 1264
 		// Required fields.
1265
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1265
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1266 1266
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1267 1267
 			return '';
1268 1268
 		}
1269 1269
 	}
1270 1270
 
1271 1271
 	if ( $context instanceof \GV\Template_Context ) {
1272
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1273
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1274
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1272
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1273
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1274
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1275 1275
 	} else {
1276 1276
 		// @deprecated path
1277
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1278
-		$field = $args['field'];
1279
-		$form = $args['form'];
1277
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1278
+		$field = $args[ 'field' ];
1279
+		$form = $args[ 'form' ];
1280 1280
 	}
1281 1281
 
1282 1282
 	/**
@@ -1294,46 +1294,46 @@  discard block
 block discarded – undo
1294 1294
 	);
1295 1295
 
1296 1296
 	if ( $context instanceof \GV\Template_Context ) {
1297
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1297
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1298 1298
 	} else {
1299 1299
 		// @deprecated path
1300
-		$placeholders['value'] = gv_value( $entry, $field );
1300
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1301 1301
 	}
1302 1302
 
1303 1303
 	// If the value is empty and we're hiding empty, return empty.
1304
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1304
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1305 1305
 		return '';
1306 1306
 	}
1307 1307
 
1308
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1309
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1308
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1309
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1310 1310
 	}
1311 1311
 
1312 1312
 	// Get width setting, if exists
1313
-	$placeholders['width'] = GravityView_API::field_width( $field );
1313
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1314 1314
 
1315 1315
 	// If replacing with CSS inline formatting, let's do it.
1316
-	$placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1316
+	$placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1317 1317
 
1318 1318
 	// Grab the Class using `gv_class`
1319
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1320
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1319
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1320
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1321 1321
 
1322 1322
 
1323 1323
 	// Get field label if needed
1324
-	if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) {
1325
-		$placeholders['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] );
1324
+	if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) {
1325
+		$placeholders[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] );
1326 1326
 	}
1327 1327
 
1328 1328
 	if ( $context instanceof \GV\Template_Context ) {
1329
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label' );
1329
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' );
1330 1330
 	} else {
1331 1331
 		// Default Label value
1332
-		$placeholders['label_value'] = gv_label( $field, $entry );
1332
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1333 1333
 	}
1334 1334
 
1335
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1336
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1335
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1336
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1337 1337
 	}
1338 1338
 
1339 1339
 	/**
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 	 * @since 2.0
1345 1345
 	 * @param \GV\Template_Context $context The context.
1346 1346
 	 */
1347
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1347
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1348 1348
 
1349 1349
 	/**
1350 1350
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 	foreach ( $placeholders as $tag => $value ) {
1372 1372
 
1373 1373
 		// If the tag doesn't exist just skip it
1374
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1374
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1375 1375
 			continue;
1376 1376
 		}
1377 1377
 
Please login to merge, or discard this patch.