Completed
Pull Request — master (#1147)
by Zack
42:12 queued 38:07
created
plugin-and-theme-hooks/class-gravityview-plugin-hooks-elegant-themes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 		}
80 80
 
81 81
 		$sidebars_widgets = wp_get_sidebars_widgets();
82
-		if ( empty( $sidebars_widgets[ $matches[1] ] ) ) {
82
+		if ( empty( $sidebars_widgets[ $matches[ 1 ] ] ) ) {
83 83
 			return $shortcodes;
84 84
 		}
85 85
 
86
-		foreach ( $sidebars_widgets[ $matches[1] ] as $widgets ) {
86
+		foreach ( $sidebars_widgets[ $matches[ 1 ] ] as $widgets ) {
87 87
 			if (
88 88
 				/**
89 89
 				 * Blacklisted widgets.
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				strpos( $widgets, 'gv_recent_entries' ) === 0
93 93
 			) {
94 94
 
95
-					$shortcodes []= 'et_pb_sidebar';
95
+					$shortcodes [ ] = 'et_pb_sidebar';
96 96
 					break;
97 97
 			}
98 98
 		}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-excerpt.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@
 block discarded – undo
22 22
 
23 23
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
24 24
 
25
-		unset( $field_options['show_as_link'] );
25
+		unset( $field_options[ 'show_as_link' ] );
26 26
 
27
-		if( 'edit' === $context ) {
27
+		if ( 'edit' === $context ) {
28 28
 			return $field_options;
29 29
 		}
30 30
 
31
-		$this->add_field_support('dynamic_data', $field_options );
31
+		$this->add_field_support( 'dynamic_data', $field_options );
32 32
 
33 33
 		return $field_options;
34 34
 	}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 4 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 
943 943
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
944 944
 
945
-			if( ! $this->is_valid ){
945
+			if( ! $this->is_valid ) {
946 946
 
947 947
 				// Keeping this compatible with Gravity Forms.
948 948
 				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
@@ -1996,9 +1996,7 @@  discard block
 block discarded – undo
1996 1996
 		// Verify
1997 1997
 		else if( ! $this->is_edit_entry() ) {
1998 1998
 			$valid = false;
1999
-		}
2000
-
2001
-		else {
1999
+		} else {
2002 2000
 			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2003 2001
 		}
2004 2002
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@
 block discarded – undo
282 282
 	/**
283 283
 	 * Process edit entry form save
284 284
 	 *
285
-	 * @param array $gv_data The View data.
285
+	 * @param GravityView_View_Data $gv_data The View data.
286 286
 	 */
287 287
 	private function process_save( $gv_data ) {
288 288
 
Please login to merge, or discard this patch.
Indentation   +287 added lines, -287 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();
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 
334 334
 			GFFormsModel::save_lead( $form, $this->entry );
335 335
 
336
-	        // Delete the values for hidden inputs
337
-	        $this->unset_hidden_field_values();
336
+			// Delete the values for hidden inputs
337
+			$this->unset_hidden_field_values();
338 338
 			
339 339
 			$this->entry['date_created'] = $date_created;
340 340
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			// Perform actions normally performed after updating a lead
345 345
 			$this->after_update();
346 346
 
347
-	        /**
347
+			/**
348 348
 			 * Must be AFTER after_update()!
349 349
 			 * @see https://github.com/gravityview/GravityView/issues/764
350 350
 			 */
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 			/**
354 354
 			 * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry
355
-             * @since 2.1 Added $gv_data parameter
355
+			 * @since 2.1 Added $gv_data parameter
356 356
 			 * @param array $form Gravity Forms form array
357 357
 			 * @param string $entry_id Numeric ID of the entry that was updated
358 358
 			 * @param GravityView_Edit_Entry_Render $this This object
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 * @return void
377 377
 	 */
378 378
 	private function unset_hidden_field_values() {
379
-	    global $wpdb;
379
+		global $wpdb;
380 380
 
381 381
 		/**
382 382
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -398,27 +398,27 @@  discard block
 block discarded – undo
398 398
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
399 399
 		}
400 400
 
401
-	    foreach ( $this->entry as $input_id => $field_value ) {
401
+		foreach ( $this->entry as $input_id => $field_value ) {
402 402
 
403
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
403
+			$field = RGFormsModel::get_field( $this->form, $input_id );
404 404
 
405
-		    // Reset fields that are hidden
406
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
407
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
405
+			// Reset fields that are hidden
406
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
407
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
408 408
 
409
-		        // List fields are stored as empty arrays when empty
410
-			    $empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
409
+				// List fields are stored as empty arrays when empty
410
+				$empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
411 411
 
412
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
412
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
413 413
 
414
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
414
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
415 415
 
416
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
416
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
417 417
 				// after submission
418
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
419
-			    $_POST[ $post_input_id ] = '';
420
-		    }
421
-	    }
418
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
419
+				$_POST[ $post_input_id ] = '';
420
+			}
421
+		}
422 422
 	}
423 423
 
424 424
 	/**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 		$form = $this->form;
514 514
 
515
-	    /** @var GF_Field $field */
515
+		/** @var GF_Field $field */
516 516
 		foreach( $form['fields'] as $k => &$field ) {
517 517
 
518 518
 			/**
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 
529 529
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530 530
 				foreach( $field->inputs as $key => $input ) {
531
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
531
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
532 532
 				}
533 533
 			}
534 534
 		}
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
 			foreach ( $this->fields_with_calculation as $calc_field ) {
550 550
 				$inputs = $calc_field->get_entry_inputs();
551 551
 				if ( is_array( $inputs ) ) {
552
-				    foreach ( $inputs as $input ) {
553
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
554
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
555
-				    }
552
+					foreach ( $inputs as $input ) {
553
+						$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
554
+						$entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
555
+					}
556 556
 				} else {
557
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
558
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
557
+					$input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
558
+					$entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
559 559
 				}
560 560
 			}
561 561
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
604 604
 
605 605
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
606
-	        $ary = stripslashes_deep( $ary );
606
+			$ary = stripslashes_deep( $ary );
607 607
 			$img_url = \GV\Utils::get( $ary, 0 );
608 608
 
609 609
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 	private function maybe_update_post_fields( $form ) {
677 677
 
678 678
 		if( empty( $this->entry['post_id'] ) ) {
679
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
679
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
680 680
 			return;
681 681
 		}
682 682
 
@@ -711,51 +711,51 @@  discard block
 block discarded – undo
711 711
 
712 712
 				switch( $field->type ) {
713 713
 
714
-				    case 'post_title':
715
-				        $post_title = $value;
716
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
717
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
718
-				        }
719
-				        $updated_post->post_title = $post_title;
720
-				        $updated_post->post_name  = $post_title;
721
-				        unset( $post_title );
722
-				        break;
723
-
724
-				    case 'post_content':
725
-				        $post_content = $value;
726
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
727
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
728
-				        }
729
-				        $updated_post->post_content = $post_content;
730
-				        unset( $post_content );
731
-				        break;
732
-				    case 'post_excerpt':
733
-				        $updated_post->post_excerpt = $value;
734
-				        break;
735
-				    case 'post_tags':
736
-				        wp_set_post_tags( $post_id, $value, false );
737
-				        break;
738
-				    case 'post_category':
739
-				        break;
740
-				    case 'post_custom_field':
714
+					case 'post_title':
715
+						$post_title = $value;
716
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
717
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
718
+						}
719
+						$updated_post->post_title = $post_title;
720
+						$updated_post->post_name  = $post_title;
721
+						unset( $post_title );
722
+						break;
723
+
724
+					case 'post_content':
725
+						$post_content = $value;
726
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
727
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
728
+						}
729
+						$updated_post->post_content = $post_content;
730
+						unset( $post_content );
731
+						break;
732
+					case 'post_excerpt':
733
+						$updated_post->post_excerpt = $value;
734
+						break;
735
+					case 'post_tags':
736
+						wp_set_post_tags( $post_id, $value, false );
737
+						break;
738
+					case 'post_category':
739
+						break;
740
+					case 'post_custom_field':
741 741
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
742 742
 							$value = $value[ $field_id ];
743 743
 						}
744 744
 
745
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
746
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
747
-				        }
745
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
746
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
747
+						}
748 748
 
749
-	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
750
-		                    $value = wp_json_encode( $value );
751
-	                    }
749
+						if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
750
+							$value = wp_json_encode( $value );
751
+						}
752 752
 
753
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
754
-				        break;
753
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
754
+						break;
755 755
 
756
-				    case 'post_image':
757
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
758
-				        break;
756
+					case 'post_image':
757
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
758
+						break;
759 759
 
760 760
 				}
761 761
 
@@ -800,20 +800,20 @@  discard block
 block discarded – undo
800 800
 	 */
801 801
 	private function is_field_json_encoded( $field ) {
802 802
 
803
-	    $json_encoded = false;
803
+		$json_encoded = false;
804 804
 
805 805
 		$input_type = RGFormsModel::get_input_type( $field );
806 806
 
807
-	    // Only certain custom field types are supported
808
-	    switch( $input_type ) {
809
-		    case 'fileupload':
810
-		    case 'list':
811
-		    case 'multiselect':
812
-			    $json_encoded = true;
813
-			    break;
814
-	    }
807
+		// Only certain custom field types are supported
808
+		switch( $input_type ) {
809
+			case 'fileupload':
810
+			case 'list':
811
+			case 'multiselect':
812
+				$json_encoded = true;
813
+				break;
814
+		}
815 815
 
816
-	    return $json_encoded;
816
+		return $json_encoded;
817 817
 	}
818 818
 
819 819
 	/**
@@ -903,14 +903,14 @@  discard block
 block discarded – undo
903 903
 			?><h2 class="gv-edit-entry-title">
904 904
 				<span><?php
905 905
 
906
-				    /**
907
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
908
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
909
-				     * @param GravityView_Edit_Entry_Render $this This object
910
-				     */
911
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
906
+					/**
907
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
908
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
909
+					 * @param GravityView_Edit_Entry_Render $this This object
910
+					 */
911
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
912 912
 
913
-				    echo esc_attr( $edit_entry_title );
913
+					echo esc_attr( $edit_entry_title );
914 914
 			?></span>
915 915
 			</h2>
916 916
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 
1020 1020
 		ob_get_clean();
1021 1021
 
1022
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1022
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1023 1023
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1024 1024
 		remove_filter( 'gform_disable_view_counter', '__return_true' );
1025 1025
 		remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 );
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 
1074 1074
 		// for now we don't support Save and Continue feature.
1075 1075
 		if( ! self::$supports_save_and_continue ) {
1076
-	        unset( $form['save'] );
1076
+			unset( $form['save'] );
1077 1077
 		}
1078 1078
 
1079 1079
 		$form = $this->unselect_default_values( $form );
@@ -1100,30 +1100,30 @@  discard block
 block discarded – undo
1100 1100
 			return $field_content;
1101 1101
 		}
1102 1102
 
1103
-        $message = null;
1103
+		$message = null;
1104 1104
 
1105
-        // First, make sure they have the capability to edit the post.
1106
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1105
+		// First, make sure they have the capability to edit the post.
1106
+		if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1107 1107
 
1108
-            /**
1109
-             * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1110
-             * @param string $message The existing "You don't have permission..." text
1111
-             */
1112
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1108
+			/**
1109
+			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1110
+			 * @param string $message The existing "You don't have permission..." text
1111
+			 */
1112
+			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1113 1113
 
1114
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1115
-            /**
1116
-             * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1117
-             * @param string $message The existing "This field is not editable; the post no longer exists." text
1118
-             */
1119
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1120
-        }
1114
+		} elseif( null === get_post( $this->entry['post_id'] ) ) {
1115
+			/**
1116
+			 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1117
+			 * @param string $message The existing "This field is not editable; the post no longer exists." text
1118
+			 */
1119
+			$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1120
+		}
1121 1121
 
1122
-        if( $message ) {
1123
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1124
-        }
1122
+		if( $message ) {
1123
+			$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1124
+		}
1125 1125
 
1126
-        return $field_content;
1126
+		return $field_content;
1127 1127
 	}
1128 1128
 
1129 1129
 	/**
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
 			|| ! empty( $field_content )
1152 1152
 			|| in_array( $field->type, array( 'honeypot' ) )
1153 1153
 		) {
1154
-	        return $field_content;
1154
+			return $field_content;
1155 1155
 		}
1156 1156
 
1157 1157
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1159,24 +1159,24 @@  discard block
 block discarded – undo
1159 1159
 
1160 1160
 		$field_value = $this->get_field_value( $field );
1161 1161
 
1162
-	    // Prevent any PHP warnings, like undefined index
1163
-	    ob_start();
1162
+		// Prevent any PHP warnings, like undefined index
1163
+		ob_start();
1164 1164
 
1165
-	    $return = null;
1165
+		$return = null;
1166 1166
 
1167 1167
 		/** @var GravityView_Field $gv_field */
1168 1168
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1169 1169
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1170 1170
 		} else {
1171
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1172
-	    }
1171
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1172
+		}
1173 1173
 
1174
-	    // If there was output, it's an error
1175
-	    $warnings = ob_get_clean();
1174
+		// If there was output, it's an error
1175
+		$warnings = ob_get_clean();
1176 1176
 
1177
-	    if( !empty( $warnings ) ) {
1178
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1179
-	    }
1177
+		if( !empty( $warnings ) ) {
1178
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1179
+		}
1180 1180
 
1181 1181
 		return $return;
1182 1182
 	}
@@ -1211,8 +1211,8 @@  discard block
 block discarded – undo
1211 1211
 				$input_id = strval( $input['id'] );
1212 1212
 				
1213 1213
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1214
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1215
-				    $allow_pre_populated = false;
1214
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1215
+					$allow_pre_populated = false;
1216 1216
 				}
1217 1217
 
1218 1218
 			}
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1237 1237
 				$categories = array();
1238 1238
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1239
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1239
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1240 1240
 				}
1241 1241
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1242 1242
 			}
@@ -1246,25 +1246,25 @@  discard block
 block discarded – undo
1246 1246
 		// if value is empty get the default value if defined
1247 1247
 		$field_value = $field->get_value_default_if_empty( $field_value );
1248 1248
 
1249
-	    /**
1250
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1251
-	     * @since 1.11
1252
-	     * @since 1.20 Added third param
1253
-	     * @param mixed $field_value field value used to populate the input
1254
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1255
-	     * @param GravityView_Edit_Entry_Render $this Current object
1256
-	     */
1257
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1258
-
1259
-	    /**
1260
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1261
-	     * @since 1.17
1262
-	     * @since 1.20 Added third param
1263
-	     * @param mixed $field_value field value used to populate the input
1264
-	     * @param GF_Field $field Gravity Forms field object
1265
-	     * @param GravityView_Edit_Entry_Render $this Current object
1266
-	     */
1267
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1249
+		/**
1250
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1251
+		 * @since 1.11
1252
+		 * @since 1.20 Added third param
1253
+		 * @param mixed $field_value field value used to populate the input
1254
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1255
+		 * @param GravityView_Edit_Entry_Render $this Current object
1256
+		 */
1257
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1258
+
1259
+		/**
1260
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1261
+		 * @since 1.17
1262
+		 * @since 1.20 Added third param
1263
+		 * @param mixed $field_value field value used to populate the input
1264
+		 * @param GF_Field $field Gravity Forms field object
1265
+		 * @param GravityView_Edit_Entry_Render $this Current object
1266
+		 */
1267
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1268 1268
 
1269 1269
 		return $field_value;
1270 1270
 	}
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1292 1292
 			// expects certain field array items to be set.
1293 1293
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1294
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1294
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1295 1295
 			}
1296 1296
 
1297 1297
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1305,61 +1305,61 @@  discard block
 block discarded – undo
1305 1305
 				 */
1306 1306
 				case 'fileupload':
1307 1307
 
1308
-				    // Set the previous value
1309
-				    $entry = $this->get_entry();
1308
+					// Set the previous value
1309
+					$entry = $this->get_entry();
1310 1310
 
1311
-				    $input_name = 'input_'.$field->id;
1312
-				    $form_id = $form['id'];
1311
+					$input_name = 'input_'.$field->id;
1312
+					$form_id = $form['id'];
1313 1313
 
1314
-				    $value = NULL;
1314
+					$value = NULL;
1315 1315
 
1316
-				    // Use the previous entry value as the default.
1317
-				    if( isset( $entry[ $field->id ] ) ) {
1318
-				        $value = $entry[ $field->id ];
1319
-				    }
1316
+					// Use the previous entry value as the default.
1317
+					if( isset( $entry[ $field->id ] ) ) {
1318
+						$value = $entry[ $field->id ];
1319
+					}
1320 1320
 
1321
-				    // If this is a single upload file
1322
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1323
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1324
-				        $value = $file_path['url'];
1321
+					// If this is a single upload file
1322
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1323
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1324
+						$value = $file_path['url'];
1325 1325
 
1326
-				    } else {
1326
+					} else {
1327 1327
 
1328
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1329
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1330
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1328
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1329
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1330
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1331 1331
 
1332
-				    }
1332
+					}
1333 1333
 
1334
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1334
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1335 1335
 
1336
-				        // If there are fresh uploads, process and merge them.
1337
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1338
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1339
-				            $value = empty( $value ) ? '[]' : $value;
1340
-				            $value = stripslashes_deep( $value );
1341
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1342
-				        }
1336
+						// If there are fresh uploads, process and merge them.
1337
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1338
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1339
+							$value = empty( $value ) ? '[]' : $value;
1340
+							$value = stripslashes_deep( $value );
1341
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1342
+						}
1343 1343
 
1344
-				    } else {
1344
+					} else {
1345 1345
 
1346
-				        // A file already exists when editing an entry
1347
-				        // We set this to solve issue when file upload fields are required.
1348
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1346
+						// A file already exists when editing an entry
1347
+						// We set this to solve issue when file upload fields are required.
1348
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1349 1349
 
1350
-				    }
1350
+					}
1351 1351
 
1352
-				    $this->entry[ $input_name ] = $value;
1353
-				    $_POST[ $input_name ] = $value;
1352
+					$this->entry[ $input_name ] = $value;
1353
+					$_POST[ $input_name ] = $value;
1354 1354
 
1355
-				    break;
1355
+					break;
1356 1356
 
1357 1357
 				case 'number':
1358
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1359
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1360
-				        $_POST['input_'.$field->id ] = NULL;
1361
-				    }
1362
-				    break;
1358
+					// Fix "undefined index" issue at line 1286 in form_display.php
1359
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1360
+						$_POST['input_'.$field->id ] = NULL;
1361
+					}
1362
+					break;
1363 1363
 			}
1364 1364
 
1365 1365
 		}
@@ -1444,42 +1444,42 @@  discard block
 block discarded – undo
1444 1444
 				case 'fileupload' :
1445 1445
 				case 'post_image':
1446 1446
 
1447
-				    // in case nothing is uploaded but there are already files saved
1448
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1449
-				        $field->failed_validation = false;
1450
-				        unset( $field->validation_message );
1451
-				    }
1447
+					// in case nothing is uploaded but there are already files saved
1448
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1449
+						$field->failed_validation = false;
1450
+						unset( $field->validation_message );
1451
+					}
1452 1452
 
1453
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1454
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1453
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1454
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1455 1455
 
1456
-				        $input_name = 'input_' . $field->id;
1457
-				        //uploaded
1458
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1456
+						$input_name = 'input_' . $field->id;
1457
+						//uploaded
1458
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1459 1459
 
1460
-				        //existent
1461
-				        $entry = $this->get_entry();
1462
-				        $value = NULL;
1463
-				        if( isset( $entry[ $field->id ] ) ) {
1464
-				            $value = json_decode( $entry[ $field->id ], true );
1465
-				        }
1460
+						//existent
1461
+						$entry = $this->get_entry();
1462
+						$value = NULL;
1463
+						if( isset( $entry[ $field->id ] ) ) {
1464
+							$value = json_decode( $entry[ $field->id ], true );
1465
+						}
1466 1466
 
1467
-				        // count uploaded files and existent entry files
1468
-				        $count_files = count( $file_names ) + count( $value );
1467
+						// count uploaded files and existent entry files
1468
+						$count_files = count( $file_names ) + count( $value );
1469 1469
 
1470
-				        if( $count_files > $field->maxFiles ) {
1471
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1472
-				            $field->failed_validation = 1;
1473
-				            $gv_valid = false;
1470
+						if( $count_files > $field->maxFiles ) {
1471
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1472
+							$field->failed_validation = 1;
1473
+							$gv_valid = false;
1474 1474
 
1475
-				            // in case of error make sure the newest upload files are removed from the upload input
1476
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1477
-				        }
1475
+							// in case of error make sure the newest upload files are removed from the upload input
1476
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1477
+						}
1478 1478
 
1479
-				    }
1479
+					}
1480 1480
 
1481 1481
 
1482
-				    break;
1482
+					break;
1483 1483
 
1484 1484
 			}
1485 1485
 
@@ -1490,47 +1490,47 @@  discard block
 block discarded – undo
1490 1490
 
1491 1491
 				switch ( $field_type ) {
1492 1492
 
1493
-				    // Captchas don't need to be re-entered.
1494
-				    case 'captcha':
1493
+					// Captchas don't need to be re-entered.
1494
+					case 'captcha':
1495 1495
 
1496
-				        // Post Image fields aren't editable, so we un-fail them.
1497
-				    case 'post_image':
1498
-				        $field->failed_validation = false;
1499
-				        unset( $field->validation_message );
1500
-				        break;
1496
+						// Post Image fields aren't editable, so we un-fail them.
1497
+					case 'post_image':
1498
+						$field->failed_validation = false;
1499
+						unset( $field->validation_message );
1500
+						break;
1501 1501
 
1502 1502
 				}
1503 1503
 
1504 1504
 				// You can't continue inside a switch, so we do it after.
1505 1505
 				if( empty( $field->failed_validation ) ) {
1506
-				    continue;
1506
+					continue;
1507 1507
 				}
1508 1508
 
1509 1509
 				// checks if the No Duplicates option is not validating entry against itself, since
1510 1510
 				// we're editing a stored entry, it would also assume it's a duplicate.
1511 1511
 				if( !empty( $field->noDuplicates ) ) {
1512 1512
 
1513
-				    $entry = $this->get_entry();
1513
+					$entry = $this->get_entry();
1514 1514
 
1515
-				    // If the value of the entry is the same as the stored value
1516
-				    // Then we can assume it's not a duplicate, it's the same.
1517
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1518
-				        //if value submitted was not changed, then don't validate
1519
-				        $field->failed_validation = false;
1515
+					// If the value of the entry is the same as the stored value
1516
+					// Then we can assume it's not a duplicate, it's the same.
1517
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1518
+						//if value submitted was not changed, then don't validate
1519
+						$field->failed_validation = false;
1520 1520
 
1521
-				        unset( $field->validation_message );
1521
+						unset( $field->validation_message );
1522 1522
 
1523
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1523
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1524 1524
 
1525
-				        continue;
1526
-				    }
1525
+						continue;
1526
+					}
1527 1527
 				}
1528 1528
 
1529 1529
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1530 1530
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1531
-				    unset( $field->validation_message );
1532
-	                $field->validation_message = false;
1533
-				    continue;
1531
+					unset( $field->validation_message );
1532
+					$field->validation_message = false;
1533
+					continue;
1534 1534
 				}
1535 1535
 
1536 1536
 				$gv_valid = false;
@@ -1594,8 +1594,8 @@  discard block
 block discarded – undo
1594 1594
 		// Hide fields depending on admin settings
1595 1595
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1596 1596
 
1597
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1598
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1597
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1598
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1599 1599
 
1600 1600
 		/**
1601 1601
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1655,11 +1655,11 @@  discard block
 block discarded – undo
1655 1655
 		// The edit tab has been configured, so we loop through to configured settings
1656 1656
 		foreach ( $configured_fields as $configured_field ) {
1657 1657
 
1658
-	        /** @var GF_Field $field */
1659
-	        foreach ( $fields as $field ) {
1658
+			/** @var GF_Field $field */
1659
+			foreach ( $fields as $field ) {
1660 1660
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1661
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1662
-				    break;
1661
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1662
+					break;
1663 1663
 				}
1664 1664
 
1665 1665
 			}
@@ -1715,28 +1715,28 @@  discard block
 block discarded – undo
1715 1715
 	 */
1716 1716
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1717 1717
 
1718
-	    /**
1718
+		/**
1719 1719
 		 * @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
1720
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1721
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1722
-	     * @since 1.9.1
1723
-	     * @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.
1724
-	     * @param array $form GF Form array
1725
-	     * @param int $view_id View ID
1726
-	     */
1727
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1728
-
1729
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1720
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1721
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1722
+		 * @since 1.9.1
1723
+		 * @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.
1724
+		 * @param array $form GF Form array
1725
+		 * @param int $view_id View ID
1726
+		 */
1727
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1728
+
1729
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1730 1730
 			foreach( $fields as $k => $field ) {
1731 1731
 				if( $field->adminOnly ) {
1732
-				    unset( $fields[ $k ] );
1732
+					unset( $fields[ $k ] );
1733 1733
 				}
1734 1734
 			}
1735 1735
 			return $fields;
1736 1736
 		}
1737 1737
 
1738
-	    foreach( $fields as &$field ) {
1739
-		    $field->adminOnly = false;
1738
+		foreach( $fields as &$field ) {
1739
+			$field->adminOnly = false;
1740 1740
 		}
1741 1741
 
1742 1742
 		return $fields;
@@ -1756,13 +1756,13 @@  discard block
 block discarded – undo
1756 1756
 	 */
1757 1757
 	private function unselect_default_values( $form ) {
1758 1758
 
1759
-	    foreach ( $form['fields'] as &$field ) {
1759
+		foreach ( $form['fields'] as &$field ) {
1760 1760
 
1761 1761
 			if ( empty( $field->choices ) ) {
1762
-                continue;
1762
+				continue;
1763 1763
 			}
1764 1764
 
1765
-            foreach ( $field->choices as &$choice ) {
1765
+			foreach ( $field->choices as &$choice ) {
1766 1766
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1767 1767
 					$choice['isSelected'] = false;
1768 1768
 				}
@@ -1799,36 +1799,36 @@  discard block
 block discarded – undo
1799 1799
 
1800 1800
 			if( 'checkbox' === $field->type ) {
1801 1801
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1802
-				    $input_id = $input['id'];
1803
-				    $choice = $field->choices[ $key ];
1804
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1805
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1806
-				    if( $match ) {
1807
-				        $field->choices[ $key ]['isSelected'] = true;
1808
-				    }
1802
+					$input_id = $input['id'];
1803
+					$choice = $field->choices[ $key ];
1804
+					$value = \GV\Utils::get( $this->entry, $input_id );
1805
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1806
+					if( $match ) {
1807
+						$field->choices[ $key ]['isSelected'] = true;
1808
+					}
1809 1809
 				}
1810 1810
 			} else {
1811 1811
 
1812 1812
 				// We need to run through each field to set the default values
1813 1813
 				foreach ( $this->entry as $field_id => $field_value ) {
1814 1814
 
1815
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1815
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1816 1816
 
1817
-				        if( 'list' === $field->type ) {
1818
-				            $list_rows = maybe_unserialize( $field_value );
1817
+						if( 'list' === $field->type ) {
1818
+							$list_rows = maybe_unserialize( $field_value );
1819 1819
 
1820
-				            $list_field_value = array();
1821
-				            foreach ( (array) $list_rows as $row ) {
1822
-				                foreach ( (array) $row as $column ) {
1823
-				                    $list_field_value[] = $column;
1824
-				                }
1825
-				            }
1820
+							$list_field_value = array();
1821
+							foreach ( (array) $list_rows as $row ) {
1822
+								foreach ( (array) $row as $column ) {
1823
+									$list_field_value[] = $column;
1824
+								}
1825
+							}
1826 1826
 
1827
-				            $field->defaultValue = serialize( $list_field_value );
1828
-				        } else {
1829
-				            $field->defaultValue = $field_value;
1830
-				        }
1831
-				    }
1827
+							$field->defaultValue = serialize( $list_field_value );
1828
+						} else {
1829
+							$field->defaultValue = $field_value;
1830
+						}
1831
+					}
1832 1832
 				}
1833 1833
 			}
1834 1834
 		}
@@ -1885,7 +1885,7 @@  discard block
 block discarded – undo
1885 1885
 			return $has_conditional_logic;
1886 1886
 		}
1887 1887
 
1888
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1888
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1889 1889
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
1890 1890
 	}
1891 1891
 
@@ -1952,14 +1952,14 @@  discard block
 block discarded – undo
1952 1952
 
1953 1953
 		if( $echo && $error !== true ) {
1954 1954
 
1955
-	        $error = esc_html( $error );
1955
+			$error = esc_html( $error );
1956 1956
 
1957
-	        /**
1958
-	         * @since 1.9
1959
-	         */
1960
-	        if ( ! empty( $this->entry ) ) {
1961
-		        $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;" ) );
1962
-	        }
1957
+			/**
1958
+			 * @since 1.9
1959
+			 */
1960
+			if ( ! empty( $this->entry ) ) {
1961
+				$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;" ) );
1962
+			}
1963 1963
 
1964 1964
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1965 1965
 		}
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
 
@@ -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
 
@@ -286,19 +286,19 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	private function process_save( $gv_data ) {
288 288
 
289
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
289
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
290 290
 			return;
291 291
 		}
292 292
 
293 293
 		// Make sure the entry, view, and form IDs are all correct
294 294
 		$valid = $this->verify_nonce();
295 295
 
296
-		if ( !$valid ) {
296
+		if ( ! $valid ) {
297 297
 			gravityview()->log->error( 'Nonce validation failed.' );
298 298
 			return;
299 299
 		}
300 300
 
301
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
301
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
302 302
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
303 303
 			return;
304 304
 		}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
 		$this->validate();
311 311
 
312
-		if( $this->is_valid ) {
312
+		if ( $this->is_valid ) {
313 313
 
314 314
 			gravityview()->log->debug( 'Submission is valid.' );
315 315
 
@@ -321,22 +321,22 @@  discard block
 block discarded – undo
321 321
 			/**
322 322
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
323 323
 			 */
324
-			unset( $_GET['page'] );
324
+			unset( $_GET[ 'page' ] );
325 325
 
326
-			$date_created = $this->entry['date_created'];
326
+			$date_created = $this->entry[ 'date_created' ];
327 327
 
328 328
 			/**
329 329
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
330 330
 			 * @since 1.17.2
331 331
 			 */
332
-			unset( $this->entry['date_created'] );
332
+			unset( $this->entry[ 'date_created' ] );
333 333
 
334 334
 			GFFormsModel::save_lead( $form, $this->entry );
335 335
 
336 336
 	        // Delete the values for hidden inputs
337 337
 	        $this->unset_hidden_field_values();
338 338
 			
339
-			$this->entry['date_created'] = $date_created;
339
+			$this->entry[ 'date_created' ] = $date_created;
340 340
 
341 341
 			// Process calculation fields
342 342
 			$this->update_calculation_fields();
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 			 * @param GravityView_Edit_Entry_Render $this This object
359 359
 			 * @param GravityView_View_Data $gv_data The View data
360 360
 			 */
361
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
361
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
362 362
 
363 363
 		} else {
364 364
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -386,16 +386,16 @@  discard block
 block discarded – undo
386 386
 		 */
387 387
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
388 388
 
389
-		if( ! $unset_hidden_field_values ) {
389
+		if ( ! $unset_hidden_field_values ) {
390 390
 			return;
391 391
 		}
392 392
 
393 393
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
394 394
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
395
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
395
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
396 396
 		} else {
397 397
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
398
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
398
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
399 399
 		}
400 400
 
401 401
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		}
477 477
 
478 478
 		/** No file is being uploaded. */
479
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
479
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
480 480
 			/** So return the original upload */
481 481
 			return $entry[ $input_id ];
482 482
 		}
@@ -494,11 +494,11 @@  discard block
 block discarded – undo
494 494
 	 * @return mixed
495 495
 	 */
496 496
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
497
-		if( ! $this->is_edit_entry() ) {
497
+		if ( ! $this->is_edit_entry() ) {
498 498
 			return $plupload_init;
499 499
 		}
500 500
 
501
-		$plupload_init['gf_vars']['max_files'] = 0;
501
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
502 502
 
503 503
 		return $plupload_init;
504 504
 	}
@@ -513,22 +513,22 @@  discard block
 block discarded – undo
513 513
 		$form = $this->form;
514 514
 
515 515
 	    /** @var GF_Field $field */
516
-		foreach( $form['fields'] as $k => &$field ) {
516
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
517 517
 
518 518
 			/**
519 519
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
520 520
 			 * @since 1.16.3
521 521
 			 * @var GF_Field $field
522 522
 			 */
523
-			if( $field->has_calculation() ) {
524
-				unset( $form['fields'][ $k ] );
523
+			if ( $field->has_calculation() ) {
524
+				unset( $form[ 'fields' ][ $k ] );
525 525
 			}
526 526
 
527 527
 			$field->adminOnly = false;
528 528
 
529
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530
-				foreach( $field->inputs as $key => $input ) {
531
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
529
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530
+				foreach ( $field->inputs as $key => $input ) {
531
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
532 532
 				}
533 533
 			}
534 534
 		}
@@ -542,30 +542,30 @@  discard block
 block discarded – undo
542 542
 		$update = false;
543 543
 
544 544
 		// get the most up to date entry values
545
-		$entry = GFAPI::get_entry( $this->entry['id'] );
545
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
546 546
 
547
-		if( !empty( $this->fields_with_calculation ) ) {
547
+		if ( ! empty( $this->fields_with_calculation ) ) {
548 548
 			$update = true;
549 549
 			foreach ( $this->fields_with_calculation as $calc_field ) {
550 550
 				$inputs = $calc_field->get_entry_inputs();
551 551
 				if ( is_array( $inputs ) ) {
552 552
 				    foreach ( $inputs as $input ) {
553
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
554
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
553
+				        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
554
+				        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
555 555
 				    }
556 556
 				} else {
557
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
558
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
557
+				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
558
+				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
559 559
 				}
560 560
 			}
561 561
 
562 562
 		}
563 563
 
564
-		if( $update ) {
564
+		if ( $update ) {
565 565
 
566 566
 			$return_entry = GFAPI::update_entry( $entry );
567 567
 
568
-			if( is_wp_error( $return_entry ) ) {
568
+			if ( is_wp_error( $return_entry ) ) {
569 569
 				gravityview()->log->error( 'Updating the entry calculation fields failed', array( 'data' => $return_entry ) );
570 570
 			} else {
571 571
 				gravityview()->log->debug( 'Updating the entry calculation fields succeeded' );
@@ -596,19 +596,19 @@  discard block
 block discarded – undo
596 596
 
597 597
 		$input_name = 'input_' . $field_id;
598 598
 
599
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
599
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
600 600
 
601 601
 			// We have a new image
602 602
 
603
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
603
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
604 604
 
605 605
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
606 606
 	        $ary = stripslashes_deep( $ary );
607 607
 			$img_url = \GV\Utils::get( $ary, 0 );
608 608
 
609
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
610
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
611
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
609
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
610
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
611
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
612 612
 
613 613
 			$image_meta = array(
614 614
 				'post_excerpt' => $img_caption,
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 
618 618
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
619 619
 			if ( ! empty( $img_title ) ) {
620
-				$image_meta['post_title'] = $img_title;
620
+				$image_meta[ 'post_title' ] = $img_title;
621 621
 			}
622 622
 
623 623
 			/**
@@ -675,15 +675,15 @@  discard block
 block discarded – undo
675 675
 	 */
676 676
 	private function maybe_update_post_fields( $form ) {
677 677
 
678
-		if( empty( $this->entry['post_id'] ) ) {
678
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
679 679
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
680 680
 			return;
681 681
 		}
682 682
 
683
-		$post_id = $this->entry['post_id'];
683
+		$post_id = $this->entry[ 'post_id' ];
684 684
 
685 685
 		// Security check
686
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
686
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
687 687
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
688 688
 			return;
689 689
 		}
@@ -696,25 +696,25 @@  discard block
 block discarded – undo
696 696
 
697 697
 			$field = RGFormsModel::get_field( $form, $field_id );
698 698
 
699
-			if( ! $field ) {
699
+			if ( ! $field ) {
700 700
 				continue;
701 701
 			}
702 702
 
703
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
703
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
704 704
 
705 705
 				// Get the value of the field, including $_POSTed value
706 706
 				$value = RGFormsModel::get_field_value( $field );
707 707
 
708 708
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
709 709
 				$entry_tmp = $this->entry;
710
-				$entry_tmp["{$field_id}"] = $value;
710
+				$entry_tmp[ "{$field_id}" ] = $value;
711 711
 
712
-				switch( $field->type ) {
712
+				switch ( $field->type ) {
713 713
 
714 714
 				    case 'post_title':
715 715
 				        $post_title = $value;
716 716
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
717
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
717
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
718 718
 				        }
719 719
 				        $updated_post->post_title = $post_title;
720 720
 				        $updated_post->post_name  = $post_title;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 				    case 'post_content':
725 725
 				        $post_content = $value;
726 726
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
727
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
727
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
728 728
 				        }
729 729
 				        $updated_post->post_content = $post_content;
730 730
 				        unset( $post_content );
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 							$value = $value[ $field_id ];
743 743
 						}
744 744
 
745
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
745
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
746 746
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
747 747
 				        }
748 748
 
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 				}
761 761
 
762 762
 				// update entry after
763
-				$this->entry["{$field_id}"] = $value;
763
+				$this->entry[ "{$field_id}" ] = $value;
764 764
 
765 765
 				$update_entry = true;
766 766
 
@@ -769,11 +769,11 @@  discard block
 block discarded – undo
769 769
 
770 770
 		}
771 771
 
772
-		if( $update_entry ) {
772
+		if ( $update_entry ) {
773 773
 
774 774
 			$return_entry = GFAPI::update_entry( $this->entry );
775 775
 
776
-			if( is_wp_error( $return_entry ) ) {
776
+			if ( is_wp_error( $return_entry ) ) {
777 777
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
778 778
 			} else {
779 779
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 
784 784
 		$return_post = wp_update_post( $updated_post, true );
785 785
 
786
-		if( is_wp_error( $return_post ) ) {
786
+		if ( is_wp_error( $return_post ) ) {
787 787
 			$return_post->add_data( $updated_post, '$updated_post' );
788 788
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
789 789
 		} else {
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 		$input_type = RGFormsModel::get_input_type( $field );
806 806
 
807 807
 	    // Only certain custom field types are supported
808
-	    switch( $input_type ) {
808
+	    switch ( $input_type ) {
809 809
 		    case 'fileupload':
810 810
 		    case 'list':
811 811
 		    case 'multiselect':
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
843 843
 
844 844
 		// replace conditional shortcodes
845
-		if( $do_shortcode ) {
845
+		if ( $do_shortcode ) {
846 846
 			$output = do_shortcode( $output );
847 847
 		}
848 848
 
@@ -861,19 +861,19 @@  discard block
 block discarded – undo
861 861
 	 */
862 862
 	private function after_update() {
863 863
 
864
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
865
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
864
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
865
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
866 866
 
867 867
 		// Re-define the entry now that we've updated it.
868
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
868
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
869 869
 
870 870
 		$entry = GFFormsModel::set_entry_meta( $entry, $this->form );
871 871
 
872 872
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
873 873
 			// We need to clear the cache because Gravity Forms caches the field values, which
874 874
 			// we have just updated.
875
-			foreach ($this->form['fields'] as $key => $field) {
876
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
875
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
876
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
877 877
 			}
878 878
 		}
879 879
 
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 
893 893
 		<div class="gv-edit-entry-wrapper"><?php
894 894
 
895
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
895
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
896 896
 
897 897
 			/**
898 898
 			 * Fixes weird wpautop() issue
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
909 909
 				     * @param GravityView_Edit_Entry_Render $this This object
910 910
 				     */
911
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
911
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
912 912
 
913 913
 				    echo esc_attr( $edit_entry_title );
914 914
 			?></span>
@@ -958,16 +958,16 @@  discard block
 block discarded – undo
958 958
 
959 959
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
960 960
 
961
-			if( ! $this->is_valid ){
961
+			if ( ! $this->is_valid ) {
962 962
 
963 963
 				// Keeping this compatible with Gravity Forms.
964
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
965
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
964
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
965
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
966 966
 
967
-				echo GVCommon::generate_notice( $message , 'gv-error' );
967
+				echo GVCommon::generate_notice( $message, 'gv-error' );
968 968
 
969 969
 			} else {
970
-				$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
970
+				$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
971 971
 
972 972
 				/**
973 973
 				 * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 				 * @param array $entry Gravity Forms entry array
978 978
 				 * @param string $back_link URL to return to the original entry. @since 1.6
979 979
 				 */
980
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
980
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
981 981
 
982 982
 				echo GVCommon::generate_notice( $message );
983 983
 			}
@@ -1001,21 +1001,21 @@  discard block
 block discarded – undo
1001 1001
 		 */
1002 1002
 		do_action( 'gravityview/edit-entry/render/before', $this );
1003 1003
 
1004
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1005
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1004
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1005
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1006 1006
 		add_filter( 'gform_disable_view_counter', '__return_true' );
1007 1007
 
1008 1008
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
1009 1009
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1010 1010
 
1011 1011
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1012
-		unset( $_GET['page'] );
1012
+		unset( $_GET[ 'page' ] );
1013 1013
 
1014 1014
 		// TODO: Verify multiple-page forms
1015 1015
 
1016 1016
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1017 1017
 
1018
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1018
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1019 1019
 
1020 1020
 		ob_get_clean();
1021 1021
 
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 	 * @return string
1042 1042
 	 */
1043 1043
 	public function render_form_buttons() {
1044
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1044
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1045 1045
 	}
1046 1046
 
1047 1047
 
@@ -1061,10 +1061,10 @@  discard block
 block discarded – undo
1061 1061
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1062 1062
 
1063 1063
 		// In case we have validated the form, use it to inject the validation results into the form render
1064
-		if( isset( $this->form_after_validation ) ) {
1064
+		if ( isset( $this->form_after_validation ) ) {
1065 1065
 			$form = $this->form_after_validation;
1066 1066
 		} else {
1067
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1067
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1068 1068
 		}
1069 1069
 
1070 1070
 		$form = $this->filter_conditional_logic( $form );
@@ -1072,8 +1072,8 @@  discard block
 block discarded – undo
1072 1072
 		$form = $this->prefill_conditional_logic( $form );
1073 1073
 
1074 1074
 		// for now we don't support Save and Continue feature.
1075
-		if( ! self::$supports_save_and_continue ) {
1076
-	        unset( $form['save'] );
1075
+		if ( ! self::$supports_save_and_continue ) {
1076
+	        unset( $form[ 'save' ] );
1077 1077
 		}
1078 1078
 
1079 1079
 		$form = $this->unselect_default_values( $form );
@@ -1096,31 +1096,31 @@  discard block
 block discarded – undo
1096 1096
 	 */
1097 1097
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1098 1098
 
1099
-		if( ! GFCommon::is_post_field( $field ) ) {
1099
+		if ( ! GFCommon::is_post_field( $field ) ) {
1100 1100
 			return $field_content;
1101 1101
 		}
1102 1102
 
1103 1103
         $message = null;
1104 1104
 
1105 1105
         // First, make sure they have the capability to edit the post.
1106
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1106
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1107 1107
 
1108 1108
             /**
1109 1109
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1110 1110
              * @param string $message The existing "You don't have permission..." text
1111 1111
              */
1112
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1112
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1113 1113
 
1114
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1114
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1115 1115
             /**
1116 1116
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1117 1117
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1118 1118
              */
1119
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1119
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1120 1120
         }
1121 1121
 
1122
-        if( $message ) {
1123
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1122
+        if ( $message ) {
1123
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1124 1124
         }
1125 1125
 
1126 1126
         return $field_content;
@@ -1144,8 +1144,8 @@  discard block
 block discarded – undo
1144 1144
 
1145 1145
 		// If the form has been submitted, then we don't need to pre-fill the values,
1146 1146
 		// Except for fileupload type and when a field input is overridden- run always!!
1147
-		if(
1148
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1147
+		if (
1148
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1149 1149
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1150 1150
 			&& ! GFCommon::is_product_field( $field->type )
1151 1151
 			|| ! empty( $field_content )
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 	    $return = null;
1166 1166
 
1167 1167
 		/** @var GravityView_Field $gv_field */
1168
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1168
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1169 1169
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1170 1170
 		} else {
1171 1171
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 	    // If there was output, it's an error
1175 1175
 	    $warnings = ob_get_clean();
1176 1176
 
1177
-	    if( !empty( $warnings ) ) {
1177
+	    if ( ! empty( $warnings ) ) {
1178 1178
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1179 1179
 	    }
1180 1180
 
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1200 1200
 
1201 1201
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1202
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1202
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1203 1203
 
1204 1204
 			$field_value = array();
1205 1205
 
@@ -1208,10 +1208,10 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
 			foreach ( (array)$field->inputs as $input ) {
1210 1210
 
1211
-				$input_id = strval( $input['id'] );
1211
+				$input_id = strval( $input[ 'id' ] );
1212 1212
 				
1213 1213
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1214
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1214
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1215 1215
 				    $allow_pre_populated = false;
1216 1216
 				}
1217 1217
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 
1220 1220
 			$pre_value = $field->get_value_submission( array(), false );
1221 1221
 
1222
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1222
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1223 1223
 
1224 1224
 		} else {
1225 1225
 
@@ -1230,13 +1230,13 @@  discard block
 block discarded – undo
1230 1230
 
1231 1231
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1232 1232
 			// or pre-populated value if not empty and set to override saved value
1233
-			$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;
1233
+			$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;
1234 1234
 
1235 1235
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1236
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1236
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1237 1237
 				$categories = array();
1238 1238
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1239
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1239
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1240 1240
 				}
1241 1241
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1242 1242
 			}
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 	     * @param GF_Field $field Gravity Forms field object
1265 1265
 	     * @param GravityView_Edit_Entry_Render $this Current object
1266 1266
 	     */
1267
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1267
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1268 1268
 
1269 1269
 		return $field_value;
1270 1270
 	}
@@ -1281,12 +1281,12 @@  discard block
 block discarded – undo
1281 1281
 	 */
1282 1282
 	public function gform_pre_validation( $form ) {
1283 1283
 
1284
-		if( ! $this->verify_nonce() ) {
1284
+		if ( ! $this->verify_nonce() ) {
1285 1285
 			return $form;
1286 1286
 		}
1287 1287
 
1288 1288
 		// Fix PHP warning regarding undefined index.
1289
-		foreach ( $form['fields'] as &$field) {
1289
+		foreach ( $form[ 'fields' ] as &$field ) {
1290 1290
 
1291 1291
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1292 1292
 			// expects certain field array items to be set.
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1295 1295
 			}
1296 1296
 
1297
-			switch( RGFormsModel::get_input_type( $field ) ) {
1297
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1298 1298
 
1299 1299
 				/**
1300 1300
 				 * 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.
@@ -1308,26 +1308,26 @@  discard block
 block discarded – undo
1308 1308
 				    // Set the previous value
1309 1309
 				    $entry = $this->get_entry();
1310 1310
 
1311
-				    $input_name = 'input_'.$field->id;
1312
-				    $form_id = $form['id'];
1311
+				    $input_name = 'input_' . $field->id;
1312
+				    $form_id = $form[ 'id' ];
1313 1313
 
1314 1314
 				    $value = NULL;
1315 1315
 
1316 1316
 				    // Use the previous entry value as the default.
1317
-				    if( isset( $entry[ $field->id ] ) ) {
1317
+				    if ( isset( $entry[ $field->id ] ) ) {
1318 1318
 				        $value = $entry[ $field->id ];
1319 1319
 				    }
1320 1320
 
1321 1321
 				    // If this is a single upload file
1322
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1323
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1324
-				        $value = $file_path['url'];
1322
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1323
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1324
+				        $value = $file_path[ 'url' ];
1325 1325
 
1326 1326
 				    } else {
1327 1327
 
1328 1328
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1329 1329
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1330
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1330
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1331 1331
 
1332 1332
 				    }
1333 1333
 
@@ -1335,10 +1335,10 @@  discard block
 block discarded – undo
1335 1335
 
1336 1336
 				        // If there are fresh uploads, process and merge them.
1337 1337
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1338
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1338
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1339 1339
 				            $value = empty( $value ) ? '[]' : $value;
1340 1340
 				            $value = stripslashes_deep( $value );
1341
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1341
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1342 1342
 				        }
1343 1343
 
1344 1344
 				    } else {
@@ -1356,8 +1356,8 @@  discard block
 block discarded – undo
1356 1356
 
1357 1357
 				case 'number':
1358 1358
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1359
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1360
-				        $_POST['input_'.$field->id ] = NULL;
1359
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1360
+				        $_POST[ 'input_' . $field->id ] = NULL;
1361 1361
 				    }
1362 1362
 				    break;
1363 1363
 			}
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 		 * You can enter whatever you want!
1395 1395
 		 * We try validating, and customize the results using `self::custom_validation()`
1396 1396
 		 */
1397
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1397
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1398 1398
 
1399 1399
 		// Needed by the validate funtion
1400 1400
 		$failed_validation_page = NULL;
@@ -1402,14 +1402,14 @@  discard block
 block discarded – undo
1402 1402
 
1403 1403
 		// Prevent entry limit from running when editing an entry, also
1404 1404
 		// prevent form scheduling from preventing editing
1405
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1405
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1406 1406
 
1407 1407
 		// Hide fields depending on Edit Entry settings
1408
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1408
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1409 1409
 
1410 1410
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1411 1411
 
1412
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1412
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1413 1413
 	}
1414 1414
 
1415 1415
 
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 
1433 1433
 		$gv_valid = true;
1434 1434
 
1435
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1435
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1436 1436
 
1437 1437
 			$value = RGFormsModel::get_field_value( $field );
1438 1438
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1445,35 +1445,35 @@  discard block
 block discarded – undo
1445 1445
 				case 'post_image':
1446 1446
 
1447 1447
 				    // in case nothing is uploaded but there are already files saved
1448
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1448
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1449 1449
 				        $field->failed_validation = false;
1450 1450
 				        unset( $field->validation_message );
1451 1451
 				    }
1452 1452
 
1453 1453
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1454
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1454
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1455 1455
 
1456 1456
 				        $input_name = 'input_' . $field->id;
1457 1457
 				        //uploaded
1458
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1458
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1459 1459
 
1460 1460
 				        //existent
1461 1461
 				        $entry = $this->get_entry();
1462 1462
 				        $value = NULL;
1463
-				        if( isset( $entry[ $field->id ] ) ) {
1463
+				        if ( isset( $entry[ $field->id ] ) ) {
1464 1464
 				            $value = json_decode( $entry[ $field->id ], true );
1465 1465
 				        }
1466 1466
 
1467 1467
 				        // count uploaded files and existent entry files
1468 1468
 				        $count_files = count( $file_names ) + count( $value );
1469 1469
 
1470
-				        if( $count_files > $field->maxFiles ) {
1470
+				        if ( $count_files > $field->maxFiles ) {
1471 1471
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1472 1472
 				            $field->failed_validation = 1;
1473 1473
 				            $gv_valid = false;
1474 1474
 
1475 1475
 				            // in case of error make sure the newest upload files are removed from the upload input
1476
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1476
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1477 1477
 				        }
1478 1478
 
1479 1479
 				    }
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
 			}
1485 1485
 
1486 1486
 			// This field has failed validation.
1487
-			if( !empty( $field->failed_validation ) ) {
1487
+			if ( ! empty( $field->failed_validation ) ) {
1488 1488
 
1489 1489
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1490 1490
 
@@ -1502,19 +1502,19 @@  discard block
 block discarded – undo
1502 1502
 				}
1503 1503
 
1504 1504
 				// You can't continue inside a switch, so we do it after.
1505
-				if( empty( $field->failed_validation ) ) {
1505
+				if ( empty( $field->failed_validation ) ) {
1506 1506
 				    continue;
1507 1507
 				}
1508 1508
 
1509 1509
 				// checks if the No Duplicates option is not validating entry against itself, since
1510 1510
 				// we're editing a stored entry, it would also assume it's a duplicate.
1511
-				if( !empty( $field->noDuplicates ) ) {
1511
+				if ( ! empty( $field->noDuplicates ) ) {
1512 1512
 
1513 1513
 				    $entry = $this->get_entry();
1514 1514
 
1515 1515
 				    // If the value of the entry is the same as the stored value
1516 1516
 				    // Then we can assume it's not a duplicate, it's the same.
1517
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1517
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1518 1518
 				        //if value submitted was not changed, then don't validate
1519 1519
 				        $field->failed_validation = false;
1520 1520
 
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
 				}
1528 1528
 
1529 1529
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1530
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1530
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1531 1531
 				    unset( $field->validation_message );
1532 1532
 	                $field->validation_message = false;
1533 1533
 				    continue;
@@ -1539,12 +1539,12 @@  discard block
 block discarded – undo
1539 1539
 
1540 1540
 		}
1541 1541
 
1542
-		$validation_results['is_valid'] = $gv_valid;
1542
+		$validation_results[ 'is_valid' ] = $gv_valid;
1543 1543
 
1544 1544
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1545 1545
 
1546 1546
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1547
-		$this->form_after_validation = $validation_results['form'];
1547
+		$this->form_after_validation = $validation_results[ 'form' ];
1548 1548
 
1549 1549
 		return $validation_results;
1550 1550
 	}
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 	 */
1558 1558
 	public function get_entry() {
1559 1559
 
1560
-		if( empty( $this->entry ) ) {
1560
+		if ( empty( $this->entry ) ) {
1561 1561
 			// Get the database value of the entry that's being edited
1562 1562
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1563 1563
 		}
@@ -1589,10 +1589,10 @@  discard block
 block discarded – undo
1589 1589
 		}
1590 1590
 
1591 1591
 		// If edit tab not yet configured, show all fields
1592
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1592
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1593 1593
 
1594 1594
 		// Hide fields depending on admin settings
1595
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1595
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1596 1596
 
1597 1597
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1598 1598
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
 	 */
1625 1625
 	private function filter_fields( $fields, $configured_fields ) {
1626 1626
 
1627
-		if( empty( $fields ) || !is_array( $fields ) ) {
1627
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1628 1628
 			return $fields;
1629 1629
 		}
1630 1630
 
@@ -1637,18 +1637,18 @@  discard block
 block discarded – undo
1637 1637
 
1638 1638
 			// Remove the fields that have calculation properties and keep them to be used later
1639 1639
 			// @since 1.16.2
1640
-			if( $field->has_calculation() ) {
1641
-				$this->fields_with_calculation[] = $field;
1640
+			if ( $field->has_calculation() ) {
1641
+				$this->fields_with_calculation[ ] = $field;
1642 1642
 				// don't remove the calculation fields on form render.
1643 1643
 			}
1644 1644
 
1645
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1645
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1646 1646
 				unset( $fields[ $key ] );
1647 1647
 			}
1648 1648
 		}
1649 1649
 
1650 1650
 		// The Edit tab has not been configured, so we return all fields by default.
1651
-		if( empty( $configured_fields ) ) {
1651
+		if ( empty( $configured_fields ) ) {
1652 1652
 			return $fields;
1653 1653
 		}
1654 1654
 
@@ -1657,8 +1657,8 @@  discard block
 block discarded – undo
1657 1657
 
1658 1658
 	        /** @var GF_Field $field */
1659 1659
 	        foreach ( $fields as $field ) {
1660
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1661
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1660
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1661
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1662 1662
 				    break;
1663 1663
 				}
1664 1664
 
@@ -1681,14 +1681,14 @@  discard block
 block discarded – undo
1681 1681
 
1682 1682
 		$return_field = $field;
1683 1683
 
1684
-		if( empty( $field_setting['show_label'] ) ) {
1684
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1685 1685
 			$return_field->label = '';
1686
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1687
-			$return_field->label = $field_setting['custom_label'];
1686
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1687
+			$return_field->label = $field_setting[ 'custom_label' ];
1688 1688
 		}
1689 1689
 
1690
-		if( !empty( $field_setting['custom_class'] ) ) {
1691
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1690
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1691
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1692 1692
 		}
1693 1693
 
1694 1694
 		/**
@@ -1726,16 +1726,16 @@  discard block
 block discarded – undo
1726 1726
 	     */
1727 1727
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1728 1728
 
1729
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1730
-			foreach( $fields as $k => $field ) {
1731
-				if( $field->adminOnly ) {
1729
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1730
+			foreach ( $fields as $k => $field ) {
1731
+				if ( $field->adminOnly ) {
1732 1732
 				    unset( $fields[ $k ] );
1733 1733
 				}
1734 1734
 			}
1735 1735
 			return $fields;
1736 1736
 		}
1737 1737
 
1738
-	    foreach( $fields as &$field ) {
1738
+	    foreach ( $fields as &$field ) {
1739 1739
 		    $field->adminOnly = false;
1740 1740
 		}
1741 1741
 
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
 	 */
1757 1757
 	private function unselect_default_values( $form ) {
1758 1758
 
1759
-	    foreach ( $form['fields'] as &$field ) {
1759
+	    foreach ( $form[ 'fields' ] as &$field ) {
1760 1760
 
1761 1761
 			if ( empty( $field->choices ) ) {
1762 1762
                 continue;
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
 
1765 1765
             foreach ( $field->choices as &$choice ) {
1766 1766
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1767
-					$choice['isSelected'] = false;
1767
+					$choice[ 'isSelected' ] = false;
1768 1768
 				}
1769 1769
 			}
1770 1770
 		}
@@ -1789,22 +1789,22 @@  discard block
 block discarded – undo
1789 1789
 	 */
1790 1790
 	function prefill_conditional_logic( $form ) {
1791 1791
 
1792
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1792
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1793 1793
 			return $form;
1794 1794
 		}
1795 1795
 
1796 1796
 		// Have Conditional Logic pre-fill fields as if the data were default values
1797 1797
 		/** @var GF_Field $field */
1798
-		foreach ( $form['fields'] as &$field ) {
1798
+		foreach ( $form[ 'fields' ] as &$field ) {
1799 1799
 
1800
-			if( 'checkbox' === $field->type ) {
1800
+			if ( 'checkbox' === $field->type ) {
1801 1801
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1802
-				    $input_id = $input['id'];
1802
+				    $input_id = $input[ 'id' ];
1803 1803
 				    $choice = $field->choices[ $key ];
1804 1804
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1805 1805
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1806
-				    if( $match ) {
1807
-				        $field->choices[ $key ]['isSelected'] = true;
1806
+				    if ( $match ) {
1807
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1808 1808
 				    }
1809 1809
 				}
1810 1810
 			} else {
@@ -1812,15 +1812,15 @@  discard block
 block discarded – undo
1812 1812
 				// We need to run through each field to set the default values
1813 1813
 				foreach ( $this->entry as $field_id => $field_value ) {
1814 1814
 
1815
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1815
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1816 1816
 
1817
-				        if( 'list' === $field->type ) {
1817
+				        if ( 'list' === $field->type ) {
1818 1818
 				            $list_rows = maybe_unserialize( $field_value );
1819 1819
 
1820 1820
 				            $list_field_value = array();
1821
-				            foreach ( (array) $list_rows as $row ) {
1822
-				                foreach ( (array) $row as $column ) {
1823
-				                    $list_field_value[] = $column;
1821
+				            foreach ( (array)$list_rows as $row ) {
1822
+				                foreach ( (array)$row as $column ) {
1823
+				                    $list_field_value[ ] = $column;
1824 1824
 				                }
1825 1825
 				            }
1826 1826
 
@@ -1855,16 +1855,16 @@  discard block
 block discarded – undo
1855 1855
 		 */
1856 1856
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1857 1857
 
1858
-		if( $use_conditional_logic ) {
1858
+		if ( $use_conditional_logic ) {
1859 1859
 			return $form;
1860 1860
 		}
1861 1861
 
1862
-		foreach( $form['fields'] as &$field ) {
1862
+		foreach ( $form[ 'fields' ] as &$field ) {
1863 1863
 			/* @var GF_Field $field */
1864 1864
 			$field->conditionalLogic = null;
1865 1865
 		}
1866 1866
 
1867
-		unset( $form['button']['conditionalLogic'] );
1867
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1868 1868
 
1869 1869
 		return $form;
1870 1870
 
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 	 */
1882 1882
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1883 1883
 
1884
-		if( ! $this->is_edit_entry() ) {
1884
+		if ( ! $this->is_edit_entry() ) {
1885 1885
 			return $has_conditional_logic;
1886 1886
 		}
1887 1887
 
@@ -1913,44 +1913,44 @@  discard block
 block discarded – undo
1913 1913
 		 *  2. There are two entries embedded using oEmbed
1914 1914
 		 *  3. One of the entries has just been saved
1915 1915
 		 */
1916
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1916
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1917 1917
 
1918 1918
 			$error = true;
1919 1919
 
1920 1920
 		}
1921 1921
 
1922
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1922
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1923 1923
 
1924 1924
 			$error = true;
1925 1925
 
1926
-		} elseif( ! $this->verify_nonce() ) {
1926
+		} elseif ( ! $this->verify_nonce() ) {
1927 1927
 
1928 1928
 			/**
1929 1929
 			 * If the Entry is embedded, there may be two entries on the same page.
1930 1930
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1931 1931
 			 */
1932
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1932
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1933 1933
 				$error = true;
1934 1934
 			} else {
1935
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1935
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1936 1936
 			}
1937 1937
 
1938 1938
 		}
1939 1939
 
1940
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1941
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1940
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1941
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1942 1942
 		}
1943 1943
 
1944
-		if( $this->entry['status'] === 'trash' ) {
1945
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1944
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1945
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1946 1946
 		}
1947 1947
 
1948 1948
 		// No errors; everything's fine here!
1949
-		if( empty( $error ) ) {
1949
+		if ( empty( $error ) ) {
1950 1950
 			return true;
1951 1951
 		}
1952 1952
 
1953
-		if( $echo && $error !== true ) {
1953
+		if ( $echo && $error !== true ) {
1954 1954
 
1955 1955
 	        $error = esc_html( $error );
1956 1956
 
@@ -1958,10 +1958,10 @@  discard block
 block discarded – undo
1958 1958
 	         * @since 1.9
1959 1959
 	         */
1960 1960
 	        if ( ! empty( $this->entry ) ) {
1961
-		        $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;" ) );
1961
+		        $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;" ) );
1962 1962
 	        }
1963 1963
 
1964
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1964
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1965 1965
 		}
1966 1966
 
1967 1967
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1981,17 +1981,17 @@  discard block
 block discarded – undo
1981 1981
 
1982 1982
 		$error = NULL;
1983 1983
 
1984
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
1985
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
1984
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
1985
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
1986 1986
 		}
1987 1987
 
1988 1988
 		// No errors; everything's fine here!
1989
-		if( empty( $error ) ) {
1989
+		if ( empty( $error ) ) {
1990 1990
 			return true;
1991 1991
 		}
1992 1992
 
1993
-		if( $echo ) {
1994
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1993
+		if ( $echo ) {
1994
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1995 1995
 		}
1996 1996
 
1997 1997
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2012,14 +2012,14 @@  discard block
 block discarded – undo
2012 2012
 	private function check_user_cap_edit_field( $field ) {
2013 2013
 
2014 2014
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2015
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2015
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2016 2016
 			return true;
2017 2017
 		}
2018 2018
 
2019
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2019
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2020 2020
 
2021
-		if( $field_cap ) {
2022
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2021
+		if ( $field_cap ) {
2022
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2023 2023
 		}
2024 2024
 
2025 2025
 		return false;
@@ -2033,17 +2033,17 @@  discard block
 block discarded – undo
2033 2033
 	public function verify_nonce() {
2034 2034
 
2035 2035
 		// Verify form submitted for editing single
2036
-		if( $this->is_edit_entry_submission() ) {
2036
+		if ( $this->is_edit_entry_submission() ) {
2037 2037
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2038 2038
 		}
2039 2039
 
2040 2040
 		// Verify
2041
-		else if( ! $this->is_edit_entry() ) {
2041
+		else if ( ! $this->is_edit_entry() ) {
2042 2042
 			$valid = false;
2043 2043
 		}
2044 2044
 
2045 2045
 		else {
2046
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2046
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2047 2047
 		}
2048 2048
 
2049 2049
 		/**
Please login to merge, or discard this patch.
includes/class-gravityview-html-elements.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
 
43 43
 		$args = wp_parse_args( $args, $defaults );
44 44
 
45
-		$forms = gravityview_get_forms( (bool) $args['active'], (bool) $args['trash'] );
45
+		$forms = gravityview_get_forms( (bool)$args[ 'active' ], (bool)$args[ 'trash' ] );
46 46
 
47
-		if( array() === $args['options'] ) {
47
+		if ( array() === $args[ 'options' ] ) {
48 48
 			foreach ( $forms as $form ) {
49 49
 
50
-				if ( in_array( $form['id'], $args['exclude'] ) ) {
50
+				if ( in_array( $form[ 'id' ], $args[ 'exclude' ] ) ) {
51 51
 					continue;
52 52
 				}
53 53
 
54
-				$args['options'][ $form['id'] ] = esc_html( $form['title'] );
54
+				$args[ 'options' ][ $form[ 'id' ] ] = esc_html( $form[ 'title' ] );
55 55
 			}
56 56
 		}
57 57
 
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
 
84 84
 		$args = wp_parse_args( $args, $defaults );
85 85
 
86
-		if( empty( $args['form_id'] ) ) {
86
+		if ( empty( $args[ 'form_id' ] ) ) {
87 87
 			return '';
88 88
 		}
89 89
 
90
-		$fields = GVCommon::get_sortable_fields_array( $args['form_id'] );
90
+		$fields = GVCommon::get_sortable_fields_array( $args[ 'form_id' ] );
91 91
 
92
-		if( array() === $args['options'] ) {
92
+		if ( array() === $args[ 'options' ] ) {
93 93
 			foreach ( $fields as $field_id => $field ) {
94
-				$args['options'][ $field_id ] = esc_html( $field['label'] );
94
+				$args[ 'options' ][ $field_id ] = esc_html( $field[ 'label' ] );
95 95
 			}
96 96
 		}
97 97
 
@@ -127,43 +127,43 @@  discard block
 block discarded – undo
127 127
 		$args = wp_parse_args( $args, $defaults );
128 128
 
129 129
 		$data_elements = '';
130
-		foreach ( $args['data'] as $key => $value ) {
130
+		foreach ( $args[ 'data' ] as $key => $value ) {
131 131
 			$data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
132 132
 		}
133 133
 
134
-		if( $args['multiple'] ) {
134
+		if ( $args[ 'multiple' ] ) {
135 135
 			$multiple = ' MULTIPLE';
136 136
 		} else {
137 137
 			$multiple = '';
138 138
 		}
139 139
 
140
-		if( $args['placeholder'] ) {
141
-			$placeholder = $args['placeholder'];
140
+		if ( $args[ 'placeholder' ] ) {
141
+			$placeholder = $args[ 'placeholder' ];
142 142
 		} else {
143 143
 			$placeholder = '';
144 144
 		}
145 145
 
146
-		$disabled = $args['disabled'] ? ' disabled="disabled"' : '';
147
-		$class  = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
148
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( str_replace( '-', '_', $args['id'] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"'. $data_elements . '>';
146
+		$disabled = $args[ 'disabled' ] ? ' disabled="disabled"' : '';
147
+		$class  = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args[ 'class' ] ) ) );
148
+		$output = '<select name="' . esc_attr( $args[ 'name' ] ) . '" id="' . esc_attr( str_replace( '-', '_', $args[ 'id' ] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>';
149 149
 
150
-		if ( ! empty( $args['options'] ) ) {
150
+		if ( ! empty( $args[ 'options' ] ) ) {
151 151
 
152
-			if ( $args['show_option_none'] ) {
153
-				if( $args['multiple'] ) {
154
-					$selected = selected( true, in_array( -1, $args['selected'] ), false );
152
+			if ( $args[ 'show_option_none' ] ) {
153
+				if ( $args[ 'multiple' ] ) {
154
+					$selected = selected( true, in_array( -1, $args[ 'selected' ] ), false );
155 155
 				} else {
156
-					$selected = selected( $args['selected'], -1, false );
156
+					$selected = selected( $args[ 'selected' ], -1, false );
157 157
 				}
158
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
158
+				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args[ 'show_option_none' ] ) . '</option>';
159 159
 			}
160 160
 
161
-			foreach( $args['options'] as $key => $option ) {
161
+			foreach ( $args[ 'options' ] as $key => $option ) {
162 162
 
163
-				if( $args['multiple'] && is_array( $args['selected'] ) ) {
164
-					$selected = selected( true, in_array( $key, $args['selected'], true ), false );
163
+				if ( $args[ 'multiple' ] && is_array( $args[ 'selected' ] ) ) {
164
+					$selected = selected( true, in_array( $key, $args[ 'selected' ], true ), false );
165 165
 				} else {
166
-					$selected = selected( $args['selected'], $key, false );
166
+					$selected = selected( $args[ 'selected' ], $key, false );
167 167
 				}
168 168
 
169 169
 				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-ultimate-member.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 	function parse_um_profile_post_content( $args = array() ) {
44 44
 		global $ultimatemember;
45 45
 
46
-		if( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) {
46
+		if ( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) {
47 47
 			return;
48 48
 		}
49 49
 
50 50
 		// @todo Support Ultimate Member 2.0 - for now, prevent fatal error
51
-		if( ! isset( $ultimatemember->profile ) ) {
51
+		if ( ! isset( $ultimatemember->profile ) ) {
52 52
 			return;
53 53
 		}
54 54
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			return;
65 65
 		}
66 66
 
67
-		GravityView_View_Data::getInstance()->parse_post_content( $active_tab[0]->post_content );
67
+		GravityView_View_Data::getInstance()->parse_post_content( $active_tab[ 0 ]->post_content );
68 68
 
69 69
 		wp_reset_postdata();
70 70
 	}
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravity-forms-dropbox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	 */
46 46
 	function filter_file_path( $file_path = '', $file_path_info = array(), $field_settings = array() ) {
47 47
 
48
-		$file_path = str_replace('www.dropbox.com', 'dl.dropboxusercontent.com', $file_path );
48
+		$file_path = str_replace( 'www.dropbox.com', 'dl.dropboxusercontent.com', $file_path );
49 49
 		$file_path = str_replace( '?dl=0', '', $file_path );
50 50
 
51 51
 		return $file_path;
Please login to merge, or discard this patch.
includes/extensions/edit-entry/partials/form-buttons.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 	$labels = array(
31 31
 		'cancel' => __( 'Cancel', 'gravityview' ),
32
-		'submit' => __( 'Update', 'gravityview')
32
+		'submit' => __( 'Update', 'gravityview' )
33 33
 	);
34 34
 
35 35
 	/**
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	$update_tabindex  = GFCommon::get_tabindex();
46 46
 	$cancel_tabindex  = GFCommon::get_tabindex();
47 47
 	?>
48
-	<input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $labels['submit'] ); ?>" name="save" />
48
+	<input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $labels[ 'submit' ] ); ?>" name="save" />
49 49
 
50
-	<a class="btn btn-sm button button-small gv-button-cancel" <?php echo $cancel_tabindex; ?> href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels['cancel'] ); ?></a>
50
+	<a class="btn btn-sm button button-small gv-button-cancel" <?php echo $cancel_tabindex; ?> href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels[ 'cancel' ] ); ?></a>
51 51
 	<?php
52 52
 
53 53
 	/**
@@ -61,5 +61,5 @@  discard block
 block discarded – undo
61 61
 
62 62
 	?>
63 63
 	<input type="hidden" name="action" value="update" />
64
-	<input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" />
64
+	<input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" />
65 65
 </div>
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 <div id="publishing-action">
8 8
 	<?php
9 9
 
10
-    /**
11
-     * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL
12
-     * @since 1.11.1
13
-     * @param string $back_link Existing URL of the Cancel link
14
-     * @param array $form The Gravity Forms form
15
-     * @param array $entry The Gravity Forms entry
16
-     * @param int $view_id The current View ID
17
-     */
18
-    $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id );
10
+	/**
11
+	 * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL
12
+	 * @since 1.11.1
13
+	 * @param string $back_link Existing URL of the Cancel link
14
+	 * @param array $form The Gravity Forms form
15
+	 * @param array $entry The Gravity Forms entry
16
+	 * @param int $view_id The current View ID
17
+	 */
18
+	$back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id );
19 19
 
20 20
 	/**
21 21
 	 * @action `gravityview/edit-entry/publishing-action/before` Triggered before the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container.
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * @action `gravityview/edit-entry/publishing-action/after` Triggered after the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container.
55 55
 	 * @since 1.5.1
56
-     * @since 2.0.13 Added $post_id
56
+	 * @since 2.0.13 Added $post_id
57 57
 	 * @param array $form The Gravity Forms form
58 58
 	 * @param array $entry The Gravity Forms entry
59 59
 	 * @param int $view_id The current View ID
60
-     * @param int $post_id The current Post ID
60
+	 * @param int $post_id The current Post ID
61 61
 	 */
62 62
 	do_action( 'gravityview/edit-entry/publishing-action/after', $object->form, $object->entry, $object->view_id, $object->post_id );
63 63
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-notes.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
 		global $wpdb;
142 142
 
143 143
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' )
144
-		     && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
144
+			 && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
145 145
 			$notes_table = GFFormsModel::get_entry_notes_table_name();
146 146
 		} else {
147 147
 			$notes_table = GFFormsModel::get_lead_notes_table_name();
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		// Make sure the keys are all set
68 68
 		$note = wp_parse_args( $note, $default_note );
69 69
 
70
-		GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) );
70
+		GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) );
71 71
 
72 72
 		// If last_error is empty string, there was no error.
73
-		if( empty( $wpdb->last_error ) ) {
73
+		if ( empty( $wpdb->last_error ) ) {
74 74
 			$return = $wpdb->insert_id;
75 75
 		} else {
76 76
 			$return = new WP_Error( 'gravityview-add-note', $wpdb->last_error );
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public static function delete_notes( $note_ids = array() ) {
98 98
 
99
-		if( !is_array( $note_ids ) ) {
99
+		if ( ! is_array( $note_ids ) ) {
100 100
 
101 101
 			gravityview()->log->error( 'Note IDs not an array. Not processing delete request.', array( 'data' => $note_ids ) );
102 102
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			)
157 157
 		);
158 158
 
159
-		return $results ? $results[0] : false;
159
+		return $results ? $results[ 0 ] : false;
160 160
 	}
161 161
 
162 162
 	/**
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public static function filter_avatar( $avatar = '', $note ) {
171 171
 
172
-		if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
173
-			$avatar =  sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
172
+		if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
173
+			$avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
174 174
 		}
175 175
 
176 176
 		return $avatar;
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-wpml.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 		add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) );
66 66
 
67
-		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') );
67
+		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) );
68 68
 	}
69 69
 
70 70
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	function filter_gravityview_back_link( $link ) {
85 85
 		global $wpml_url_filters;
86 86
 
87
-		if( $wpml_url_filters ) {
87
+		if ( $wpml_url_filters ) {
88 88
 			$link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() );
89 89
 		}
90 90
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	private function remove_url_hooks() {
102 102
 		global $wpml_url_filters;
103 103
 
104
-		if( ! $wpml_url_filters ) {
104
+		if ( ! $wpml_url_filters ) {
105 105
 			return;
106 106
 		}
107 107
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	private function add_url_hooks() {
130 130
 		global $wpml_url_filters;
131 131
 
132
-		if( ! $wpml_url_filters ) {
132
+		if ( ! $wpml_url_filters ) {
133 133
 			return;
134 134
 		}
135 135
 
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 
179 179
 			$this->remove_url_hooks();
180 180
 
181
-			if( $translations ) {
181
+			if ( $translations ) {
182 182
 				foreach ( $languages as $lang_code => $language ) {
183 183
 
184
-					if( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) {
184
+					if ( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) {
185 185
 						continue;
186 186
 					}
187 187
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 							break;
216 216
 					}
217 217
 
218
-					$languages[ $lang_code ]['url'] = $entry_link;
218
+					$languages[ $lang_code ][ 'url' ] = $entry_link;
219 219
 				}
220 220
 			}
221 221
 
Please login to merge, or discard this patch.