Completed
Push — master ( 5d836e...f22700 )
by Zack
11s
created
includes/class-common.php 1 patch
Spacing   +120 added lines, -120 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
 		}
@@ -719,12 +719,12 @@  discard block
 block discarded – undo
719 719
 
720 720
 		$value = false;
721 721
 
722
-		if( 'context' === $val1 ) {
722
+		if ( 'context' === $val1 ) {
723 723
 
724 724
 			$matching_contexts = array( $val2 );
725 725
 
726 726
 			// We allow for non-standard contexts.
727
-			switch( $val2 ) {
727
+			switch ( $val2 ) {
728 728
 				// Check for either single or edit
729 729
 				case 'singular':
730 730
 					$matching_contexts = array( 'single', 'edit' );
@@ -767,18 +767,18 @@  discard block
 block discarded – undo
767 767
 				$json_val_1 = json_decode( $val1, true );
768 768
 				$json_val_2 = json_decode( $val2, true );
769 769
 
770
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
770
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
771 771
 
772 772
 					$json_in = false;
773
-					$json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 );
774
-					$json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 );
773
+					$json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 );
774
+					$json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 );
775 775
 
776 776
 					// For JSON, we want to compare as "in" or "not in" rather than "contains"
777 777
 					foreach ( $json_val_1 as $item_1 ) {
778 778
 						foreach ( $json_val_2 as $item_2 ) {
779 779
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
780 780
 
781
-							if( $json_in ) {
781
+							if ( $json_in ) {
782 782
 								break 2;
783 783
 							}
784 784
 						}
@@ -826,64 +826,64 @@  discard block
 block discarded – undo
826 826
 	public static function check_entry_display( $entry ) {
827 827
 
828 828
 		if ( ! $entry || is_wp_error( $entry ) ) {
829
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
829
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
830 830
 		}
831 831
 
832
-		if ( empty( $entry['form_id'] ) ) {
832
+		if ( empty( $entry[ 'form_id' ] ) ) {
833 833
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
834 834
 		}
835 835
 
836 836
 		$criteria = self::calculate_get_entries_criteria();
837 837
 
838
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
838
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
839 839
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved! No search criteria found:', array( 'data' => $criteria ) );
840 840
 			return $entry;
841 841
 		}
842 842
 
843 843
 		// Make sure the current View is connected to the same form as the Entry
844
-		if( ! empty( $criteria['context_view_id'] ) ) {
845
-			$context_view_id = intval( $criteria['context_view_id'] );
844
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
845
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
846 846
 			$context_form_id = gravityview_get_form_id( $context_view_id );
847
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
848
-				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'] );
847
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
848
+				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 849
 			}
850 850
 		}
851 851
 
852
-		$search_criteria = $criteria['search_criteria'];
852
+		$search_criteria = $criteria[ 'search_criteria' ];
853 853
 
854 854
 		// check entry status
855
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
856
-			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 );
855
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
856
+			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 857
 		}
858 858
 
859 859
 		// check entry date
860 860
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
861 861
 
862 862
 		// field_filters
863
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
863
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
864 864
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved! No field filters criteria found:', array( 'data' => $search_criteria ) );
865 865
 			return $entry;
866 866
 		}
867 867
 
868
-		$filters = $search_criteria['field_filters'];
868
+		$filters = $search_criteria[ 'field_filters' ];
869 869
 
870
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
870
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
871 871
 
872
-		$mode = $mode ? : 'all'; // If mode is an empty string, assume it's 'all'
872
+		$mode = $mode ?: 'all'; // If mode is an empty string, assume it's '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
 			}
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 			'post_type'      => 'gravityview',
1131 1131
 			'posts_per_page' => 100,
1132 1132
 			'meta_key'       => '_gravityview_form_id',
1133
-			'meta_value'     => (int) $form_id,
1133
+			'meta_value'     => (int)$form_id,
1134 1134
 		);
1135 1135
 		$args     = wp_parse_args( $args, $defaults );
1136 1136
 		$views    = get_posts( $args );
@@ -1142,21 +1142,21 @@  discard block
 block discarded – undo
1142 1142
 
1143 1143
 			$data = unserialize( $view->meta_value );
1144 1144
 
1145
-			if( ! $data || ! is_array( $data ) ) {
1145
+			if ( ! $data || ! is_array( $data ) ) {
1146 1146
 				continue;
1147 1147
 			}
1148 1148
 
1149 1149
 			foreach ( $data as $datum ) {
1150
-				if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) {
1151
-					$joined_forms[] = $view->post_id;
1150
+				if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) {
1151
+					$joined_forms[ ] = $view->post_id;
1152 1152
 				}
1153 1153
 			}
1154 1154
 		}
1155 1155
 
1156 1156
 		if ( $joined_forms ) {
1157
-			$joined_args  = array(
1157
+			$joined_args = array(
1158 1158
 				'post_type'      => 'gravityview',
1159
-				'posts_per_page' => $args['posts_per_page'],
1159
+				'posts_per_page' => $args[ 'posts_per_page' ],
1160 1160
 				'post__in'       => $joined_forms,
1161 1161
 			);
1162 1162
 			$views = array_merge( $views, get_posts( $joined_args ) );
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 
1313 1313
 		$directory_widgets = wp_parse_args( $view_widgets, $defaults );
1314 1314
 
1315
-		if( $json_decode ) {
1315
+		if ( $json_decode ) {
1316 1316
 			$directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' );
1317 1317
 		}
1318 1318
 
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
 	 * @return string         html
1329 1329
 	 */
1330 1330
 	public static function get_sortable_fields( $formid, $current = '' ) {
1331
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1331
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1332 1332
 
1333 1333
 		if ( empty( $formid ) ) {
1334 1334
 			return $output;
@@ -1341,11 +1341,11 @@  discard block
 block discarded – undo
1341 1341
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1342 1342
 
1343 1343
 			foreach ( $fields as $id => $field ) {
1344
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1344
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1345 1345
 					continue;
1346 1346
 				}
1347 1347
 
1348
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1348
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1349 1349
 			}
1350 1350
 		}
1351 1351
 
@@ -1380,9 +1380,9 @@  discard block
 block discarded – undo
1380 1380
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1381 1381
 
1382 1382
 		// TODO: Convert to using array_filter
1383
-		foreach( $fields as $id => $field ) {
1383
+		foreach ( $fields as $id => $field ) {
1384 1384
 
1385
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1385
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1386 1386
 				unset( $fields[ $id ] );
1387 1387
 			}
1388 1388
 		}
@@ -1423,14 +1423,14 @@  discard block
 block discarded – undo
1423 1423
 	 * @param  int|array  $field field key or field array
1424 1424
 	 * @return boolean
1425 1425
 	 */
1426
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1426
+	public static function is_field_numeric( $form = null, $field = '' ) {
1427 1427
 
1428 1428
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1429 1429
 			$form = self::get_form( $form );
1430 1430
 		}
1431 1431
 
1432 1432
 		// If entry meta, it's a string. Otherwise, numeric
1433
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1433
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1434 1434
 			$type = $field;
1435 1435
 		} else {
1436 1436
 			$type = self::get_field_type( $form, $field );
@@ -1444,9 +1444,9 @@  discard block
 block discarded – undo
1444 1444
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1445 1445
 
1446 1446
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1447
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1448
-			if( true === $gv_field->is_numeric ) {
1449
-				$numeric_types[] = $gv_field->is_numeric;
1447
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1448
+			if ( true === $gv_field->is_numeric ) {
1449
+				$numeric_types[ ] = $gv_field->is_numeric;
1450 1450
 			}
1451 1451
 		}
1452 1452
 
@@ -1596,18 +1596,18 @@  discard block
 block discarded – undo
1596 1596
 		$final_atts = array_filter( $final_atts );
1597 1597
 
1598 1598
 		// If the href wasn't passed as an attribute, use the value passed to the function
1599
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1600
-			$final_atts['href'] = $href;
1599
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1600
+			$final_atts[ 'href' ] = $href;
1601 1601
 		}
1602 1602
 
1603
-		$final_atts['href'] = esc_url_raw( $href );
1603
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1604 1604
 
1605 1605
 		/**
1606 1606
 		 * Fix potential security issue with target=_blank
1607 1607
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1608 1608
 		 */
1609
-		if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1610
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1609
+		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1610
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1611 1611
 		}
1612 1612
 
1613 1613
 		// Sort the attributes alphabetically, to help testing
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1620 1620
 		}
1621 1621
 
1622
-		if( '' !== $output ) {
1622
+		if ( '' !== $output ) {
1623 1623
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1624 1624
 		}
1625 1625
 
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1647 1647
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1648 1648
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1649
-				$merged[] = $value;
1649
+				$merged[ ] = $value;
1650 1650
 			} else {
1651 1651
 				$merged[ $key ] = $value;
1652 1652
 			}
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1680 1680
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1681 1681
 		 */
1682
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1682
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1683 1683
 
1684 1684
 		return get_users( $get_users_settings );
1685 1685
 	}
@@ -1699,11 +1699,11 @@  discard block
 block discarded – undo
1699 1699
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1700 1700
 
1701 1701
     	// If $cap is defined, only show notice if user has capability
1702
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1702
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1703 1703
     		return '';
1704 1704
 	    }
1705 1705
 
1706
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1706
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1707 1707
     }
1708 1708
 
1709 1709
 	/**
Please login to merge, or discard this patch.
includes/class-gravityview-gfformsmodel.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 	public static function is_value_match( $field_value, $target_value, $operation = 'is', $source_field = null, $rule = null, $form = null ) {
41 41
 
42 42
 		if ( 'date_created' === $source_field ) {
43
-			$field_value = is_int( $field_value )? $field_value : strtotime( $field_value );
44
-			$target_value = is_int( $target_value )? $target_value : strtotime( $target_value );
43
+			$field_value = is_int( $field_value ) ? $field_value : strtotime( $field_value );
44
+			$target_value = is_int( $target_value ) ? $target_value : strtotime( $target_value );
45 45
 		}
46 46
 
47 47
 		if ( in_array( $operation, array( 'in', 'not_in' ) ) ) {
48
-			return GVCommon::matches_operation( (array) $field_value, (array) $target_value, $operation );
48
+			return GVCommon::matches_operation( (array)$field_value, (array)$target_value, $operation );
49 49
 		}
50 50
 
51
-		return parent::is_value_match( (array) $field_value, $target_value, $operation, $source_field, $rule, $form );
51
+		return parent::is_value_match( (array)$field_value, $target_value, $operation, $source_field, $rule, $form );
52 52
 	}
53 53
 
54 54
 	/**
@@ -69,18 +69,18 @@  discard block
 block discarded – undo
69 69
 
70 70
         $post_data = self::get_post_fields( $form, $entry );
71 71
 
72
-        $media = get_attached_media( 'image', $entry['post_id'] );
72
+        $media = get_attached_media( 'image', $entry[ 'post_id' ] );
73 73
 
74 74
         $post_images = array();
75 75
 
76 76
         foreach ( $media as $media_item ) {
77
-            foreach( (array) $post_data['images'] as $post_data_item ) {
78
-                if(
77
+            foreach ( (array)$post_data[ 'images' ] as $post_data_item ) {
78
+                if (
79 79
                     \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title &&
80 80
                     \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content &&
81 81
                     \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt
82 82
                 ) {
83
-                    $post_images["{$post_data_item['field_id']}"] = $media_item->ID;
83
+                    $post_images[ "{$post_data_item[ 'field_id' ]}" ] = $media_item->ID;
84 84
                 }
85 85
             }
86 86
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
          * If the method changes to public, use Gravity Forms' method
109 109
          * @todo: If/when the method is public, remove the unneeded copied code.
110 110
          */
111
-        if( $reflection->isPublic() ) {
111
+        if ( $reflection->isPublic() ) {
112 112
             return parent::get_post_fields( $form, $entry );
113 113
         }
114 114
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
          * If the method changes to public, use Gravity Forms' method
136 136
          * @todo: If/when the method is public, remove the unneeded copied code.
137 137
          */
138
-        if( $reflection->isPublic() ) {
138
+        if ( $reflection->isPublic() ) {
139 139
             return parent::copy_post_image( $url, $post_id );
140 140
         }
141 141
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
          * If the method changes to public, use Gravity Forms' method
171 171
          * @todo: If/when the method is public, remove the unneeded copied code.
172 172
          */
173
-        if( $reflection->isPublic() ) {
173
+        if ( $reflection->isPublic() ) {
174 174
             return parent::media_handle_upload( $url, $post_id, $post_data );
175 175
         }
176 176
 
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 2 patches
Indentation   +264 added lines, -264 removed lines patch added patch discarded remove patch
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 
95 95
 	/**
96 96
 	 * ID of the current post. May also be ID of the current View.
97
-     *
98
-     * @since 2.0.13
99
-     * 
100
-     * @var int
97
+	 *
98
+	 * @since 2.0.13
99
+	 * 
100
+	 * @var int
101 101
 	 */
102 102
 	public $post_id;
103 103
 
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171 171
 		if( ! empty( $_POST ) ) {
172
-	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
172
+			gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175 175
 		if( $this->is_edit_entry_submission() ) {
176 176
 			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
177
+			remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	 * When Edit entry view is requested setup the vars
203 203
 	 */
204 204
 	private function setup_vars() {
205
-        global $post;
205
+		global $post;
206 206
 
207 207
 		$gravityview_view = GravityView_View::getInstance();
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+		self::$original_entry = $entries[0];
212
+		$this->entry = $entries[0];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 
332 332
 			GFFormsModel::save_lead( $form, $this->entry );
333 333
 
334
-	        // Delete the values for hidden inputs
335
-	        $this->unset_hidden_field_values();
334
+			// Delete the values for hidden inputs
335
+			$this->unset_hidden_field_values();
336 336
 			
337 337
 			$this->entry['date_created'] = $date_created;
338 338
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			// Perform actions normally performed after updating a lead
343 343
 			$this->after_update();
344 344
 
345
-	        /**
345
+			/**
346 346
 			 * Must be AFTER after_update()!
347 347
 			 * @see https://github.com/gravityview/GravityView/issues/764
348 348
 			 */
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 * @return void
373 373
 	 */
374 374
 	private function unset_hidden_field_values() {
375
-	    global $wpdb;
375
+		global $wpdb;
376 376
 
377 377
 		/**
378 378
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -394,27 +394,27 @@  discard block
 block discarded – undo
394 394
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
395 395
 		}
396 396
 
397
-	    foreach ( $this->entry as $input_id => $field_value ) {
397
+		foreach ( $this->entry as $input_id => $field_value ) {
398 398
 
399
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
399
+			$field = RGFormsModel::get_field( $this->form, $input_id );
400 400
 
401
-		    // Reset fields that are hidden
402
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
403
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
401
+			// Reset fields that are hidden
402
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
403
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
404 404
 
405
-		        // List fields are stored as empty arrays when empty
406
-			    $empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
405
+				// List fields are stored as empty arrays when empty
406
+				$empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
407 407
 
408
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
408
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
409 409
 
410
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
410
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
411 411
 
412
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
412
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
413 413
 				// after submission
414
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
415
-			    $_POST[ $post_input_id ] = '';
416
-		    }
417
-	    }
414
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
415
+				$_POST[ $post_input_id ] = '';
416
+			}
417
+		}
418 418
 	}
419 419
 
420 420
 	/**
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 
509 509
 		$form = $this->form;
510 510
 
511
-	    /** @var GF_Field $field */
511
+		/** @var GF_Field $field */
512 512
 		foreach( $form['fields'] as $k => &$field ) {
513 513
 
514 514
 			/**
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 
525 525
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
526 526
 				foreach( $field->inputs as $key => $input ) {
527
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
527
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
528 528
 				}
529 529
 			}
530 530
 		}
@@ -545,13 +545,13 @@  discard block
 block discarded – undo
545 545
 			foreach ( $this->fields_with_calculation as $calc_field ) {
546 546
 				$inputs = $calc_field->get_entry_inputs();
547 547
 				if ( is_array( $inputs ) ) {
548
-				    foreach ( $inputs as $input ) {
549
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
550
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
551
-				    }
548
+					foreach ( $inputs as $input ) {
549
+						$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
550
+						$entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
551
+					}
552 552
 				} else {
553
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
554
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
553
+					$input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
554
+					$entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
555 555
 				}
556 556
 			}
557 557
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
600 600
 
601 601
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
602
-	        $ary = stripslashes_deep( $ary );
602
+			$ary = stripslashes_deep( $ary );
603 603
 			$img_url = \GV\Utils::get( $ary, 0 );
604 604
 
605 605
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 	private function maybe_update_post_fields( $form ) {
673 673
 
674 674
 		if( empty( $this->entry['post_id'] ) ) {
675
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
675
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
676 676
 			return;
677 677
 		}
678 678
 
@@ -707,51 +707,51 @@  discard block
 block discarded – undo
707 707
 
708 708
 				switch( $field->type ) {
709 709
 
710
-				    case 'post_title':
711
-				        $post_title = $value;
712
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
713
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
714
-				        }
715
-				        $updated_post->post_title = $post_title;
716
-				        $updated_post->post_name  = $post_title;
717
-				        unset( $post_title );
718
-				        break;
719
-
720
-				    case 'post_content':
721
-				        $post_content = $value;
722
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
723
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
724
-				        }
725
-				        $updated_post->post_content = $post_content;
726
-				        unset( $post_content );
727
-				        break;
728
-				    case 'post_excerpt':
729
-				        $updated_post->post_excerpt = $value;
730
-				        break;
731
-				    case 'post_tags':
732
-				        wp_set_post_tags( $post_id, $value, false );
733
-				        break;
734
-				    case 'post_category':
735
-				        break;
736
-				    case 'post_custom_field':
710
+					case 'post_title':
711
+						$post_title = $value;
712
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
713
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
714
+						}
715
+						$updated_post->post_title = $post_title;
716
+						$updated_post->post_name  = $post_title;
717
+						unset( $post_title );
718
+						break;
719
+
720
+					case 'post_content':
721
+						$post_content = $value;
722
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
723
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
724
+						}
725
+						$updated_post->post_content = $post_content;
726
+						unset( $post_content );
727
+						break;
728
+					case 'post_excerpt':
729
+						$updated_post->post_excerpt = $value;
730
+						break;
731
+					case 'post_tags':
732
+						wp_set_post_tags( $post_id, $value, false );
733
+						break;
734
+					case 'post_category':
735
+						break;
736
+					case 'post_custom_field':
737 737
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
738 738
 							$value = $value[ $field_id ];
739 739
 						}
740 740
 
741
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
742
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
743
-				        }
741
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
742
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
743
+						}
744 744
 
745
-	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
746
-		                    $value = wp_json_encode( $value );
747
-	                    }
745
+						if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
746
+							$value = wp_json_encode( $value );
747
+						}
748 748
 
749
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
750
-				        break;
749
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
750
+						break;
751 751
 
752
-				    case 'post_image':
753
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
754
-				        break;
752
+					case 'post_image':
753
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
754
+						break;
755 755
 
756 756
 				}
757 757
 
@@ -796,20 +796,20 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	private function is_field_json_encoded( $field ) {
798 798
 
799
-	    $json_encoded = false;
799
+		$json_encoded = false;
800 800
 
801 801
 		$input_type = RGFormsModel::get_input_type( $field );
802 802
 
803
-	    // Only certain custom field types are supported
804
-	    switch( $input_type ) {
805
-		    case 'fileupload':
806
-		    case 'list':
807
-		    case 'multiselect':
808
-			    $json_encoded = true;
809
-			    break;
810
-	    }
803
+		// Only certain custom field types are supported
804
+		switch( $input_type ) {
805
+			case 'fileupload':
806
+			case 'list':
807
+			case 'multiselect':
808
+				$json_encoded = true;
809
+				break;
810
+		}
811 811
 
812
-	    return $json_encoded;
812
+		return $json_encoded;
813 813
 	}
814 814
 
815 815
 	/**
@@ -899,14 +899,14 @@  discard block
 block discarded – undo
899 899
 			?><h2 class="gv-edit-entry-title">
900 900
 				<span><?php
901 901
 
902
-				    /**
903
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
904
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
905
-				     * @param GravityView_Edit_Entry_Render $this This object
906
-				     */
907
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
902
+					/**
903
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
904
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
905
+					 * @param GravityView_Edit_Entry_Render $this This object
906
+					 */
907
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
908 908
 
909
-				    echo esc_attr( $edit_entry_title );
909
+					echo esc_attr( $edit_entry_title );
910 910
 			?></span>
911 911
 			</h2>
912 912
 
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 
1016 1016
 		ob_get_clean();
1017 1017
 
1018
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1018
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1019 1019
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1020 1020
 		remove_filter( 'gform_disable_view_counter', '__return_true' );
1021 1021
 		remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 );
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 
1070 1070
 		// for now we don't support Save and Continue feature.
1071 1071
 		if( ! self::$supports_save_and_continue ) {
1072
-	        unset( $form['save'] );
1072
+			unset( $form['save'] );
1073 1073
 		}
1074 1074
 
1075 1075
 		return $form;
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 			|| ! empty( $field_content )
1145 1145
 			|| in_array( $field->type, array( 'honeypot' ) )
1146 1146
 		) {
1147
-	        return $field_content;
1147
+			return $field_content;
1148 1148
 		}
1149 1149
 
1150 1150
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1152,24 +1152,24 @@  discard block
 block discarded – undo
1152 1152
 
1153 1153
 		$field_value = $this->get_field_value( $field );
1154 1154
 
1155
-	    // Prevent any PHP warnings, like undefined index
1156
-	    ob_start();
1155
+		// Prevent any PHP warnings, like undefined index
1156
+		ob_start();
1157 1157
 
1158
-	    $return = null;
1158
+		$return = null;
1159 1159
 
1160 1160
 		/** @var GravityView_Field $gv_field */
1161 1161
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1162 1162
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1163 1163
 		} else {
1164
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1165
-	    }
1164
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1165
+		}
1166 1166
 
1167
-	    // If there was output, it's an error
1168
-	    $warnings = ob_get_clean();
1167
+		// If there was output, it's an error
1168
+		$warnings = ob_get_clean();
1169 1169
 
1170
-	    if( !empty( $warnings ) ) {
1171
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1172
-	    }
1170
+		if( !empty( $warnings ) ) {
1171
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1172
+		}
1173 1173
 
1174 1174
 		return $return;
1175 1175
 	}
@@ -1204,8 +1204,8 @@  discard block
 block discarded – undo
1204 1204
 				$input_id = strval( $input['id'] );
1205 1205
 				
1206 1206
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1207
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1208
-				    $allow_pre_populated = false;
1207
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1208
+					$allow_pre_populated = false;
1209 1209
 				}
1210 1210
 
1211 1211
 			}
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1230 1230
 				$categories = array();
1231 1231
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1232
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1232
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1233 1233
 				}
1234 1234
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1235 1235
 			}
@@ -1239,25 +1239,25 @@  discard block
 block discarded – undo
1239 1239
 		// if value is empty get the default value if defined
1240 1240
 		$field_value = $field->get_value_default_if_empty( $field_value );
1241 1241
 
1242
-	    /**
1243
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1244
-	     * @since 1.11
1245
-	     * @since 1.20 Added third param
1246
-	     * @param mixed $field_value field value used to populate the input
1247
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1248
-	     * @param GravityView_Edit_Entry_Render $this Current object
1249
-	     */
1250
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1251
-
1252
-	    /**
1253
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1254
-	     * @since 1.17
1255
-	     * @since 1.20 Added third param
1256
-	     * @param mixed $field_value field value used to populate the input
1257
-	     * @param GF_Field $field Gravity Forms field object
1258
-	     * @param GravityView_Edit_Entry_Render $this Current object
1259
-	     */
1260
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1242
+		/**
1243
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1244
+		 * @since 1.11
1245
+		 * @since 1.20 Added third param
1246
+		 * @param mixed $field_value field value used to populate the input
1247
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1248
+		 * @param GravityView_Edit_Entry_Render $this Current object
1249
+		 */
1250
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1251
+
1252
+		/**
1253
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1254
+		 * @since 1.17
1255
+		 * @since 1.20 Added third param
1256
+		 * @param mixed $field_value field value used to populate the input
1257
+		 * @param GF_Field $field Gravity Forms field object
1258
+		 * @param GravityView_Edit_Entry_Render $this Current object
1259
+		 */
1260
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1261 1261
 
1262 1262
 		return $field_value;
1263 1263
 	}
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1285 1285
 			// expects certain field array items to be set.
1286 1286
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1287
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1287
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1288 1288
 			}
1289 1289
 
1290 1290
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1298,61 +1298,61 @@  discard block
 block discarded – undo
1298 1298
 				 */
1299 1299
 				case 'fileupload':
1300 1300
 
1301
-				    // Set the previous value
1302
-				    $entry = $this->get_entry();
1301
+					// Set the previous value
1302
+					$entry = $this->get_entry();
1303 1303
 
1304
-				    $input_name = 'input_'.$field->id;
1305
-				    $form_id = $form['id'];
1304
+					$input_name = 'input_'.$field->id;
1305
+					$form_id = $form['id'];
1306 1306
 
1307
-				    $value = NULL;
1307
+					$value = NULL;
1308 1308
 
1309
-				    // Use the previous entry value as the default.
1310
-				    if( isset( $entry[ $field->id ] ) ) {
1311
-				        $value = $entry[ $field->id ];
1312
-				    }
1309
+					// Use the previous entry value as the default.
1310
+					if( isset( $entry[ $field->id ] ) ) {
1311
+						$value = $entry[ $field->id ];
1312
+					}
1313 1313
 
1314
-				    // If this is a single upload file
1315
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1316
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1317
-				        $value = $file_path['url'];
1314
+					// If this is a single upload file
1315
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1316
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1317
+						$value = $file_path['url'];
1318 1318
 
1319
-				    } else {
1319
+					} else {
1320 1320
 
1321
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1322
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1323
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1321
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1322
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1323
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1324 1324
 
1325
-				    }
1325
+					}
1326 1326
 
1327
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1327
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1328 1328
 
1329
-				        // If there are fresh uploads, process and merge them.
1330
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1331
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1332
-				            $value = empty( $value ) ? '[]' : $value;
1333
-				            $value = stripslashes_deep( $value );
1334
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1335
-				        }
1329
+						// If there are fresh uploads, process and merge them.
1330
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1331
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1332
+							$value = empty( $value ) ? '[]' : $value;
1333
+							$value = stripslashes_deep( $value );
1334
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1335
+						}
1336 1336
 
1337
-				    } else {
1337
+					} else {
1338 1338
 
1339
-				        // A file already exists when editing an entry
1340
-				        // We set this to solve issue when file upload fields are required.
1341
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1339
+						// A file already exists when editing an entry
1340
+						// We set this to solve issue when file upload fields are required.
1341
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1342 1342
 
1343
-				    }
1343
+					}
1344 1344
 
1345
-				    $this->entry[ $input_name ] = $value;
1346
-				    $_POST[ $input_name ] = $value;
1345
+					$this->entry[ $input_name ] = $value;
1346
+					$_POST[ $input_name ] = $value;
1347 1347
 
1348
-				    break;
1348
+					break;
1349 1349
 
1350 1350
 				case 'number':
1351
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1352
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1353
-				        $_POST['input_'.$field->id ] = NULL;
1354
-				    }
1355
-				    break;
1351
+					// Fix "undefined index" issue at line 1286 in form_display.php
1352
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1353
+						$_POST['input_'.$field->id ] = NULL;
1354
+					}
1355
+					break;
1356 1356
 			}
1357 1357
 
1358 1358
 		}
@@ -1437,42 +1437,42 @@  discard block
 block discarded – undo
1437 1437
 				case 'fileupload' :
1438 1438
 				case 'post_image':
1439 1439
 
1440
-				    // in case nothing is uploaded but there are already files saved
1441
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1442
-				        $field->failed_validation = false;
1443
-				        unset( $field->validation_message );
1444
-				    }
1440
+					// in case nothing is uploaded but there are already files saved
1441
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1442
+						$field->failed_validation = false;
1443
+						unset( $field->validation_message );
1444
+					}
1445 1445
 
1446
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1447
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1446
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1447
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1448 1448
 
1449
-				        $input_name = 'input_' . $field->id;
1450
-				        //uploaded
1451
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1449
+						$input_name = 'input_' . $field->id;
1450
+						//uploaded
1451
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1452 1452
 
1453
-				        //existent
1454
-				        $entry = $this->get_entry();
1455
-				        $value = NULL;
1456
-				        if( isset( $entry[ $field->id ] ) ) {
1457
-				            $value = json_decode( $entry[ $field->id ], true );
1458
-				        }
1453
+						//existent
1454
+						$entry = $this->get_entry();
1455
+						$value = NULL;
1456
+						if( isset( $entry[ $field->id ] ) ) {
1457
+							$value = json_decode( $entry[ $field->id ], true );
1458
+						}
1459 1459
 
1460
-				        // count uploaded files and existent entry files
1461
-				        $count_files = count( $file_names ) + count( $value );
1460
+						// count uploaded files and existent entry files
1461
+						$count_files = count( $file_names ) + count( $value );
1462 1462
 
1463
-				        if( $count_files > $field->maxFiles ) {
1464
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1465
-				            $field->failed_validation = 1;
1466
-				            $gv_valid = false;
1463
+						if( $count_files > $field->maxFiles ) {
1464
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1465
+							$field->failed_validation = 1;
1466
+							$gv_valid = false;
1467 1467
 
1468
-				            // in case of error make sure the newest upload files are removed from the upload input
1469
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1470
-				        }
1468
+							// in case of error make sure the newest upload files are removed from the upload input
1469
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1470
+						}
1471 1471
 
1472
-				    }
1472
+					}
1473 1473
 
1474 1474
 
1475
-				    break;
1475
+					break;
1476 1476
 
1477 1477
 			}
1478 1478
 
@@ -1483,47 +1483,47 @@  discard block
 block discarded – undo
1483 1483
 
1484 1484
 				switch ( $field_type ) {
1485 1485
 
1486
-				    // Captchas don't need to be re-entered.
1487
-				    case 'captcha':
1486
+					// Captchas don't need to be re-entered.
1487
+					case 'captcha':
1488 1488
 
1489
-				        // Post Image fields aren't editable, so we un-fail them.
1490
-				    case 'post_image':
1491
-				        $field->failed_validation = false;
1492
-				        unset( $field->validation_message );
1493
-				        break;
1489
+						// Post Image fields aren't editable, so we un-fail them.
1490
+					case 'post_image':
1491
+						$field->failed_validation = false;
1492
+						unset( $field->validation_message );
1493
+						break;
1494 1494
 
1495 1495
 				}
1496 1496
 
1497 1497
 				// You can't continue inside a switch, so we do it after.
1498 1498
 				if( empty( $field->failed_validation ) ) {
1499
-				    continue;
1499
+					continue;
1500 1500
 				}
1501 1501
 
1502 1502
 				// checks if the No Duplicates option is not validating entry against itself, since
1503 1503
 				// we're editing a stored entry, it would also assume it's a duplicate.
1504 1504
 				if( !empty( $field->noDuplicates ) ) {
1505 1505
 
1506
-				    $entry = $this->get_entry();
1506
+					$entry = $this->get_entry();
1507 1507
 
1508
-				    // If the value of the entry is the same as the stored value
1509
-				    // Then we can assume it's not a duplicate, it's the same.
1510
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1511
-				        //if value submitted was not changed, then don't validate
1512
-				        $field->failed_validation = false;
1508
+					// If the value of the entry is the same as the stored value
1509
+					// Then we can assume it's not a duplicate, it's the same.
1510
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1511
+						//if value submitted was not changed, then don't validate
1512
+						$field->failed_validation = false;
1513 1513
 
1514
-				        unset( $field->validation_message );
1514
+						unset( $field->validation_message );
1515 1515
 
1516
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1516
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1517 1517
 
1518
-				        continue;
1519
-				    }
1518
+						continue;
1519
+					}
1520 1520
 				}
1521 1521
 
1522 1522
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1523 1523
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1524
-				    unset( $field->validation_message );
1525
-	                $field->validation_message = false;
1526
-				    continue;
1524
+					unset( $field->validation_message );
1525
+					$field->validation_message = false;
1526
+					continue;
1527 1527
 				}
1528 1528
 
1529 1529
 				$gv_valid = false;
@@ -1587,8 +1587,8 @@  discard block
 block discarded – undo
1587 1587
 		// Hide fields depending on admin settings
1588 1588
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1589 1589
 
1590
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1591
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1590
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1591
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1592 1592
 
1593 1593
 		/**
1594 1594
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1648,11 +1648,11 @@  discard block
 block discarded – undo
1648 1648
 		// The edit tab has been configured, so we loop through to configured settings
1649 1649
 		foreach ( $configured_fields as $configured_field ) {
1650 1650
 
1651
-	        /** @var GF_Field $field */
1652
-	        foreach ( $fields as $field ) {
1651
+			/** @var GF_Field $field */
1652
+			foreach ( $fields as $field ) {
1653 1653
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1654
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1655
-				    break;
1654
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1655
+					break;
1656 1656
 				}
1657 1657
 
1658 1658
 			}
@@ -1708,28 +1708,28 @@  discard block
 block discarded – undo
1708 1708
 	 */
1709 1709
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1710 1710
 
1711
-	    /**
1711
+		/**
1712 1712
 		 * @filter `gravityview/edit_entry/use_gf_admin_only_setting` When Edit tab isn't configured, should the Gravity Forms "Admin Only" field settings be used to control field display to non-admins? Default: true
1713
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1714
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1715
-	     * @since 1.9.1
1716
-	     * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
1717
-	     * @param array $form GF Form array
1718
-	     * @param int $view_id View ID
1719
-	     */
1720
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1721
-
1722
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1713
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1714
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1715
+		 * @since 1.9.1
1716
+		 * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
1717
+		 * @param array $form GF Form array
1718
+		 * @param int $view_id View ID
1719
+		 */
1720
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1721
+
1722
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1723 1723
 			foreach( $fields as $k => $field ) {
1724 1724
 				if( $field->adminOnly ) {
1725
-				    unset( $fields[ $k ] );
1725
+					unset( $fields[ $k ] );
1726 1726
 				}
1727 1727
 			}
1728 1728
 			return $fields;
1729 1729
 		}
1730 1730
 
1731
-	    foreach( $fields as &$field ) {
1732
-		    $field->adminOnly = false;
1731
+		foreach( $fields as &$field ) {
1732
+			$field->adminOnly = false;
1733 1733
 		}
1734 1734
 
1735 1735
 		return $fields;
@@ -1762,36 +1762,36 @@  discard block
 block discarded – undo
1762 1762
 
1763 1763
 			if( 'checkbox' === $field->type ) {
1764 1764
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1765
-				    $input_id = $input['id'];
1766
-				    $choice = $field->choices[ $key ];
1767
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1768
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1769
-				    if( $match ) {
1770
-				        $field->choices[ $key ]['isSelected'] = true;
1771
-				    }
1765
+					$input_id = $input['id'];
1766
+					$choice = $field->choices[ $key ];
1767
+					$value = \GV\Utils::get( $this->entry, $input_id );
1768
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1769
+					if( $match ) {
1770
+						$field->choices[ $key ]['isSelected'] = true;
1771
+					}
1772 1772
 				}
1773 1773
 			} else {
1774 1774
 
1775 1775
 				// We need to run through each field to set the default values
1776 1776
 				foreach ( $this->entry as $field_id => $field_value ) {
1777 1777
 
1778
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1778
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1779 1779
 
1780
-				        if( 'list' === $field->type ) {
1781
-				            $list_rows = maybe_unserialize( $field_value );
1780
+						if( 'list' === $field->type ) {
1781
+							$list_rows = maybe_unserialize( $field_value );
1782 1782
 
1783
-				            $list_field_value = array();
1784
-				            foreach ( (array) $list_rows as $row ) {
1785
-				                foreach ( (array) $row as $column ) {
1786
-				                    $list_field_value[] = $column;
1787
-				                }
1788
-				            }
1783
+							$list_field_value = array();
1784
+							foreach ( (array) $list_rows as $row ) {
1785
+								foreach ( (array) $row as $column ) {
1786
+									$list_field_value[] = $column;
1787
+								}
1788
+							}
1789 1789
 
1790
-				            $field->defaultValue = serialize( $list_field_value );
1791
-				        } else {
1792
-				            $field->defaultValue = $field_value;
1793
-				        }
1794
-				    }
1790
+							$field->defaultValue = serialize( $list_field_value );
1791
+						} else {
1792
+							$field->defaultValue = $field_value;
1793
+						}
1794
+					}
1795 1795
 				}
1796 1796
 			}
1797 1797
 		}
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
 			return $has_conditional_logic;
1849 1849
 		}
1850 1850
 
1851
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1851
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1852 1852
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
1853 1853
 	}
1854 1854
 
@@ -1915,14 +1915,14 @@  discard block
 block discarded – undo
1915 1915
 
1916 1916
 		if( $echo && $error !== true ) {
1917 1917
 
1918
-	        $error = esc_html( $error );
1918
+			$error = esc_html( $error );
1919 1919
 
1920
-	        /**
1921
-	         * @since 1.9
1922
-	         */
1923
-	        if ( ! empty( $this->entry ) ) {
1924
-		        $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1925
-	        }
1920
+			/**
1921
+			 * @since 1.9
1922
+			 */
1923
+			if ( ! empty( $this->entry ) ) {
1924
+				$error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1925
+			}
1926 1926
 
1927 1927
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1928 1928
 		}
Please login to merge, or discard this patch.
Spacing   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 	function load() {
116 116
 
117 117
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
118
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
118
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
119 119
 
120 120
 		// Don't display an embedded form when editing an entry
121 121
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
122 122
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
123 123
 
124 124
 		// Stop Gravity Forms processing what is ours!
125
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
125
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
126 126
 
127
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
127
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
128 128
 
129 129
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
130 130
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
136 136
 
137 137
 		// Add fields expected by GFFormDisplay::validate()
138
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
138
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
139 139
 
140 140
 		// Fix multiselect value for GF 2.2
141 141
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @return void
153 153
 	 */
154 154
 	public function prevent_render_form() {
155
-		if( $this->is_edit_entry() ) {
156
-			if( 'wp_head' === current_filter() ) {
155
+		if ( $this->is_edit_entry() ) {
156
+			if ( 'wp_head' === current_filter() ) {
157 157
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
158 158
 			} else {
159 159
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171
-		if( ! empty( $_POST ) ) {
171
+		if ( ! empty( $_POST ) ) {
172 172
 	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175
-		if( $this->is_edit_entry_submission() ) {
176
-			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
175
+		if ( $this->is_edit_entry_submission() ) {
176
+			remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
177
+	        remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function is_edit_entry() {
186 186
 
187
-		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
187
+		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
188 188
 
189 189
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
190 190
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @return boolean
196 196
 	 */
197 197
 	public function is_edit_entry_submission() {
198
-		return !empty( $_POST[ self::$nonce_field ] );
198
+		return ! empty( $_POST[ self::$nonce_field ] );
199 199
 	}
200 200
 
201 201
 	/**
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+	    self::$original_entry = $entries[ 0 ];
212
+	    $this->entry = $entries[ 0 ];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		$this->view_id = $gravityview_view->getViewId();
218 218
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
219 219
 
220
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
220
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
221 221
 	}
222 222
 
223 223
 
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 		}
242 242
 
243 243
 		// Multiple Views embedded, don't proceed if nonce fails
244
-		if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) {
244
+		if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) {
245 245
 			gravityview()->log->error( 'Nonce validation failed for the Edit Entry request; returning' );
246 246
 			return;
247 247
 		}
248 248
 
249 249
 		// Sorry, you're not allowed here.
250
-		if( false === $this->user_can_edit_entry( true ) ) {
250
+		if ( false === $this->user_can_edit_entry( true ) ) {
251 251
 			gravityview()->log->error( 'User is not allowed to edit this entry; returning', array( 'data' => $this->entry ) );
252 252
 			return;
253 253
 		}
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 	private function print_scripts() {
269 269
 		$gravityview_view = GravityView_View::getInstance();
270 270
 
271
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
271
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
272 272
 
273
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
273
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
274 274
 
275 275
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
276 276
 
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	private function process_save() {
286 286
 
287
-		if( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
287
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
288 288
 			return;
289 289
 		}
290 290
 
291 291
 		// Make sure the entry, view, and form IDs are all correct
292 292
 		$valid = $this->verify_nonce();
293 293
 
294
-		if( !$valid ) {
294
+		if ( ! $valid ) {
295 295
 			gravityview()->log->error( 'Nonce validation failed.' );
296 296
 			return;
297 297
 		}
298 298
 
299
-		if( $this->entry['id'] !== $_POST['lid'] ) {
299
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
300 300
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
301 301
 			return;
302 302
 		}
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
 		$this->validate();
309 309
 
310
-		if( $this->is_valid ) {
310
+		if ( $this->is_valid ) {
311 311
 
312 312
 			gravityview()->log->debug( 'Submission is valid.' );
313 313
 
@@ -319,22 +319,22 @@  discard block
 block discarded – undo
319 319
 			/**
320 320
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
321 321
 			 */
322
-			unset( $_GET['page'] );
322
+			unset( $_GET[ 'page' ] );
323 323
 
324
-			$date_created = $this->entry['date_created'];
324
+			$date_created = $this->entry[ 'date_created' ];
325 325
 
326 326
 			/**
327 327
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
328 328
 			 * @since 1.17.2
329 329
 			 */
330
-			unset( $this->entry['date_created'] );
330
+			unset( $this->entry[ 'date_created' ] );
331 331
 
332 332
 			GFFormsModel::save_lead( $form, $this->entry );
333 333
 
334 334
 	        // Delete the values for hidden inputs
335 335
 	        $this->unset_hidden_field_values();
336 336
 			
337
-			$this->entry['date_created'] = $date_created;
337
+			$this->entry[ 'date_created' ] = $date_created;
338 338
 
339 339
 			// Process calculation fields
340 340
 			$this->update_calculation_fields();
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 			 * @param string $entry_id Numeric ID of the entry that was updated
355 355
 			 * @param GravityView_Edit_Entry_Render $this This object
356 356
 			 */
357
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this );
357
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this );
358 358
 
359 359
 		} else {
360 360
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
 		 */
383 383
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
384 384
 
385
-		if( ! $unset_hidden_field_values ) {
385
+		if ( ! $unset_hidden_field_values ) {
386 386
 			return;
387 387
 		}
388 388
 
389 389
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
390 390
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
391
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
391
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
392 392
 		} else {
393 393
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
394
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
394
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
395 395
 		}
396 396
 
397 397
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		}
473 473
 
474 474
 		/** No file is being uploaded. */
475
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
475
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
476 476
 			/** So return the original upload */
477 477
 			return $entry[ $input_id ];
478 478
 		}
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 	 * @return mixed
491 491
 	 */
492 492
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
493
-		if( ! $this->is_edit_entry() ) {
493
+		if ( ! $this->is_edit_entry() ) {
494 494
 			return $plupload_init;
495 495
 		}
496 496
 
497
-		$plupload_init['gf_vars']['max_files'] = 0;
497
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
498 498
 
499 499
 		return $plupload_init;
500 500
 	}
@@ -509,22 +509,22 @@  discard block
 block discarded – undo
509 509
 		$form = $this->form;
510 510
 
511 511
 	    /** @var GF_Field $field */
512
-		foreach( $form['fields'] as $k => &$field ) {
512
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
513 513
 
514 514
 			/**
515 515
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
516 516
 			 * @since 1.16.3
517 517
 			 * @var GF_Field $field
518 518
 			 */
519
-			if( $field->has_calculation() ) {
520
-				unset( $form['fields'][ $k ] );
519
+			if ( $field->has_calculation() ) {
520
+				unset( $form[ 'fields' ][ $k ] );
521 521
 			}
522 522
 
523 523
 			$field->adminOnly = false;
524 524
 
525
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
526
-				foreach( $field->inputs as $key => $input ) {
527
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
525
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
526
+				foreach ( $field->inputs as $key => $input ) {
527
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
528 528
 				}
529 529
 			}
530 530
 		}
@@ -538,30 +538,30 @@  discard block
 block discarded – undo
538 538
 		$update = false;
539 539
 
540 540
 		// get the most up to date entry values
541
-		$entry = GFAPI::get_entry( $this->entry['id'] );
541
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
542 542
 
543
-		if( !empty( $this->fields_with_calculation ) ) {
543
+		if ( ! empty( $this->fields_with_calculation ) ) {
544 544
 			$update = true;
545 545
 			foreach ( $this->fields_with_calculation as $calc_field ) {
546 546
 				$inputs = $calc_field->get_entry_inputs();
547 547
 				if ( is_array( $inputs ) ) {
548 548
 				    foreach ( $inputs as $input ) {
549
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
550
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
549
+				        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
550
+				        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
551 551
 				    }
552 552
 				} else {
553
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
554
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
553
+				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
554
+				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
555 555
 				}
556 556
 			}
557 557
 
558 558
 		}
559 559
 
560
-		if( $update ) {
560
+		if ( $update ) {
561 561
 
562 562
 			$return_entry = GFAPI::update_entry( $entry );
563 563
 
564
-			if( is_wp_error( $return_entry ) ) {
564
+			if ( is_wp_error( $return_entry ) ) {
565 565
 				gravityview()->log->error( 'Updating the entry calculation fields failed', array( 'data' => $return_entry ) );
566 566
 			} else {
567 567
 				gravityview()->log->debug( 'Updating the entry calculation fields succeeded' );
@@ -592,19 +592,19 @@  discard block
 block discarded – undo
592 592
 
593 593
 		$input_name = 'input_' . $field_id;
594 594
 
595
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
595
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
596 596
 
597 597
 			// We have a new image
598 598
 
599
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
599
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
600 600
 
601 601
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
602 602
 	        $ary = stripslashes_deep( $ary );
603 603
 			$img_url = \GV\Utils::get( $ary, 0 );
604 604
 
605
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
606
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
607
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
605
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
606
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
607
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
608 608
 
609 609
 			$image_meta = array(
610 610
 				'post_excerpt' => $img_caption,
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 
614 614
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
615 615
 			if ( ! empty( $img_title ) ) {
616
-				$image_meta['post_title'] = $img_title;
616
+				$image_meta[ 'post_title' ] = $img_title;
617 617
 			}
618 618
 
619 619
 			/**
@@ -671,15 +671,15 @@  discard block
 block discarded – undo
671 671
 	 */
672 672
 	private function maybe_update_post_fields( $form ) {
673 673
 
674
-		if( empty( $this->entry['post_id'] ) ) {
674
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
675 675
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
676 676
 			return;
677 677
 		}
678 678
 
679
-		$post_id = $this->entry['post_id'];
679
+		$post_id = $this->entry[ 'post_id' ];
680 680
 
681 681
 		// Security check
682
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
682
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
683 683
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
684 684
 			return;
685 685
 		}
@@ -692,25 +692,25 @@  discard block
 block discarded – undo
692 692
 
693 693
 			$field = RGFormsModel::get_field( $form, $field_id );
694 694
 
695
-			if( ! $field ) {
695
+			if ( ! $field ) {
696 696
 				continue;
697 697
 			}
698 698
 
699
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
699
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
700 700
 
701 701
 				// Get the value of the field, including $_POSTed value
702 702
 				$value = RGFormsModel::get_field_value( $field );
703 703
 
704 704
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
705 705
 				$entry_tmp = $this->entry;
706
-				$entry_tmp["{$field_id}"] = $value;
706
+				$entry_tmp[ "{$field_id}" ] = $value;
707 707
 
708
-				switch( $field->type ) {
708
+				switch ( $field->type ) {
709 709
 
710 710
 				    case 'post_title':
711 711
 				        $post_title = $value;
712 712
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
713
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
713
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
714 714
 				        }
715 715
 				        $updated_post->post_title = $post_title;
716 716
 				        $updated_post->post_name  = $post_title;
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 				    case 'post_content':
721 721
 				        $post_content = $value;
722 722
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
723
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
723
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
724 724
 				        }
725 725
 				        $updated_post->post_content = $post_content;
726 726
 				        unset( $post_content );
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 							$value = $value[ $field_id ];
739 739
 						}
740 740
 
741
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
741
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
742 742
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
743 743
 				        }
744 744
 
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 				}
757 757
 
758 758
 				// update entry after
759
-				$this->entry["{$field_id}"] = $value;
759
+				$this->entry[ "{$field_id}" ] = $value;
760 760
 
761 761
 				$update_entry = true;
762 762
 
@@ -765,11 +765,11 @@  discard block
 block discarded – undo
765 765
 
766 766
 		}
767 767
 
768
-		if( $update_entry ) {
768
+		if ( $update_entry ) {
769 769
 
770 770
 			$return_entry = GFAPI::update_entry( $this->entry );
771 771
 
772
-			if( is_wp_error( $return_entry ) ) {
772
+			if ( is_wp_error( $return_entry ) ) {
773 773
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
774 774
 			} else {
775 775
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 
780 780
 		$return_post = wp_update_post( $updated_post, true );
781 781
 
782
-		if( is_wp_error( $return_post ) ) {
782
+		if ( is_wp_error( $return_post ) ) {
783 783
 			$return_post->add_data( $updated_post, '$updated_post' );
784 784
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
785 785
 		} else {
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 		$input_type = RGFormsModel::get_input_type( $field );
802 802
 
803 803
 	    // Only certain custom field types are supported
804
-	    switch( $input_type ) {
804
+	    switch ( $input_type ) {
805 805
 		    case 'fileupload':
806 806
 		    case 'list':
807 807
 		    case 'multiselect':
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
839 839
 
840 840
 		// replace conditional shortcodes
841
-		if( $do_shortcode ) {
841
+		if ( $do_shortcode ) {
842 842
 			$output = do_shortcode( $output );
843 843
 		}
844 844
 
@@ -857,19 +857,19 @@  discard block
 block discarded – undo
857 857
 	 */
858 858
 	private function after_update() {
859 859
 
860
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
861
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
860
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
861
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
862 862
 
863 863
 		// Re-define the entry now that we've updated it.
864
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
864
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
865 865
 
866 866
 		$entry = GFFormsModel::set_entry_meta( $entry, $this->form );
867 867
 
868 868
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
869 869
 			// We need to clear the cache because Gravity Forms caches the field values, which
870 870
 			// we have just updated.
871
-			foreach ($this->form['fields'] as $key => $field) {
872
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
871
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
872
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
873 873
 			}
874 874
 		}
875 875
 
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 
889 889
 		<div class="gv-edit-entry-wrapper"><?php
890 890
 
891
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
891
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
892 892
 
893 893
 			/**
894 894
 			 * Fixes weird wpautop() issue
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
905 905
 				     * @param GravityView_Edit_Entry_Render $this This object
906 906
 				     */
907
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
907
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
908 908
 
909 909
 				    echo esc_attr( $edit_entry_title );
910 910
 			?></span>
@@ -954,16 +954,16 @@  discard block
 block discarded – undo
954 954
 
955 955
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
956 956
 
957
-			if( ! $this->is_valid ){
957
+			if ( ! $this->is_valid ) {
958 958
 
959 959
 				// Keeping this compatible with Gravity Forms.
960
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
961
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
960
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
961
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
962 962
 
963
-				echo GVCommon::generate_notice( $message , 'gv-error' );
963
+				echo GVCommon::generate_notice( $message, 'gv-error' );
964 964
 
965 965
 			} else {
966
-				$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
966
+				$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
967 967
 
968 968
 				/**
969 969
 				 * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
 				 * @param array $entry Gravity Forms entry array
974 974
 				 * @param string $back_link URL to return to the original entry. @since 1.6
975 975
 				 */
976
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
976
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
977 977
 
978 978
 				echo GVCommon::generate_notice( $message );
979 979
 			}
@@ -997,21 +997,21 @@  discard block
 block discarded – undo
997 997
 		 */
998 998
 		do_action( 'gravityview/edit-entry/render/before', $this );
999 999
 
1000
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1001
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1000
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1001
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1002 1002
 		add_filter( 'gform_disable_view_counter', '__return_true' );
1003 1003
 
1004 1004
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
1005 1005
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1006 1006
 
1007 1007
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1008
-		unset( $_GET['page'] );
1008
+		unset( $_GET[ 'page' ] );
1009 1009
 
1010 1010
 		// TODO: Verify multiple-page forms
1011 1011
 
1012 1012
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1013 1013
 
1014
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1014
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1015 1015
 
1016 1016
 		ob_get_clean();
1017 1017
 
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 	 * @return string
1038 1038
 	 */
1039 1039
 	public function render_form_buttons() {
1040
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1040
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1041 1041
 	}
1042 1042
 
1043 1043
 
@@ -1057,10 +1057,10 @@  discard block
 block discarded – undo
1057 1057
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1058 1058
 
1059 1059
 		// In case we have validated the form, use it to inject the validation results into the form render
1060
-		if( isset( $this->form_after_validation ) ) {
1060
+		if ( isset( $this->form_after_validation ) ) {
1061 1061
 			$form = $this->form_after_validation;
1062 1062
 		} else {
1063
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1063
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1064 1064
 		}
1065 1065
 
1066 1066
 		$form = $this->filter_conditional_logic( $form );
@@ -1068,8 +1068,8 @@  discard block
 block discarded – undo
1068 1068
 		$form = $this->prefill_conditional_logic( $form );
1069 1069
 
1070 1070
 		// for now we don't support Save and Continue feature.
1071
-		if( ! self::$supports_save_and_continue ) {
1072
-	        unset( $form['save'] );
1071
+		if ( ! self::$supports_save_and_continue ) {
1072
+	        unset( $form[ 'save' ] );
1073 1073
 		}
1074 1074
 
1075 1075
 		return $form;
@@ -1090,29 +1090,29 @@  discard block
 block discarded – undo
1090 1090
 	 */
1091 1091
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1092 1092
 
1093
-		if( GFCommon::is_post_field( $field ) ) {
1093
+		if ( GFCommon::is_post_field( $field ) ) {
1094 1094
 
1095 1095
 			$message = null;
1096 1096
 
1097 1097
 			// First, make sure they have the capability to edit the post.
1098
-			if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1098
+			if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1099 1099
 
1100 1100
 				/**
1101 1101
 				 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1102 1102
 				 * @param string $message The existing "You don't have permission..." text
1103 1103
 				 */
1104
-				$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1104
+				$message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1105 1105
 
1106
-			} elseif( null === get_post( $this->entry['post_id'] ) ) {
1106
+			} elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1107 1107
 				/**
1108 1108
 				 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1109 1109
 				 * @param string $message The existing "This field is not editable; the post no longer exists." text
1110 1110
 				 */
1111
-				$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1111
+				$message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1112 1112
 			}
1113 1113
 
1114
-			if( $message ) {
1115
-				$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1114
+			if ( $message ) {
1115
+				$field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1116 1116
 			}
1117 1117
 		}
1118 1118
 
@@ -1137,8 +1137,8 @@  discard block
 block discarded – undo
1137 1137
 
1138 1138
 		// If the form has been submitted, then we don't need to pre-fill the values,
1139 1139
 		// Except for fileupload type and when a field input is overridden- run always!!
1140
-		if(
1141
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1140
+		if (
1141
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1142 1142
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1143 1143
 			&& ! GFCommon::is_product_field( $field->type )
1144 1144
 			|| ! empty( $field_content )
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 	    $return = null;
1159 1159
 
1160 1160
 		/** @var GravityView_Field $gv_field */
1161
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1161
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1162 1162
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1163 1163
 		} else {
1164 1164
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 	    // If there was output, it's an error
1168 1168
 	    $warnings = ob_get_clean();
1169 1169
 
1170
-	    if( !empty( $warnings ) ) {
1170
+	    if ( ! empty( $warnings ) ) {
1171 1171
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1172 1172
 	    }
1173 1173
 
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1193 1193
 
1194 1194
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1195
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1195
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1196 1196
 
1197 1197
 			$field_value = array();
1198 1198
 
@@ -1201,10 +1201,10 @@  discard block
 block discarded – undo
1201 1201
 
1202 1202
 			foreach ( (array)$field->inputs as $input ) {
1203 1203
 
1204
-				$input_id = strval( $input['id'] );
1204
+				$input_id = strval( $input[ 'id' ] );
1205 1205
 				
1206 1206
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1207
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1207
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1208 1208
 				    $allow_pre_populated = false;
1209 1209
 				}
1210 1210
 
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
 			$pre_value = $field->get_value_submission( array(), false );
1214 1214
 
1215
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1215
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1216 1216
 
1217 1217
 		} else {
1218 1218
 
@@ -1223,13 +1223,13 @@  discard block
 block discarded – undo
1223 1223
 
1224 1224
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1225 1225
 			// or pre-populated value if not empty and set to override saved value
1226
-			$field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1226
+			$field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1227 1227
 
1228 1228
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1229
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1229
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1230 1230
 				$categories = array();
1231 1231
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1232
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1232
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1233 1233
 				}
1234 1234
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1235 1235
 			}
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 	     * @param GF_Field $field Gravity Forms field object
1258 1258
 	     * @param GravityView_Edit_Entry_Render $this Current object
1259 1259
 	     */
1260
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1260
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1261 1261
 
1262 1262
 		return $field_value;
1263 1263
 	}
@@ -1274,12 +1274,12 @@  discard block
 block discarded – undo
1274 1274
 	 */
1275 1275
 	public function gform_pre_validation( $form ) {
1276 1276
 
1277
-		if( ! $this->verify_nonce() ) {
1277
+		if ( ! $this->verify_nonce() ) {
1278 1278
 			return $form;
1279 1279
 		}
1280 1280
 
1281 1281
 		// Fix PHP warning regarding undefined index.
1282
-		foreach ( $form['fields'] as &$field) {
1282
+		foreach ( $form[ 'fields' ] as &$field ) {
1283 1283
 
1284 1284
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1285 1285
 			// expects certain field array items to be set.
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1288 1288
 			}
1289 1289
 
1290
-			switch( RGFormsModel::get_input_type( $field ) ) {
1290
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1291 1291
 
1292 1292
 				/**
1293 1293
 				 * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend.
@@ -1301,26 +1301,26 @@  discard block
 block discarded – undo
1301 1301
 				    // Set the previous value
1302 1302
 				    $entry = $this->get_entry();
1303 1303
 
1304
-				    $input_name = 'input_'.$field->id;
1305
-				    $form_id = $form['id'];
1304
+				    $input_name = 'input_' . $field->id;
1305
+				    $form_id = $form[ 'id' ];
1306 1306
 
1307 1307
 				    $value = NULL;
1308 1308
 
1309 1309
 				    // Use the previous entry value as the default.
1310
-				    if( isset( $entry[ $field->id ] ) ) {
1310
+				    if ( isset( $entry[ $field->id ] ) ) {
1311 1311
 				        $value = $entry[ $field->id ];
1312 1312
 				    }
1313 1313
 
1314 1314
 				    // If this is a single upload file
1315
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1316
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1317
-				        $value = $file_path['url'];
1315
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1316
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1317
+				        $value = $file_path[ 'url' ];
1318 1318
 
1319 1319
 				    } else {
1320 1320
 
1321 1321
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1322 1322
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1323
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1323
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1324 1324
 
1325 1325
 				    }
1326 1326
 
@@ -1328,10 +1328,10 @@  discard block
 block discarded – undo
1328 1328
 
1329 1329
 				        // If there are fresh uploads, process and merge them.
1330 1330
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1331
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1331
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1332 1332
 				            $value = empty( $value ) ? '[]' : $value;
1333 1333
 				            $value = stripslashes_deep( $value );
1334
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1334
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1335 1335
 				        }
1336 1336
 
1337 1337
 				    } else {
@@ -1349,8 +1349,8 @@  discard block
 block discarded – undo
1349 1349
 
1350 1350
 				case 'number':
1351 1351
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1352
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1353
-				        $_POST['input_'.$field->id ] = NULL;
1352
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1353
+				        $_POST[ 'input_' . $field->id ] = NULL;
1354 1354
 				    }
1355 1355
 				    break;
1356 1356
 			}
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 		 * You can enter whatever you want!
1388 1388
 		 * We try validating, and customize the results using `self::custom_validation()`
1389 1389
 		 */
1390
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1390
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1391 1391
 
1392 1392
 		// Needed by the validate funtion
1393 1393
 		$failed_validation_page = NULL;
@@ -1395,14 +1395,14 @@  discard block
 block discarded – undo
1395 1395
 
1396 1396
 		// Prevent entry limit from running when editing an entry, also
1397 1397
 		// prevent form scheduling from preventing editing
1398
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1398
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1399 1399
 
1400 1400
 		// Hide fields depending on Edit Entry settings
1401
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1401
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1402 1402
 
1403 1403
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1404 1404
 
1405
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1405
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1406 1406
 	}
1407 1407
 
1408 1408
 
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
 
1426 1426
 		$gv_valid = true;
1427 1427
 
1428
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1428
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1429 1429
 
1430 1430
 			$value = RGFormsModel::get_field_value( $field );
1431 1431
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1438,35 +1438,35 @@  discard block
 block discarded – undo
1438 1438
 				case 'post_image':
1439 1439
 
1440 1440
 				    // in case nothing is uploaded but there are already files saved
1441
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1441
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1442 1442
 				        $field->failed_validation = false;
1443 1443
 				        unset( $field->validation_message );
1444 1444
 				    }
1445 1445
 
1446 1446
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1447
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1447
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1448 1448
 
1449 1449
 				        $input_name = 'input_' . $field->id;
1450 1450
 				        //uploaded
1451
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1451
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1452 1452
 
1453 1453
 				        //existent
1454 1454
 				        $entry = $this->get_entry();
1455 1455
 				        $value = NULL;
1456
-				        if( isset( $entry[ $field->id ] ) ) {
1456
+				        if ( isset( $entry[ $field->id ] ) ) {
1457 1457
 				            $value = json_decode( $entry[ $field->id ], true );
1458 1458
 				        }
1459 1459
 
1460 1460
 				        // count uploaded files and existent entry files
1461 1461
 				        $count_files = count( $file_names ) + count( $value );
1462 1462
 
1463
-				        if( $count_files > $field->maxFiles ) {
1463
+				        if ( $count_files > $field->maxFiles ) {
1464 1464
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1465 1465
 				            $field->failed_validation = 1;
1466 1466
 				            $gv_valid = false;
1467 1467
 
1468 1468
 				            // in case of error make sure the newest upload files are removed from the upload input
1469
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1469
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1470 1470
 				        }
1471 1471
 
1472 1472
 				    }
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 			}
1478 1478
 
1479 1479
 			// This field has failed validation.
1480
-			if( !empty( $field->failed_validation ) ) {
1480
+			if ( ! empty( $field->failed_validation ) ) {
1481 1481
 
1482 1482
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1483 1483
 
@@ -1495,19 +1495,19 @@  discard block
 block discarded – undo
1495 1495
 				}
1496 1496
 
1497 1497
 				// You can't continue inside a switch, so we do it after.
1498
-				if( empty( $field->failed_validation ) ) {
1498
+				if ( empty( $field->failed_validation ) ) {
1499 1499
 				    continue;
1500 1500
 				}
1501 1501
 
1502 1502
 				// checks if the No Duplicates option is not validating entry against itself, since
1503 1503
 				// we're editing a stored entry, it would also assume it's a duplicate.
1504
-				if( !empty( $field->noDuplicates ) ) {
1504
+				if ( ! empty( $field->noDuplicates ) ) {
1505 1505
 
1506 1506
 				    $entry = $this->get_entry();
1507 1507
 
1508 1508
 				    // If the value of the entry is the same as the stored value
1509 1509
 				    // Then we can assume it's not a duplicate, it's the same.
1510
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1510
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1511 1511
 				        //if value submitted was not changed, then don't validate
1512 1512
 				        $field->failed_validation = false;
1513 1513
 
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 				}
1521 1521
 
1522 1522
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1523
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1523
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1524 1524
 				    unset( $field->validation_message );
1525 1525
 	                $field->validation_message = false;
1526 1526
 				    continue;
@@ -1532,12 +1532,12 @@  discard block
 block discarded – undo
1532 1532
 
1533 1533
 		}
1534 1534
 
1535
-		$validation_results['is_valid'] = $gv_valid;
1535
+		$validation_results[ 'is_valid' ] = $gv_valid;
1536 1536
 
1537 1537
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1538 1538
 
1539 1539
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1540
-		$this->form_after_validation = $validation_results['form'];
1540
+		$this->form_after_validation = $validation_results[ 'form' ];
1541 1541
 
1542 1542
 		return $validation_results;
1543 1543
 	}
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 	 */
1551 1551
 	public function get_entry() {
1552 1552
 
1553
-		if( empty( $this->entry ) ) {
1553
+		if ( empty( $this->entry ) ) {
1554 1554
 			// Get the database value of the entry that's being edited
1555 1555
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1556 1556
 		}
@@ -1582,10 +1582,10 @@  discard block
 block discarded – undo
1582 1582
 		}
1583 1583
 
1584 1584
 		// If edit tab not yet configured, show all fields
1585
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1585
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1586 1586
 
1587 1587
 		// Hide fields depending on admin settings
1588
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1588
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1589 1589
 
1590 1590
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1591 1591
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
 	 */
1618 1618
 	private function filter_fields( $fields, $configured_fields ) {
1619 1619
 
1620
-		if( empty( $fields ) || !is_array( $fields ) ) {
1620
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1621 1621
 			return $fields;
1622 1622
 		}
1623 1623
 
@@ -1630,18 +1630,18 @@  discard block
 block discarded – undo
1630 1630
 
1631 1631
 			// Remove the fields that have calculation properties and keep them to be used later
1632 1632
 			// @since 1.16.2
1633
-			if( $field->has_calculation() ) {
1634
-				$this->fields_with_calculation[] = $field;
1633
+			if ( $field->has_calculation() ) {
1634
+				$this->fields_with_calculation[ ] = $field;
1635 1635
 				// don't remove the calculation fields on form render.
1636 1636
 			}
1637 1637
 
1638
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1638
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1639 1639
 				unset( $fields[ $key ] );
1640 1640
 			}
1641 1641
 		}
1642 1642
 
1643 1643
 		// The Edit tab has not been configured, so we return all fields by default.
1644
-		if( empty( $configured_fields ) ) {
1644
+		if ( empty( $configured_fields ) ) {
1645 1645
 			return $fields;
1646 1646
 		}
1647 1647
 
@@ -1650,8 +1650,8 @@  discard block
 block discarded – undo
1650 1650
 
1651 1651
 	        /** @var GF_Field $field */
1652 1652
 	        foreach ( $fields as $field ) {
1653
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1654
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1653
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1654
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1655 1655
 				    break;
1656 1656
 				}
1657 1657
 
@@ -1674,14 +1674,14 @@  discard block
 block discarded – undo
1674 1674
 
1675 1675
 		$return_field = $field;
1676 1676
 
1677
-		if( empty( $field_setting['show_label'] ) ) {
1677
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1678 1678
 			$return_field->label = '';
1679
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1680
-			$return_field->label = $field_setting['custom_label'];
1679
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1680
+			$return_field->label = $field_setting[ 'custom_label' ];
1681 1681
 		}
1682 1682
 
1683
-		if( !empty( $field_setting['custom_class'] ) ) {
1684
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1683
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1684
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1685 1685
 		}
1686 1686
 
1687 1687
 		/**
@@ -1719,16 +1719,16 @@  discard block
 block discarded – undo
1719 1719
 	     */
1720 1720
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1721 1721
 
1722
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1723
-			foreach( $fields as $k => $field ) {
1724
-				if( $field->adminOnly ) {
1722
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1723
+			foreach ( $fields as $k => $field ) {
1724
+				if ( $field->adminOnly ) {
1725 1725
 				    unset( $fields[ $k ] );
1726 1726
 				}
1727 1727
 			}
1728 1728
 			return $fields;
1729 1729
 		}
1730 1730
 
1731
-	    foreach( $fields as &$field ) {
1731
+	    foreach ( $fields as &$field ) {
1732 1732
 		    $field->adminOnly = false;
1733 1733
 		}
1734 1734
 
@@ -1752,22 +1752,22 @@  discard block
 block discarded – undo
1752 1752
 	 */
1753 1753
 	function prefill_conditional_logic( $form ) {
1754 1754
 
1755
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1755
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1756 1756
 			return $form;
1757 1757
 		}
1758 1758
 
1759 1759
 		// Have Conditional Logic pre-fill fields as if the data were default values
1760 1760
 		/** @var GF_Field $field */
1761
-		foreach ( $form['fields'] as &$field ) {
1761
+		foreach ( $form[ 'fields' ] as &$field ) {
1762 1762
 
1763
-			if( 'checkbox' === $field->type ) {
1763
+			if ( 'checkbox' === $field->type ) {
1764 1764
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1765
-				    $input_id = $input['id'];
1765
+				    $input_id = $input[ 'id' ];
1766 1766
 				    $choice = $field->choices[ $key ];
1767 1767
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1768 1768
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1769
-				    if( $match ) {
1770
-				        $field->choices[ $key ]['isSelected'] = true;
1769
+				    if ( $match ) {
1770
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1771 1771
 				    }
1772 1772
 				}
1773 1773
 			} else {
@@ -1775,15 +1775,15 @@  discard block
 block discarded – undo
1775 1775
 				// We need to run through each field to set the default values
1776 1776
 				foreach ( $this->entry as $field_id => $field_value ) {
1777 1777
 
1778
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1778
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1779 1779
 
1780
-				        if( 'list' === $field->type ) {
1780
+				        if ( 'list' === $field->type ) {
1781 1781
 				            $list_rows = maybe_unserialize( $field_value );
1782 1782
 
1783 1783
 				            $list_field_value = array();
1784
-				            foreach ( (array) $list_rows as $row ) {
1785
-				                foreach ( (array) $row as $column ) {
1786
-				                    $list_field_value[] = $column;
1784
+				            foreach ( (array)$list_rows as $row ) {
1785
+				                foreach ( (array)$row as $column ) {
1786
+				                    $list_field_value[ ] = $column;
1787 1787
 				                }
1788 1788
 				            }
1789 1789
 
@@ -1818,16 +1818,16 @@  discard block
 block discarded – undo
1818 1818
 		 */
1819 1819
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1820 1820
 
1821
-		if( $use_conditional_logic ) {
1821
+		if ( $use_conditional_logic ) {
1822 1822
 			return $form;
1823 1823
 		}
1824 1824
 
1825
-		foreach( $form['fields'] as &$field ) {
1825
+		foreach ( $form[ 'fields' ] as &$field ) {
1826 1826
 			/* @var GF_Field $field */
1827 1827
 			$field->conditionalLogic = null;
1828 1828
 		}
1829 1829
 
1830
-		unset( $form['button']['conditionalLogic'] );
1830
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1831 1831
 
1832 1832
 		return $form;
1833 1833
 
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 	 */
1845 1845
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1846 1846
 
1847
-		if( ! $this->is_edit_entry() ) {
1847
+		if ( ! $this->is_edit_entry() ) {
1848 1848
 			return $has_conditional_logic;
1849 1849
 		}
1850 1850
 
@@ -1876,44 +1876,44 @@  discard block
 block discarded – undo
1876 1876
 		 *  2. There are two entries embedded using oEmbed
1877 1877
 		 *  3. One of the entries has just been saved
1878 1878
 		 */
1879
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1879
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1880 1880
 
1881 1881
 			$error = true;
1882 1882
 
1883 1883
 		}
1884 1884
 
1885
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1885
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1886 1886
 
1887 1887
 			$error = true;
1888 1888
 
1889
-		} elseif( ! $this->verify_nonce() ) {
1889
+		} elseif ( ! $this->verify_nonce() ) {
1890 1890
 
1891 1891
 			/**
1892 1892
 			 * If the Entry is embedded, there may be two entries on the same page.
1893 1893
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1894 1894
 			 */
1895
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1895
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1896 1896
 				$error = true;
1897 1897
 			} else {
1898
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1898
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1899 1899
 			}
1900 1900
 
1901 1901
 		}
1902 1902
 
1903
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1904
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1903
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1904
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1905 1905
 		}
1906 1906
 
1907
-		if( $this->entry['status'] === 'trash' ) {
1908
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1907
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1908
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1909 1909
 		}
1910 1910
 
1911 1911
 		// No errors; everything's fine here!
1912
-		if( empty( $error ) ) {
1912
+		if ( empty( $error ) ) {
1913 1913
 			return true;
1914 1914
 		}
1915 1915
 
1916
-		if( $echo && $error !== true ) {
1916
+		if ( $echo && $error !== true ) {
1917 1917
 
1918 1918
 	        $error = esc_html( $error );
1919 1919
 
@@ -1921,10 +1921,10 @@  discard block
 block discarded – undo
1921 1921
 	         * @since 1.9
1922 1922
 	         */
1923 1923
 	        if ( ! empty( $this->entry ) ) {
1924
-		        $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1924
+		        $error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1925 1925
 	        }
1926 1926
 
1927
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1927
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1928 1928
 		}
1929 1929
 
1930 1930
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1944,17 +1944,17 @@  discard block
 block discarded – undo
1944 1944
 
1945 1945
 		$error = NULL;
1946 1946
 
1947
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
1948
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
1947
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
1948
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
1949 1949
 		}
1950 1950
 
1951 1951
 		// No errors; everything's fine here!
1952
-		if( empty( $error ) ) {
1952
+		if ( empty( $error ) ) {
1953 1953
 			return true;
1954 1954
 		}
1955 1955
 
1956
-		if( $echo ) {
1957
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1956
+		if ( $echo ) {
1957
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1958 1958
 		}
1959 1959
 
1960 1960
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1975,14 +1975,14 @@  discard block
 block discarded – undo
1975 1975
 	private function check_user_cap_edit_field( $field ) {
1976 1976
 
1977 1977
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
1978
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1978
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1979 1979
 			return true;
1980 1980
 		}
1981 1981
 
1982
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
1982
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
1983 1983
 
1984
-		if( $field_cap ) {
1985
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
1984
+		if ( $field_cap ) {
1985
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
1986 1986
 		}
1987 1987
 
1988 1988
 		return false;
@@ -1996,17 +1996,17 @@  discard block
 block discarded – undo
1996 1996
 	public function verify_nonce() {
1997 1997
 
1998 1998
 		// Verify form submitted for editing single
1999
-		if( $this->is_edit_entry_submission() ) {
1999
+		if ( $this->is_edit_entry_submission() ) {
2000 2000
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2001 2001
 		}
2002 2002
 
2003 2003
 		// Verify
2004
-		else if( ! $this->is_edit_entry() ) {
2004
+		else if ( ! $this->is_edit_entry() ) {
2005 2005
 			$valid = false;
2006 2006
 		}
2007 2007
 
2008 2008
 		else {
2009
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2009
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2010 2010
 		}
2011 2011
 
2012 2012
 		/**
Please login to merge, or discard this patch.
includes/class-gravityview-entry-approval.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	private function add_hooks() {
40 40
 
41 41
 		// in case entry is edited (on admin or frontend)
42
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
42
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
43 43
 
44 44
 		// when using the User opt-in field, check on entry submission
45 45
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
46 46
 
47 47
 		// process ajax approve entry requests
48
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
48
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
49 49
 
50 50
 	}
51 51
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public static function get_entry_status( $entry, $value_or_label = 'label' ) {
64 64
 
65
-		$entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry, true );
65
+		$entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry, true );
66 66
 
67 67
 		$status = gform_get_meta( $entry_id, self::meta_key );
68 68
 
69 69
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
70 70
 
71
-		if( 'value' === $value_or_label ) {
71
+		if ( 'value' === $value_or_label ) {
72 72
 			return $status;
73 73
 		}
74 74
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		$nonce = \GV\Utils::_POST( 'nonce' );
107 107
 
108 108
 		// Valid status
109
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
109
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
110 110
 
111 111
 			gravityview()->log->error( 'Invalid approval status', array( 'data' => $_POST ) );
112 112
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
139 139
 
140
-			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') );
140
+			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) );
141 141
 
142 142
 		}
143 143
 
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 		}
189 189
 
190 190
 		// Set default
191
-		self::update_approved_meta( $entry['id'], $default_status, $entry['form_id'] );
191
+		self::update_approved_meta( $entry[ 'id' ], $default_status, $entry[ 'form_id' ] );
192 192
 
193 193
 		// Then check for if there is an approval column, and use that value instead
194
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
194
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
195 195
 	}
196 196
 
197 197
 	/**
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
207 207
 
208
-		$approved_column = self::get_approved_column( $form['id'] );
208
+		$approved_column = self::get_approved_column( $form[ 'id' ] );
209 209
 
210 210
 		/**
211 211
 		 * If the form doesn't contain the approve field, don't assume anything.
212 212
 		 */
213
-		if( empty( $approved_column ) ) {
213
+		if ( empty( $approved_column ) ) {
214 214
 			return;
215 215
 		}
216 216
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			$value = GravityView_Entry_Approval_Status::APPROVED;
225 225
 		}
226 226
 
227
-		self::update_approved_meta( $entry_id, $value, $form['id'] );
227
+		self::update_approved_meta( $entry_id, $value, $form[ 'id' ] );
228 228
 	}
229 229
 
230 230
 	/**
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	public static function update_bulk( $entries = array(), $approved, $form_id ) {
244 244
 
245
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
245
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
246 246
 			gravityview()->log->error( 'Entries were empty or malformed.', array( 'data' => $entries ) );
247 247
 			return NULL;
248 248
 		}
249 249
 
250
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
250
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
251 251
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
252 252
 			return NULL;
253 253
 		}
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
 		$approved_column_id = self::get_approved_column( $form_id );
263 263
 
264 264
 		$success = true;
265
-		foreach( $entries as $entry_id ) {
265
+		foreach ( $entries as $entry_id ) {
266 266
 			$update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
267 267
 
268
-			if( ! $update_success ) {
268
+			if ( ! $update_success ) {
269 269
 				$success = false;
270 270
 			}
271 271
 		}
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public static function update_approved( $entry_id = 0, $approved = 2, $form_id = 0, $approvedcolumn = 0 ) {
291 291
 
292
-		if( !class_exists( 'GFAPI' ) ) {
292
+		if ( ! class_exists( 'GFAPI' ) ) {
293 293
 			gravityview()->log->error( 'GFAPI does not exist' );
294 294
 			return false;
295 295
 		}
296 296
 
297
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
297
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
298 298
 			gravityview()->log->error( 'Not a valid approval value.' );
299 299
 			return false;
300 300
 		}
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		// If the form has an Approve/Reject field, update that value
312 312
 		$result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn );
313 313
 
314
-		if( is_wp_error( $result ) ) {
314
+		if ( is_wp_error( $result ) ) {
315 315
 			gravityview()->log->error( 'Entry approval not updated: {error}', array( 'error' => $result->get_error_message() ) );
316 316
 			return false;
317 317
 		}
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
 		// add note to entry if approval field updating worked or there was no approved field
325 325
 		// There's no validation for the meta
326
-		if( true === $result ) {
326
+		if ( true === $result ) {
327 327
 
328 328
 			// Add an entry note
329 329
 			self::add_approval_status_updated_note( $entry_id, $approved );
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 
377 377
 		$note_id = false;
378 378
 
379
-		if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
379
+		if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
380 380
 
381 381
 			$current_user = wp_get_current_user();
382 382
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) {
400 400
 
401
-		if( empty( $approvedcolumn ) ) {
401
+		if ( empty( $approvedcolumn ) ) {
402 402
 			$approvedcolumn = self::get_approved_column( $form_id );
403 403
 		}
404 404
 
@@ -421,12 +421,12 @@  discard block
 block discarded – undo
421 421
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
422 422
 
423 423
 		$new_value = '';
424
-		if( GravityView_Entry_Approval_Status::APPROVED === $status ) {
424
+		if ( GravityView_Entry_Approval_Status::APPROVED === $status ) {
425 425
 			$new_value = self::get_approved_column_input_label( $form_id, $approvedcolumn );
426 426
 		}
427 427
 
428 428
 		//update entry
429
-		$entry["{$approvedcolumn}"] = $new_value;
429
+		$entry[ "{$approvedcolumn}" ] = $new_value;
430 430
 
431 431
 		/**
432 432
 		 * Note: GFAPI::update_entry() doesn't trigger `gform_after_update_entry`, so we trigger updating the meta ourselves
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
 		// If the user has enabled a different value than the label (for some reason), use it.
458 458
 		// This is highly unlikely
459 459
 		if ( is_array( $field->choices ) && ! empty( $field->choices ) ) {
460
-			return isset( $field->choices[0]['value'] ) ? $field->choices[0]['value'] : $field->choices[0]['text'];
460
+			return isset( $field->choices[ 0 ][ 'value' ] ) ? $field->choices[ 0 ][ 'value' ] : $field->choices[ 0 ][ 'text' ];
461 461
 		}
462 462
 
463 463
 		// Otherwise, fall back on the inputs array
464 464
 		if ( is_array( $field->inputs ) && ! empty( $field->inputs ) ) {
465
-			return $field->inputs[0]['label'];
465
+			return $field->inputs[ 0 ][ 'label' ];
466 466
 		}
467 467
 
468 468
 		return null;
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 		 * @since 1.18 Added "unapproved"
516 516
 		 * @param  int $entry_id ID of the Gravity Forms entry
517 517
 		 */
518
-		do_action( 'gravityview/approve_entries/' . $action , $entry_id );
518
+		do_action( 'gravityview/approve_entries/' . $action, $entry_id );
519 519
 	}
520 520
 
521 521
 	/**
@@ -528,11 +528,11 @@  discard block
 block discarded – undo
528 528
 	 */
529 529
 	static public function get_approved_column( $form ) {
530 530
 
531
-		if( empty( $form ) ) {
531
+		if ( empty( $form ) ) {
532 532
 			return null;
533 533
 		}
534 534
 
535
-		if( !is_array( $form ) ) {
535
+		if ( ! is_array( $form ) ) {
536 536
 			$form = GVCommon::get_form( $form );
537 537
 		}
538 538
 
@@ -542,22 +542,22 @@  discard block
 block discarded – undo
542 542
 		 * @var string $key
543 543
 		 * @var GF_Field $field
544 544
 		 */
545
-		foreach( $form['fields'] as $key => $field ) {
545
+		foreach ( $form[ 'fields' ] as $key => $field ) {
546 546
 
547 547
 			$inputs = $field->get_entry_inputs();
548 548
 
549
-			if( !empty( $field->gravityview_approved ) ) {
550
-				if ( ! empty( $inputs ) && !empty( $inputs[0]['id'] ) ) {
551
-					$approved_column_id = $inputs[0]['id'];
549
+			if ( ! empty( $field->gravityview_approved ) ) {
550
+				if ( ! empty( $inputs ) && ! empty( $inputs[ 0 ][ 'id' ] ) ) {
551
+					$approved_column_id = $inputs[ 0 ][ 'id' ];
552 552
 					break;
553 553
 				}
554 554
 			}
555 555
 
556 556
 			// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
557
-			if( 'checkbox' === $field->type && ! empty( $inputs ) ) {
557
+			if ( 'checkbox' === $field->type && ! empty( $inputs ) ) {
558 558
 				foreach ( $inputs as $input ) {
559
-					if ( 'approved' === strtolower( $input['label'] ) ) {
560
-						$approved_column_id = $input['id'];
559
+					if ( 'approved' === strtolower( $input[ 'label' ] ) ) {
560
+						$approved_column_id = $input[ 'id' ];
561 561
 						break;
562 562
 					}
563 563
 				}
Please login to merge, or discard this patch.
includes/class-admin-approve-entries.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -266,7 +266,7 @@
 block discarded – undo
266 266
 	 *
267 267
 	 * @uses  GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request.
268 268
 	 * @access public
269
-	 * @return void|boolean
269
+	 * @return false|null
270 270
 	 */
271 271
 	public function process_bulk_action() {
272 272
 
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 	/**
347 347
 	 * update_approved function.
348 348
 	 *
349
-     * @since 1.18 Moved to GravityView_Entry_Approval::update_approved
349
+	 * @since 1.18 Moved to GravityView_Entry_Approval::update_approved
350 350
 	 * @see GravityView_Entry_Approval::update_approved
351
-     *
351
+	 *
352 352
 	 * @param int $entry_id (default: 0)
353 353
 	 * @param int $approved (default: 0)
354 354
 	 * @param int $form_id (default: 0)
355 355
 	 * @param int $approvedcolumn (default: 0)
356
-     *
356
+	 *
357 357
 	 * @return boolean True: It worked; False: it failed
358 358
 	 */
359 359
 	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
 	/**
364 364
 	 * Calculate the approve field.input id
365 365
 	 *
366
-     * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column
367
-     * @see GravityView_Entry_Approval::get_approved_column
368
-     *
366
+	 * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column
367
+	 * @see GravityView_Entry_Approval::get_approved_column
368
+	 *
369 369
 	 * @param mixed $form GF Form or Form ID
370 370
 	 * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set.
371 371
 	 */
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 			'bulk_actions' => $this->get_bulk_actions( $form_id ),
487 487
 			'bulk_message' => $this->bulk_update_message,
488 488
 			'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'),
489
-            'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
489
+			'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
490 490
 			'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'),
491 491
 			'column_title' => __( 'Show entry in directory view?', 'gravityview'),
492 492
 			'column_link' => esc_url( $this->get_sort_link() ),
@@ -495,26 +495,26 @@  discard block
 block discarded – undo
495 495
 	}
496 496
 
497 497
 	/**
498
-     * Generate a link to sort by approval status
499
-     *
500
-     * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as
501
-     * numeric, but it does group the approved entries together.
502
-     *
503
-     * @since 2.0.14 Remove need for approval field for sorting by approval status
504
-     *
498
+	 * Generate a link to sort by approval status
499
+	 *
500
+	 * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as
501
+	 * numeric, but it does group the approved entries together.
502
+	 *
503
+	 * @since 2.0.14 Remove need for approval field for sorting by approval status
504
+	 *
505 505
 	 * @param int $form_id [NO LONGER USED]
506 506
 	 *
507 507
 	 * @return string Sorting link
508 508
 	 */
509 509
 	private function get_sort_link( $form_id = 0 ) {
510 510
 
511
-	    $args = array(
512
-		    'orderby' => 'is_approved',
513
-            'order' => ( 'desc' === \GV\Utils::_GET( 'order' ) ) ? 'asc' : 'desc',
514
-        );
511
+		$args = array(
512
+			'orderby' => 'is_approved',
513
+			'order' => ( 'desc' === \GV\Utils::_GET( 'order' ) ) ? 'asc' : 'desc',
514
+		);
515 515
 
516 516
 		return add_query_arg( $args );
517
-    }
517
+	}
518 518
 
519 519
 	/**
520 520
 	 * Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" option group
@@ -556,9 +556,9 @@  discard block
 block discarded – undo
556 556
 		// Sanitize the values, just to be sure.
557 557
 		foreach ( $bulk_actions as $key => $group ) {
558 558
 
559
-		    if( empty( $group ) ) {
560
-		        continue;
561
-		    }
559
+			if( empty( $group ) ) {
560
+				continue;
561
+			}
562 562
 
563 563
 			foreach ( $group as $i => $action ) {
564 564
 				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		/** gf_entries page - entries table screen */
45 45
 
46 46
 		// capture bulk actions
47
-		add_action( 'gform_loaded', array( $this, 'process_bulk_action') );
47
+		add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) );
48 48
 
49 49
 		// add hidden field with approve status
50 50
 		add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) );
53 53
 
54 54
 		// adding styles and scripts
55
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
55
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
56 56
 		// bypass Gravity Forms no-conflict mode
57 57
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
58 58
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		 * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them.
82 82
 		 * @param array $form GF Form object of current form
83 83
 		 */
84
-		if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
84
+		if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
85 85
 			return $filter_links;
86 86
 		}
87 87
 
@@ -109,27 +109,27 @@  discard block
 block discarded – undo
109 109
 		$approved_count = $disapproved_count = $unapproved_count = 0;
110 110
 
111 111
 		// Only count if necessary
112
-		if( $include_counts ) {
113
-			$approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
114
-			$disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
115
-			$unapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_unapproved ) ) );
112
+		if ( $include_counts ) {
113
+			$approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
114
+			$disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
115
+			$unapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_unapproved ) ) );
116 116
 		}
117 117
 
118
-		$filter_links[] = array(
118
+		$filter_links[ ] = array(
119 119
 			'id'            => 'gv_approved',
120 120
 			'field_filters' => $field_filters_approved,
121 121
 			'count'         => $approved_count,
122 122
 			'label'         => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ),
123 123
 		);
124 124
 
125
-		$filter_links[] = array(
125
+		$filter_links[ ] = array(
126 126
 			'id'            => 'gv_disapproved',
127 127
 			'field_filters' => $field_filters_disapproved,
128 128
 			'count'         => $disapproved_count,
129 129
 			'label'         => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::DISAPPROVED ),
130 130
 		);
131 131
 
132
-		$filter_links[] = array(
132
+		$filter_links[ ] = array(
133 133
 			'id'            => 'gv_unapproved',
134 134
 			'field_filters' => $field_filters_unapproved,
135 135
 			'count'         => $unapproved_count,
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	function tooltips( $tooltips ) {
150 150
 
151
-		$tooltips['form_gravityview_fields'] = array(
152
-			'title' => __('GravityView Fields', 'gravityview'),
153
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
151
+		$tooltips[ 'form_gravityview_fields' ] = array(
152
+			'title' => __( 'GravityView Fields', 'gravityview' ),
153
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
154 154
 		);
155 155
 
156 156
 		return $tooltips;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
 		$gv_bulk_action = false;
263 263
 
264
-		if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
264
+		if ( version_compare( GFForms::$version, '2.0', '>=' ) ) {
265 265
 			$bulk_action = ( '-1' !== \GV\Utils::_POST( 'action' ) ) ? \GV\Utils::_POST( 'action' ) : \GV\Utils::_POST( 'action2' );
266 266
 		} else {
267 267
 			// GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		}
270 270
 
271 271
 		// Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
272
-		if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
272
+		if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) {
273 273
 			$gv_bulk_action = $bulk_action;
274 274
 		}
275 275
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		
295 295
 		// gforms_entry_list is the nonce that confirms we're on the right page
296 296
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
297
-		if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST['gforms_update_note'] ) ) {
297
+		if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
298 298
 
299 299
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
300 300
 
@@ -312,13 +312,13 @@  discard block
 block discarded – undo
312 312
 			}
313 313
 
314 314
 			// All entries are set to be updated, not just the visible ones
315
-			if ( ! empty( $_POST['all_entries'] ) ) {
315
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
316 316
 
317 317
 				// Convert the current entry search into GF-formatted search criteria
318 318
 				$search = array(
319
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
320
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
321
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
319
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
320
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
321
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
322 322
 				);
323 323
 
324 324
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 			} else {
330 330
 
331 331
 				// Changed from 'lead' to 'entry' in 2.0
332
-				$entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
332
+				$entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ];
333 333
 
334 334
 			}
335 335
 
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
 			$entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
342 342
 
343 343
 			switch ( $approved_status ) {
344
-				case $this->bulk_action_prefixes['approve']:
344
+				case $this->bulk_action_prefixes[ 'approve' ]:
345 345
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id );
346 346
 					$this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
347 347
 					break;
348
-				case $this->bulk_action_prefixes['unapprove']:
348
+				case $this->bulk_action_prefixes[ 'unapprove' ]:
349 349
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id );
350 350
 					$this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count );
351 351
 					break;
352
-				case $this->bulk_action_prefixes['disapprove']:
352
+				case $this->bulk_action_prefixes[ 'disapprove' ]:
353 353
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id );
354 354
 					$this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
355 355
 					break;
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
      *
372 372
 	 * @return boolean True: It worked; False: it failed
373 373
 	 */
374
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
374
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
375 375
 		return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn );
376 376
 	}
377 377
 
@@ -401,20 +401,20 @@  discard block
 block discarded – undo
401 401
 	 *
402 402
 	 * @return void
403 403
 	 */
404
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
404
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
405 405
 
406
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
406
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
407 407
 			return;
408 408
 		}
409 409
 
410
-		if( empty( $entry['id'] ) ) {
410
+		if ( empty( $entry[ 'id' ] ) ) {
411 411
 			return;
412 412
 		}
413 413
 
414 414
 		$status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' );
415 415
 
416
-		if( $status_value ) {
417
-			echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />';
416
+		if ( $status_value ) {
417
+			echo '<input type="hidden" class="entry_approval" id="entry_approved_' . $entry[ 'id' ] . '" value="' . esc_attr( $status_value ) . '" />';
418 418
 		}
419 419
 	}
420 420
 
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	 */
428 428
 	private function get_form_id() {
429 429
 
430
-		$form_id = GFForms::get('id');
430
+		$form_id = GFForms::get( 'id' );
431 431
 
432 432
 		// If there are no forms identified, use the first form. That's how GF does it.
433
-		if( empty( $form_id ) && class_exists('RGFormsModel') ) {
433
+		if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
434 434
 			$form_id = $this->get_first_form_id();
435 435
 		}
436 436
 
@@ -450,14 +450,14 @@  discard block
 block discarded – undo
450 450
 
451 451
 		$forms = RGFormsModel::get_forms( null, 'title' );
452 452
 
453
-		if( ! isset( $forms[0] ) ) {
453
+		if ( ! isset( $forms[ 0 ] ) ) {
454 454
 			gravityview()->log->error( 'No forms were found' );
455 455
 			return 0;
456 456
 		}
457 457
 
458
-		$first_form = $forms[0];
458
+		$first_form = $forms[ 0 ];
459 459
 
460
-		$form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id'];
460
+		$form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ];
461 461
 
462 462
 		return intval( $form_id );
463 463
 	}
@@ -465,33 +465,33 @@  discard block
 block discarded – undo
465 465
 
466 466
 	function add_scripts_and_styles( $hook ) {
467 467
 
468
-		if( ! class_exists( 'GFForms' ) ) {
468
+		if ( ! class_exists( 'GFForms' ) ) {
469 469
 			gravityview()->log->error( 'GFForms does not exist.' );
470 470
 			return;
471 471
 		}
472 472
 
473 473
 		// enqueue styles & scripts gf_entries
474 474
 		// But only if we're on the main Entries page, not on reports pages
475
-		if( GFForms::get_page() !== 'entry_list' ) {
475
+		if ( GFForms::get_page() !== 'entry_list' ) {
476 476
 			return;
477 477
 		}
478 478
 
479 479
 		$form_id = $this->get_form_id();
480 480
 
481 481
 		// Things are broken; no forms were found
482
-		if( empty( $form_id ) ) {
482
+		if ( empty( $form_id ) ) {
483 483
 			return;
484 484
 		}
485 485
 
486
-		wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
486
+		wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
487 487
 
488
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
488
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
489 489
 
490
-		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
490
+		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
491 491
 
492 492
 		wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
493
-			'nonce' => wp_create_nonce( 'gravityview_entry_approval'),
494
-			'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'),
493
+			'nonce' => wp_create_nonce( 'gravityview_entry_approval' ),
494
+			'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval' ),
495 495
 			'form_id' => $form_id,
496 496
 			'show_column' => (int)$this->show_approve_entry_column( $form_id ),
497 497
 			'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
@@ -500,10 +500,10 @@  discard block
 block discarded – undo
500 500
 			'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED,
501 501
 			'bulk_actions' => $this->get_bulk_actions( $form_id ),
502 502
 			'bulk_message' => $this->bulk_update_message,
503
-			'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'),
504
-            'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
505
-			'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'),
506
-			'column_title' => __( 'Show entry in directory view?', 'gravityview'),
503
+			'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'unapproved' ),
504
+            'approve_title' => GravityView_Entry_Approval_Status::get_title_attr( 'disapproved' ),
505
+			'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'approved' ),
506
+			'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
507 507
 			'column_link' => esc_url( $this->get_sort_link() ),
508 508
 		) );
509 509
 
@@ -545,16 +545,16 @@  discard block
 block discarded – undo
545 545
 		$bulk_actions = array(
546 546
 			'GravityView' => array(
547 547
 				array(
548
-					'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'),
549
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
548
+					'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ),
549
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ),
550 550
 				),
551 551
 				array(
552
-					'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'),
553
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ),
552
+					'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ),
553
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'disapprove' ], $form_id ),
554 554
 				),
555 555
 				array(
556
-					'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'),
557
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
556
+					'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ),
557
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ),
558 558
 				),
559 559
 			),
560 560
 		);
@@ -571,13 +571,13 @@  discard block
 block discarded – undo
571 571
 		// Sanitize the values, just to be sure.
572 572
 		foreach ( $bulk_actions as $key => $group ) {
573 573
 
574
-		    if( empty( $group ) ) {
574
+		    if ( empty( $group ) ) {
575 575
 		        continue;
576 576
 		    }
577 577
 
578 578
 			foreach ( $group as $i => $action ) {
579
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
580
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
579
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
580
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
581 581
 			}
582 582
 		}
583 583
 
@@ -602,13 +602,13 @@  discard block
 block discarded – undo
602 602
 		 * @since 1.7.2
603 603
 		 * @param boolean $hide_if_no_connections
604 604
 		 */
605
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
605
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
606 606
 
607
-		if( $hide_if_no_connections ) {
607
+		if ( $hide_if_no_connections ) {
608 608
 
609 609
 			$connected_views = gravityview_get_connected_views( $form_id );
610 610
 
611
-			if( empty( $connected_views ) ) {
611
+			if ( empty( $connected_views ) ) {
612 612
 				$show_approve_column = false;
613 613
 			}
614 614
 		}
@@ -618,18 +618,18 @@  discard block
 block discarded – undo
618 618
 		 * @param boolean $show_approve_column Whether the column will be shown
619 619
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
620 620
 		 */
621
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
621
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
622 622
 
623 623
 		return $show_approve_column;
624 624
 	}
625 625
 
626 626
 	function register_gform_noconflict_script( $scripts ) {
627
-		$scripts[] = 'gravityview_gf_entries_scripts';
627
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
628 628
 		return $scripts;
629 629
 	}
630 630
 
631 631
 	function register_gform_noconflict_style( $styles ) {
632
-		$styles[] = 'gravityview_entries_list';
632
+		$styles[ ] = 'gravityview_entries_list';
633 633
 		return $styles;
634 634
 	}
635 635
 
Please login to merge, or discard this patch.
includes/class-admin.php 1 patch
Indentation   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 * @return void
93 93
 	 */
94 94
 	public static function connected_form_warning( $form_id = 0 ) {
95
-        global $pagenow;
95
+		global $pagenow;
96 96
 
97 97
 		if ( empty( $form_id ) || $pagenow === 'post-new.php' ) {
98 98
 			return;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 			7  => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
239 239
 			8  => __( 'View submitted.', 'gravityview' ),
240 240
 			9  => sprintf(
241
-		        /* translators: Date and time the View is scheduled to be published */
241
+				/* translators: Date and time the View is scheduled to be published */
242 242
 				__( 'View scheduled for: %1$s.', 'gravityview' ),
243 243
 				// translators: Publish box date format, see http://php.net/date
244 244
 				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL )  ) )
@@ -295,7 +295,6 @@  discard block
 block discarded – undo
295 295
 	 *
296 296
 	 * @deprecated since 1.12
297 297
 	 * @see GravityView_Compatibility::get_plugin_status()
298
-
299 298
 	 * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive
300 299
 	 */
301 300
 	static function get_plugin_status( $location = '' ) {
Please login to merge, or discard this patch.
future/includes/class-gv-extension.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -305,13 +305,13 @@
 block discarded – undo
305 305
 			$this->_remote_update_url,
306 306
 			$this->_path,
307 307
 			array(
308
-            	'version'	=> $this->_version, // current version number
309
-            	'license'	=> \GV\Utils::get( $license, 'license_key', $license['license'] ),
310
-	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
311
-            	'item_name' => $this->_title,  // name of this plugin
312
-            	'author' 	=> strip_tags( $this->_author )  // author of this plugin
313
-          	)
314
-        );
308
+				'version'	=> $this->_version, // current version number
309
+				'license'	=> \GV\Utils::get( $license, 'license_key', $license['license'] ),
310
+				'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
311
+				'item_name' => $this->_title,  // name of this plugin
312
+				'author' 	=> strip_tags( $this->_author )  // author of this plugin
313
+		  	)
314
+		);
315 315
 	}
316 316
 
317 317
 	/**
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 		$tab = wp_parse_args( $tab_settings, $tab_defaults );
181 181
 
182 182
 		// Force the screen to be GravityView
183
-		$tab['screen'] = 'gravityview';
183
+		$tab[ 'screen' ] = 'gravityview';
184 184
 
185 185
 		if ( class_exists( 'GravityView_Metabox_Tab' ) ) {
186
-			$metabox = new \GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] );
186
+			$metabox = new \GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] );
187 187
 			\GravityView_Metabox_Tabs::add( $metabox );
188 188
 		} else {
189
-			add_meta_box( 'gravityview_' . $tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] );
189
+			add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] );
190 190
 		}
191 191
 	}
192 192
 
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	protected function is_extension_supported() {
213 213
 
214
-		self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool) self::$is_compatible );
214
+		self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool)self::$is_compatible );
215 215
 
216 216
 		if ( ! function_exists( 'gravityview' ) ) {
217 217
 			$message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), esc_html( $this->_title ) );
218
-		} else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version , ">=" ) ) {
219
-			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_gravityview_version.'</tt>' );
220
-		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=" ) ) {
221
-			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_php_version.'</tt>' );
218
+		} else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version, ">=" ) ) {
219
+			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_gravityview_version . '</tt>' );
220
+		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) {
221
+			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_php_version . '</tt>' );
222 222
 		} else if ( ! empty( $this->_max_gravityview_version ) && false === version_compare( $this->_max_gravityview_version, Plugin::$version, ">" ) ) {
223 223
 			$message = sprintf( __( 'The %s Extension is not compatible with this version of GravityView. Please update the Extension to the latest version.', 'gravityview' ), esc_html( $this->_title ) );
224 224
 		} else {
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 
259 259
 		$locale = get_locale();
260 260
 
261
-		if ( function_exists('get_user_locale') && is_admin() ) {
261
+		if ( function_exists( 'get_user_locale' ) && is_admin() ) {
262 262
 			$locale = get_user_locale();
263 263
 		}
264 264
 
265 265
 		// Traditional WordPress plugin locale filter
266
-		$locale = apply_filters( 'plugin_locale',  $locale, $this->_text_domain );
266
+		$locale = apply_filters( 'plugin_locale', $locale, $this->_text_domain );
267 267
 
268 268
 		$mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale );
269 269
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	public function settings() {
292 292
 
293 293
 		// If doing ajax, get outta here
294
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
294
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) {
295 295
 			return;
296 296
 		}
297 297
 
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
 			$this->_path,
307 307
 			array(
308 308
             	'version'	=> $this->_version, // current version number
309
-            	'license'	=> \GV\Utils::get( $license, 'license_key', $license['license'] ),
309
+            	'license'	=> \GV\Utils::get( $license, 'license_key', $license[ 'license' ] ),
310 310
 	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
311
-            	'item_name' => $this->_title,  // name of this plugin
311
+            	'item_name' => $this->_title, // name of this plugin
312 312
             	'author' 	=> strip_tags( $this->_author )  // author of this plugin
313 313
           	)
314 314
         );
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	public static function add_notice( $notice = array() ) {
339 339
 
340
-		if ( is_array( $notice ) && empty( $notice['message'] ) ) {
340
+		if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) {
341 341
 			gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) );
342 342
 			return;
343 343
 		} else if ( is_string( $notice ) ) {
344 344
 			$notice = array( 'message' => $notice );
345 345
 		}
346 346
 
347
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
347
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
348 348
 
349
-		self::$admin_notices []= $notice;
349
+		self::$admin_notices [ ] = $notice;
350 350
 	}
351 351
 
352 352
 	/**
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 		}
361 361
 
362 362
 		foreach ( self::$admin_notices as $key => $notice ) {
363
-			echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">';
364
-			echo wpautop( $notice['message'] );
363
+			echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">';
364
+			echo wpautop( $notice[ 'message' ] );
365 365
 			echo '<div class="clear"></div>';
366 366
 			echo '</div>';
367 367
 		}
Please login to merge, or discard this patch.