Completed
Push — master ( cd1ec1...578283 )
by Zack
243:03 queued 200:08
created
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
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 			// Perform actions normally performed after updating a lead
348 348
 			$this->after_update();
349 349
 
350
-	        /**
350
+			/**
351 351
 			 * Must be AFTER after_update()!
352 352
 			 * @see https://github.com/gravityview/GravityView/issues/764
353 353
 			 */
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 
356 356
 			/**
357 357
 			 * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry
358
-             * @since 2.1 Added $gv_data parameter
358
+			 * @since 2.1 Added $gv_data parameter
359 359
 			 * @param array $form Gravity Forms form array
360 360
 			 * @param string $entry_id Numeric ID of the entry that was updated
361 361
 			 * @param GravityView_Edit_Entry_Render $this This object
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	 * @return void
380 380
 	 */
381 381
 	private function unset_hidden_field_values() {
382
-	    global $wpdb;
382
+		global $wpdb;
383 383
 
384 384
 		/**
385 385
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -401,27 +401,27 @@  discard block
 block discarded – undo
401 401
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
402 402
 		}
403 403
 
404
-	    foreach ( $this->entry as $input_id => $field_value ) {
404
+		foreach ( $this->entry as $input_id => $field_value ) {
405 405
 
406
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
406
+			$field = RGFormsModel::get_field( $this->form, $input_id );
407 407
 
408
-		    // Reset fields that are hidden
409
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
410
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
408
+			// Reset fields that are hidden
409
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
410
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
411 411
 
412
-		        // List fields are stored as empty arrays when empty
413
-			    $empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
412
+				// List fields are stored as empty arrays when empty
413
+				$empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
414 414
 
415
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
415
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
416 416
 
417
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
417
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
418 418
 
419
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
419
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
420 420
 				// after submission
421
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
422
-			    $_POST[ $post_input_id ] = '';
423
-		    }
424
-	    }
421
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
422
+				$_POST[ $post_input_id ] = '';
423
+			}
424
+		}
425 425
 	}
426 426
 
427 427
 	/**
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 
516 516
 		$form = $this->form;
517 517
 
518
-	    /** @var GF_Field $field */
518
+		/** @var GF_Field $field */
519 519
 		foreach( $form['fields'] as $k => &$field ) {
520 520
 
521 521
 			/**
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 
532 532
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
533 533
 				foreach( $field->inputs as $key => $input ) {
534
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
534
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
535 535
 				}
536 536
 			}
537 537
 		}
@@ -552,13 +552,13 @@  discard block
 block discarded – undo
552 552
 			foreach ( $this->fields_with_calculation as $calc_field ) {
553 553
 				$inputs = $calc_field->get_entry_inputs();
554 554
 				if ( is_array( $inputs ) ) {
555
-				    foreach ( $inputs as $input ) {
556
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
557
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
558
-				    }
555
+					foreach ( $inputs as $input ) {
556
+						$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
557
+						$entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
558
+					}
559 559
 				} else {
560
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
561
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
560
+					$input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
561
+					$entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
562 562
 				}
563 563
 			}
564 564
 		}
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
622 622
 
623 623
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
624
-	        $ary = stripslashes_deep( $ary );
624
+			$ary = stripslashes_deep( $ary );
625 625
 			$img_url = \GV\Utils::get( $ary, 0 );
626 626
 
627 627
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 	private function maybe_update_post_fields( $form ) {
695 695
 
696 696
 		if( empty( $this->entry['post_id'] ) ) {
697
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
697
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
698 698
 			return;
699 699
 		}
700 700
 
@@ -729,51 +729,51 @@  discard block
 block discarded – undo
729 729
 
730 730
 				switch( $field->type ) {
731 731
 
732
-				    case 'post_title':
733
-				        $post_title = $value;
734
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
735
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
736
-				        }
737
-				        $updated_post->post_title = $post_title;
738
-				        $updated_post->post_name  = $post_title;
739
-				        unset( $post_title );
740
-				        break;
741
-
742
-				    case 'post_content':
743
-				        $post_content = $value;
744
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
745
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
746
-				        }
747
-				        $updated_post->post_content = $post_content;
748
-				        unset( $post_content );
749
-				        break;
750
-				    case 'post_excerpt':
751
-				        $updated_post->post_excerpt = $value;
752
-				        break;
753
-				    case 'post_tags':
754
-				        wp_set_post_tags( $post_id, $value, false );
755
-				        break;
756
-				    case 'post_category':
757
-				        break;
758
-				    case 'post_custom_field':
732
+					case 'post_title':
733
+						$post_title = $value;
734
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
735
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
736
+						}
737
+						$updated_post->post_title = $post_title;
738
+						$updated_post->post_name  = $post_title;
739
+						unset( $post_title );
740
+						break;
741
+
742
+					case 'post_content':
743
+						$post_content = $value;
744
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
745
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
746
+						}
747
+						$updated_post->post_content = $post_content;
748
+						unset( $post_content );
749
+						break;
750
+					case 'post_excerpt':
751
+						$updated_post->post_excerpt = $value;
752
+						break;
753
+					case 'post_tags':
754
+						wp_set_post_tags( $post_id, $value, false );
755
+						break;
756
+					case 'post_category':
757
+						break;
758
+					case 'post_custom_field':
759 759
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
760 760
 							$value = $value[ $field_id ];
761 761
 						}
762 762
 
763
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
764
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
765
-				        }
763
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
764
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
765
+						}
766 766
 
767
-	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
768
-		                    $value = wp_json_encode( $value );
769
-	                    }
767
+						if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
768
+							$value = wp_json_encode( $value );
769
+						}
770 770
 
771
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
772
-				        break;
771
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
772
+						break;
773 773
 
774
-				    case 'post_image':
775
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
776
-				        break;
774
+					case 'post_image':
775
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
776
+						break;
777 777
 
778 778
 				}
779 779
 
@@ -818,20 +818,20 @@  discard block
 block discarded – undo
818 818
 	 */
819 819
 	private function is_field_json_encoded( $field ) {
820 820
 
821
-	    $json_encoded = false;
821
+		$json_encoded = false;
822 822
 
823 823
 		$input_type = RGFormsModel::get_input_type( $field );
824 824
 
825
-	    // Only certain custom field types are supported
826
-	    switch( $input_type ) {
827
-		    case 'fileupload':
828
-		    case 'list':
829
-		    case 'multiselect':
830
-			    $json_encoded = true;
831
-			    break;
832
-	    }
825
+		// Only certain custom field types are supported
826
+		switch( $input_type ) {
827
+			case 'fileupload':
828
+			case 'list':
829
+			case 'multiselect':
830
+				$json_encoded = true;
831
+				break;
832
+		}
833 833
 
834
-	    return $json_encoded;
834
+		return $json_encoded;
835 835
 	}
836 836
 
837 837
 	/**
@@ -921,14 +921,14 @@  discard block
 block discarded – undo
921 921
 			?><h2 class="gv-edit-entry-title">
922 922
 				<span><?php
923 923
 
924
-				    /**
925
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
926
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
927
-				     * @param GravityView_Edit_Entry_Render $this This object
928
-				     */
929
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
924
+					/**
925
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
926
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
927
+					 * @param GravityView_Edit_Entry_Render $this This object
928
+					 */
929
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
930 930
 
931
-				    echo esc_attr( $edit_entry_title );
931
+					echo esc_attr( $edit_entry_title );
932 932
 			?></span>
933 933
 			</h2>
934 934
 
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 
1038 1038
 		ob_get_clean();
1039 1039
 
1040
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1040
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1041 1041
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1042 1042
 		remove_filter( 'gform_disable_view_counter', '__return_true' );
1043 1043
 		remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 );
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 
1092 1092
 		// for now we don't support Save and Continue feature.
1093 1093
 		if( ! self::$supports_save_and_continue ) {
1094
-	        unset( $form['save'] );
1094
+			unset( $form['save'] );
1095 1095
 		}
1096 1096
 
1097 1097
 		$form = $this->unselect_default_values( $form );
@@ -1118,30 +1118,30 @@  discard block
 block discarded – undo
1118 1118
 			return $field_content;
1119 1119
 		}
1120 1120
 
1121
-        $message = null;
1121
+		$message = null;
1122 1122
 
1123
-        // First, make sure they have the capability to edit the post.
1124
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1123
+		// First, make sure they have the capability to edit the post.
1124
+		if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1125 1125
 
1126
-            /**
1127
-             * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1128
-             * @param string $message The existing "You don't have permission..." text
1129
-             */
1130
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1126
+			/**
1127
+			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1128
+			 * @param string $message The existing "You don't have permission..." text
1129
+			 */
1130
+			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1131 1131
 
1132
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1133
-            /**
1134
-             * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1135
-             * @param string $message The existing "This field is not editable; the post no longer exists." text
1136
-             */
1137
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1138
-        }
1132
+		} elseif( null === get_post( $this->entry['post_id'] ) ) {
1133
+			/**
1134
+			 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1135
+			 * @param string $message The existing "This field is not editable; the post no longer exists." text
1136
+			 */
1137
+			$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1138
+		}
1139 1139
 
1140
-        if( $message ) {
1141
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1142
-        }
1140
+		if( $message ) {
1141
+			$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1142
+		}
1143 1143
 
1144
-        return $field_content;
1144
+		return $field_content;
1145 1145
 	}
1146 1146
 
1147 1147
 	/**
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 			|| ! empty( $field_content )
1170 1170
 			|| in_array( $field->type, array( 'honeypot' ) )
1171 1171
 		) {
1172
-	        return $field_content;
1172
+			return $field_content;
1173 1173
 		}
1174 1174
 
1175 1175
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1177,24 +1177,24 @@  discard block
 block discarded – undo
1177 1177
 
1178 1178
 		$field_value = $this->get_field_value( $field );
1179 1179
 
1180
-	    // Prevent any PHP warnings, like undefined index
1181
-	    ob_start();
1180
+		// Prevent any PHP warnings, like undefined index
1181
+		ob_start();
1182 1182
 
1183
-	    $return = null;
1183
+		$return = null;
1184 1184
 
1185 1185
 		/** @var GravityView_Field $gv_field */
1186 1186
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1187 1187
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1188 1188
 		} else {
1189
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1190
-	    }
1189
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1190
+		}
1191 1191
 
1192
-	    // If there was output, it's an error
1193
-	    $warnings = ob_get_clean();
1192
+		// If there was output, it's an error
1193
+		$warnings = ob_get_clean();
1194 1194
 
1195
-	    if( !empty( $warnings ) ) {
1196
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1197
-	    }
1195
+		if( !empty( $warnings ) ) {
1196
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1197
+		}
1198 1198
 
1199 1199
 		return $return;
1200 1200
 	}
@@ -1229,8 +1229,8 @@  discard block
 block discarded – undo
1229 1229
 				$input_id = strval( $input['id'] );
1230 1230
 				
1231 1231
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1232
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1233
-				    $allow_pre_populated = false;
1232
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1233
+					$allow_pre_populated = false;
1234 1234
 				}
1235 1235
 
1236 1236
 			}
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1255 1255
 				$categories = array();
1256 1256
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1257
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1257
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1258 1258
 				}
1259 1259
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1260 1260
 			}
@@ -1264,25 +1264,25 @@  discard block
 block discarded – undo
1264 1264
 		// if value is empty get the default value if defined
1265 1265
 		$field_value = $field->get_value_default_if_empty( $field_value );
1266 1266
 
1267
-	    /**
1268
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1269
-	     * @since 1.11
1270
-	     * @since 1.20 Added third param
1271
-	     * @param mixed $field_value field value used to populate the input
1272
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1273
-	     * @param GravityView_Edit_Entry_Render $this Current object
1274
-	     */
1275
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1276
-
1277
-	    /**
1278
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1279
-	     * @since 1.17
1280
-	     * @since 1.20 Added third param
1281
-	     * @param mixed $field_value field value used to populate the input
1282
-	     * @param GF_Field $field Gravity Forms field object
1283
-	     * @param GravityView_Edit_Entry_Render $this Current object
1284
-	     */
1285
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1267
+		/**
1268
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1269
+		 * @since 1.11
1270
+		 * @since 1.20 Added third param
1271
+		 * @param mixed $field_value field value used to populate the input
1272
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1273
+		 * @param GravityView_Edit_Entry_Render $this Current object
1274
+		 */
1275
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1276
+
1277
+		/**
1278
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1279
+		 * @since 1.17
1280
+		 * @since 1.20 Added third param
1281
+		 * @param mixed $field_value field value used to populate the input
1282
+		 * @param GF_Field $field Gravity Forms field object
1283
+		 * @param GravityView_Edit_Entry_Render $this Current object
1284
+		 */
1285
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1286 1286
 
1287 1287
 		return $field_value;
1288 1288
 	}
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1310 1310
 			// expects certain field array items to be set.
1311 1311
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1312
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1312
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1313 1313
 			}
1314 1314
 
1315 1315
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1323,61 +1323,61 @@  discard block
 block discarded – undo
1323 1323
 				 */
1324 1324
 				case 'fileupload':
1325 1325
 
1326
-				    // Set the previous value
1327
-				    $entry = $this->get_entry();
1326
+					// Set the previous value
1327
+					$entry = $this->get_entry();
1328 1328
 
1329
-				    $input_name = 'input_'.$field->id;
1330
-				    $form_id = $form['id'];
1329
+					$input_name = 'input_'.$field->id;
1330
+					$form_id = $form['id'];
1331 1331
 
1332
-				    $value = NULL;
1332
+					$value = NULL;
1333 1333
 
1334
-				    // Use the previous entry value as the default.
1335
-				    if( isset( $entry[ $field->id ] ) ) {
1336
-				        $value = $entry[ $field->id ];
1337
-				    }
1334
+					// Use the previous entry value as the default.
1335
+					if( isset( $entry[ $field->id ] ) ) {
1336
+						$value = $entry[ $field->id ];
1337
+					}
1338 1338
 
1339
-				    // If this is a single upload file
1340
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1341
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1342
-				        $value = $file_path['url'];
1339
+					// If this is a single upload file
1340
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1341
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1342
+						$value = $file_path['url'];
1343 1343
 
1344
-				    } else {
1344
+					} else {
1345 1345
 
1346
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1347
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1348
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1346
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1347
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1348
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1349 1349
 
1350
-				    }
1350
+					}
1351 1351
 
1352
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1352
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1353 1353
 
1354
-				        // If there are fresh uploads, process and merge them.
1355
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1356
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1357
-				            $value = empty( $value ) ? '[]' : $value;
1358
-				            $value = stripslashes_deep( $value );
1359
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1360
-				        }
1354
+						// If there are fresh uploads, process and merge them.
1355
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1356
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1357
+							$value = empty( $value ) ? '[]' : $value;
1358
+							$value = stripslashes_deep( $value );
1359
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1360
+						}
1361 1361
 
1362
-				    } else {
1362
+					} else {
1363 1363
 
1364
-				        // A file already exists when editing an entry
1365
-				        // We set this to solve issue when file upload fields are required.
1366
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1364
+						// A file already exists when editing an entry
1365
+						// We set this to solve issue when file upload fields are required.
1366
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1367 1367
 
1368
-				    }
1368
+					}
1369 1369
 
1370
-				    $this->entry[ $input_name ] = $value;
1371
-				    $_POST[ $input_name ] = $value;
1370
+					$this->entry[ $input_name ] = $value;
1371
+					$_POST[ $input_name ] = $value;
1372 1372
 
1373
-				    break;
1373
+					break;
1374 1374
 
1375 1375
 				case 'number':
1376
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1377
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1378
-				        $_POST['input_'.$field->id ] = NULL;
1379
-				    }
1380
-				    break;
1376
+					// Fix "undefined index" issue at line 1286 in form_display.php
1377
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1378
+						$_POST['input_'.$field->id ] = NULL;
1379
+					}
1380
+					break;
1381 1381
 			}
1382 1382
 
1383 1383
 		}
@@ -1462,42 +1462,42 @@  discard block
 block discarded – undo
1462 1462
 				case 'fileupload' :
1463 1463
 				case 'post_image':
1464 1464
 
1465
-				    // in case nothing is uploaded but there are already files saved
1466
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1467
-				        $field->failed_validation = false;
1468
-				        unset( $field->validation_message );
1469
-				    }
1465
+					// in case nothing is uploaded but there are already files saved
1466
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1467
+						$field->failed_validation = false;
1468
+						unset( $field->validation_message );
1469
+					}
1470 1470
 
1471
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1472
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1471
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1472
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1473 1473
 
1474
-				        $input_name = 'input_' . $field->id;
1475
-				        //uploaded
1476
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1474
+						$input_name = 'input_' . $field->id;
1475
+						//uploaded
1476
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1477 1477
 
1478
-				        //existent
1479
-				        $entry = $this->get_entry();
1480
-				        $value = NULL;
1481
-				        if( isset( $entry[ $field->id ] ) ) {
1482
-				            $value = json_decode( $entry[ $field->id ], true );
1483
-				        }
1478
+						//existent
1479
+						$entry = $this->get_entry();
1480
+						$value = NULL;
1481
+						if( isset( $entry[ $field->id ] ) ) {
1482
+							$value = json_decode( $entry[ $field->id ], true );
1483
+						}
1484 1484
 
1485
-				        // count uploaded files and existent entry files
1486
-				        $count_files = count( $file_names ) + count( $value );
1485
+						// count uploaded files and existent entry files
1486
+						$count_files = count( $file_names ) + count( $value );
1487 1487
 
1488
-				        if( $count_files > $field->maxFiles ) {
1489
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1490
-				            $field->failed_validation = 1;
1491
-				            $gv_valid = false;
1488
+						if( $count_files > $field->maxFiles ) {
1489
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1490
+							$field->failed_validation = 1;
1491
+							$gv_valid = false;
1492 1492
 
1493
-				            // in case of error make sure the newest upload files are removed from the upload input
1494
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1495
-				        }
1493
+							// in case of error make sure the newest upload files are removed from the upload input
1494
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1495
+						}
1496 1496
 
1497
-				    }
1497
+					}
1498 1498
 
1499 1499
 
1500
-				    break;
1500
+					break;
1501 1501
 
1502 1502
 			}
1503 1503
 
@@ -1508,47 +1508,47 @@  discard block
 block discarded – undo
1508 1508
 
1509 1509
 				switch ( $field_type ) {
1510 1510
 
1511
-				    // Captchas don't need to be re-entered.
1512
-				    case 'captcha':
1511
+					// Captchas don't need to be re-entered.
1512
+					case 'captcha':
1513 1513
 
1514
-				        // Post Image fields aren't editable, so we un-fail them.
1515
-				    case 'post_image':
1516
-				        $field->failed_validation = false;
1517
-				        unset( $field->validation_message );
1518
-				        break;
1514
+						// Post Image fields aren't editable, so we un-fail them.
1515
+					case 'post_image':
1516
+						$field->failed_validation = false;
1517
+						unset( $field->validation_message );
1518
+						break;
1519 1519
 
1520 1520
 				}
1521 1521
 
1522 1522
 				// You can't continue inside a switch, so we do it after.
1523 1523
 				if( empty( $field->failed_validation ) ) {
1524
-				    continue;
1524
+					continue;
1525 1525
 				}
1526 1526
 
1527 1527
 				// checks if the No Duplicates option is not validating entry against itself, since
1528 1528
 				// we're editing a stored entry, it would also assume it's a duplicate.
1529 1529
 				if( !empty( $field->noDuplicates ) ) {
1530 1530
 
1531
-				    $entry = $this->get_entry();
1531
+					$entry = $this->get_entry();
1532 1532
 
1533
-				    // If the value of the entry is the same as the stored value
1534
-				    // Then we can assume it's not a duplicate, it's the same.
1535
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1536
-				        //if value submitted was not changed, then don't validate
1537
-				        $field->failed_validation = false;
1533
+					// If the value of the entry is the same as the stored value
1534
+					// Then we can assume it's not a duplicate, it's the same.
1535
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1536
+						//if value submitted was not changed, then don't validate
1537
+						$field->failed_validation = false;
1538 1538
 
1539
-				        unset( $field->validation_message );
1539
+						unset( $field->validation_message );
1540 1540
 
1541
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1541
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1542 1542
 
1543
-				        continue;
1544
-				    }
1543
+						continue;
1544
+					}
1545 1545
 				}
1546 1546
 
1547 1547
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1548 1548
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1549
-				    unset( $field->validation_message );
1550
-	                $field->validation_message = false;
1551
-				    continue;
1549
+					unset( $field->validation_message );
1550
+					$field->validation_message = false;
1551
+					continue;
1552 1552
 				}
1553 1553
 
1554 1554
 				$gv_valid = false;
@@ -1612,8 +1612,8 @@  discard block
 block discarded – undo
1612 1612
 		// Hide fields depending on admin settings
1613 1613
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1614 1614
 
1615
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1616
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1615
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1616
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1617 1617
 
1618 1618
 		/**
1619 1619
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1673,11 +1673,11 @@  discard block
 block discarded – undo
1673 1673
 		// The edit tab has been configured, so we loop through to configured settings
1674 1674
 		foreach ( $configured_fields as $configured_field ) {
1675 1675
 
1676
-	        /** @var GF_Field $field */
1677
-	        foreach ( $fields as $field ) {
1676
+			/** @var GF_Field $field */
1677
+			foreach ( $fields as $field ) {
1678 1678
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1679
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1680
-				    break;
1679
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1680
+					break;
1681 1681
 				}
1682 1682
 
1683 1683
 			}
@@ -1733,28 +1733,28 @@  discard block
 block discarded – undo
1733 1733
 	 */
1734 1734
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1735 1735
 
1736
-	    /**
1736
+		/**
1737 1737
 		 * @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
1738
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1739
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1740
-	     * @since 1.9.1
1741
-	     * @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.
1742
-	     * @param array $form GF Form array
1743
-	     * @param int $view_id View ID
1744
-	     */
1745
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1746
-
1747
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1738
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1739
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1740
+		 * @since 1.9.1
1741
+		 * @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.
1742
+		 * @param array $form GF Form array
1743
+		 * @param int $view_id View ID
1744
+		 */
1745
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1746
+
1747
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1748 1748
 			foreach( $fields as $k => $field ) {
1749 1749
 				if( $field->adminOnly ) {
1750
-				    unset( $fields[ $k ] );
1750
+					unset( $fields[ $k ] );
1751 1751
 				}
1752 1752
 			}
1753 1753
 			return $fields;
1754 1754
 		}
1755 1755
 
1756
-	    foreach( $fields as &$field ) {
1757
-		    $field->adminOnly = false;
1756
+		foreach( $fields as &$field ) {
1757
+			$field->adminOnly = false;
1758 1758
 		}
1759 1759
 
1760 1760
 		return $fields;
@@ -1774,13 +1774,13 @@  discard block
 block discarded – undo
1774 1774
 	 */
1775 1775
 	private function unselect_default_values( $form ) {
1776 1776
 
1777
-	    foreach ( $form['fields'] as &$field ) {
1777
+		foreach ( $form['fields'] as &$field ) {
1778 1778
 
1779 1779
 			if ( empty( $field->choices ) ) {
1780
-                continue;
1780
+				continue;
1781 1781
 			}
1782 1782
 
1783
-            foreach ( $field->choices as &$choice ) {
1783
+			foreach ( $field->choices as &$choice ) {
1784 1784
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1785 1785
 					$choice['isSelected'] = false;
1786 1786
 				}
@@ -1817,36 +1817,36 @@  discard block
 block discarded – undo
1817 1817
 
1818 1818
 			if( 'checkbox' === $field->type ) {
1819 1819
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1820
-				    $input_id = $input['id'];
1821
-				    $choice = $field->choices[ $key ];
1822
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1823
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1824
-				    if( $match ) {
1825
-				        $field->choices[ $key ]['isSelected'] = true;
1826
-				    }
1820
+					$input_id = $input['id'];
1821
+					$choice = $field->choices[ $key ];
1822
+					$value = \GV\Utils::get( $this->entry, $input_id );
1823
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1824
+					if( $match ) {
1825
+						$field->choices[ $key ]['isSelected'] = true;
1826
+					}
1827 1827
 				}
1828 1828
 			} else {
1829 1829
 
1830 1830
 				// We need to run through each field to set the default values
1831 1831
 				foreach ( $this->entry as $field_id => $field_value ) {
1832 1832
 
1833
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1833
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1834 1834
 
1835
-				        if( 'list' === $field->type ) {
1836
-				            $list_rows = maybe_unserialize( $field_value );
1835
+						if( 'list' === $field->type ) {
1836
+							$list_rows = maybe_unserialize( $field_value );
1837 1837
 
1838
-				            $list_field_value = array();
1839
-				            foreach ( (array) $list_rows as $row ) {
1840
-				                foreach ( (array) $row as $column ) {
1841
-				                    $list_field_value[] = $column;
1842
-				                }
1843
-				            }
1838
+							$list_field_value = array();
1839
+							foreach ( (array) $list_rows as $row ) {
1840
+								foreach ( (array) $row as $column ) {
1841
+									$list_field_value[] = $column;
1842
+								}
1843
+							}
1844 1844
 
1845
-				            $field->defaultValue = serialize( $list_field_value );
1846
-				        } else {
1847
-				            $field->defaultValue = $field_value;
1848
-				        }
1849
-				    }
1845
+							$field->defaultValue = serialize( $list_field_value );
1846
+						} else {
1847
+							$field->defaultValue = $field_value;
1848
+						}
1849
+					}
1850 1850
 				}
1851 1851
 			}
1852 1852
 		}
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
 			return $has_conditional_logic;
1904 1904
 		}
1905 1905
 
1906
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1906
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1907 1907
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
1908 1908
 	}
1909 1909
 
@@ -1970,14 +1970,14 @@  discard block
 block discarded – undo
1970 1970
 
1971 1971
 		if( $echo && $error !== true ) {
1972 1972
 
1973
-	        $error = esc_html( $error );
1973
+			$error = esc_html( $error );
1974 1974
 
1975
-	        /**
1976
-	         * @since 1.9
1977
-	         */
1978
-	        if ( ! empty( $this->entry ) ) {
1979
-		        $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;" ) );
1980
-	        }
1975
+			/**
1976
+			 * @since 1.9
1977
+			 */
1978
+			if ( ! empty( $this->entry ) ) {
1979
+				$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;" ) );
1980
+			}
1981 1981
 
1982 1982
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1983 1983
 		}
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();
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 			 * @param GravityView_Edit_Entry_Render $this This object
362 362
 			 * @param GravityView_View_Data $gv_data The View data
363 363
 			 */
364
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
364
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
365 365
 
366 366
 		} else {
367 367
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 		 */
390 390
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
391 391
 
392
-		if( ! $unset_hidden_field_values ) {
392
+		if ( ! $unset_hidden_field_values ) {
393 393
 			return;
394 394
 		}
395 395
 
396 396
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
397 397
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
398
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
398
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
399 399
 		} else {
400 400
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
401
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
401
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
402 402
 		}
403 403
 
404 404
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 		}
480 480
 
481 481
 		/** No file is being uploaded. */
482
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
482
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
483 483
 			/** So return the original upload */
484 484
 			return $entry[ $input_id ];
485 485
 		}
@@ -497,11 +497,11 @@  discard block
 block discarded – undo
497 497
 	 * @return mixed
498 498
 	 */
499 499
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
500
-		if( ! $this->is_edit_entry() ) {
500
+		if ( ! $this->is_edit_entry() ) {
501 501
 			return $plupload_init;
502 502
 		}
503 503
 
504
-		$plupload_init['gf_vars']['max_files'] = 0;
504
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
505 505
 
506 506
 		return $plupload_init;
507 507
 	}
@@ -516,22 +516,22 @@  discard block
 block discarded – undo
516 516
 		$form = $this->form;
517 517
 
518 518
 	    /** @var GF_Field $field */
519
-		foreach( $form['fields'] as $k => &$field ) {
519
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
520 520
 
521 521
 			/**
522 522
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
523 523
 			 * @since 1.16.3
524 524
 			 * @var GF_Field $field
525 525
 			 */
526
-			if( $field->has_calculation() ) {
527
-				unset( $form['fields'][ $k ] );
526
+			if ( $field->has_calculation() ) {
527
+				unset( $form[ 'fields' ][ $k ] );
528 528
 			}
529 529
 
530 530
 			$field->adminOnly = false;
531 531
 
532
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
533
-				foreach( $field->inputs as $key => $input ) {
534
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
532
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
533
+				foreach ( $field->inputs as $key => $input ) {
534
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
535 535
 				}
536 536
 			}
537 537
 		}
@@ -545,20 +545,20 @@  discard block
 block discarded – undo
545 545
 		$update = false;
546 546
 
547 547
 		// get the most up to date entry values
548
-		$entry = GFAPI::get_entry( $this->entry['id'] );
548
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
549 549
 
550
-		if( !empty( $this->fields_with_calculation ) ) {
550
+		if ( ! empty( $this->fields_with_calculation ) ) {
551 551
 			$update = true;
552 552
 			foreach ( $this->fields_with_calculation as $calc_field ) {
553 553
 				$inputs = $calc_field->get_entry_inputs();
554 554
 				if ( is_array( $inputs ) ) {
555 555
 				    foreach ( $inputs as $input ) {
556
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
557
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
556
+				        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
557
+				        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
558 558
 				    }
559 559
 				} else {
560
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
561
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
560
+				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
561
+				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
562 562
 				}
563 563
 			}
564 564
 		}
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 
568 568
 			$return_entry = GFAPI::update_entry( $entry );
569 569
 
570
-			if( is_wp_error( $return_entry ) ) {
570
+			if ( is_wp_error( $return_entry ) ) {
571 571
 				gravityview()->log->error( 'Updating the entry calculation fields failed', array( 'data' => $return_entry ) );
572 572
 			} else {
573 573
 				gravityview()->log->debug( 'Updating the entry calculation fields succeeded' );
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 			return;
585 585
 		}
586 586
 
587
-		$entry = GFAPI::get_entry( $this->entry['id'] );
587
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
588 588
 
589 589
 		foreach ( array( 'score', 'percent', 'grade', 'is_pass' ) as $meta ) {
590 590
 			GFQuiz::get_instance()->update_entry_meta( "gfquiz_$meta", $entry, self::$original_form );
@@ -614,19 +614,19 @@  discard block
 block discarded – undo
614 614
 
615 615
 		$input_name = 'input_' . $field_id;
616 616
 
617
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
617
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
618 618
 
619 619
 			// We have a new image
620 620
 
621
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
621
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
622 622
 
623 623
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
624 624
 	        $ary = stripslashes_deep( $ary );
625 625
 			$img_url = \GV\Utils::get( $ary, 0 );
626 626
 
627
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
628
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
629
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
627
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
628
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
629
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
630 630
 
631 631
 			$image_meta = array(
632 632
 				'post_excerpt' => $img_caption,
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 
636 636
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
637 637
 			if ( ! empty( $img_title ) ) {
638
-				$image_meta['post_title'] = $img_title;
638
+				$image_meta[ 'post_title' ] = $img_title;
639 639
 			}
640 640
 
641 641
 			/**
@@ -693,15 +693,15 @@  discard block
 block discarded – undo
693 693
 	 */
694 694
 	private function maybe_update_post_fields( $form ) {
695 695
 
696
-		if( empty( $this->entry['post_id'] ) ) {
696
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
697 697
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
698 698
 			return;
699 699
 		}
700 700
 
701
-		$post_id = $this->entry['post_id'];
701
+		$post_id = $this->entry[ 'post_id' ];
702 702
 
703 703
 		// Security check
704
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
704
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
705 705
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
706 706
 			return;
707 707
 		}
@@ -714,25 +714,25 @@  discard block
 block discarded – undo
714 714
 
715 715
 			$field = RGFormsModel::get_field( $form, $field_id );
716 716
 
717
-			if( ! $field ) {
717
+			if ( ! $field ) {
718 718
 				continue;
719 719
 			}
720 720
 
721
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
721
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
722 722
 
723 723
 				// Get the value of the field, including $_POSTed value
724 724
 				$value = RGFormsModel::get_field_value( $field );
725 725
 
726 726
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
727 727
 				$entry_tmp = $this->entry;
728
-				$entry_tmp["{$field_id}"] = $value;
728
+				$entry_tmp[ "{$field_id}" ] = $value;
729 729
 
730
-				switch( $field->type ) {
730
+				switch ( $field->type ) {
731 731
 
732 732
 				    case 'post_title':
733 733
 				        $post_title = $value;
734 734
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
735
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
735
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
736 736
 				        }
737 737
 				        $updated_post->post_title = $post_title;
738 738
 				        $updated_post->post_name  = $post_title;
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 				    case 'post_content':
743 743
 				        $post_content = $value;
744 744
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
745
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
745
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
746 746
 				        }
747 747
 				        $updated_post->post_content = $post_content;
748 748
 				        unset( $post_content );
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 							$value = $value[ $field_id ];
761 761
 						}
762 762
 
763
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
763
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
764 764
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
765 765
 				        }
766 766
 
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 				}
779 779
 
780 780
 				// update entry after
781
-				$this->entry["{$field_id}"] = $value;
781
+				$this->entry[ "{$field_id}" ] = $value;
782 782
 
783 783
 				$update_entry = true;
784 784
 
@@ -787,11 +787,11 @@  discard block
 block discarded – undo
787 787
 
788 788
 		}
789 789
 
790
-		if( $update_entry ) {
790
+		if ( $update_entry ) {
791 791
 
792 792
 			$return_entry = GFAPI::update_entry( $this->entry );
793 793
 
794
-			if( is_wp_error( $return_entry ) ) {
794
+			if ( is_wp_error( $return_entry ) ) {
795 795
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
796 796
 			} else {
797 797
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 
802 802
 		$return_post = wp_update_post( $updated_post, true );
803 803
 
804
-		if( is_wp_error( $return_post ) ) {
804
+		if ( is_wp_error( $return_post ) ) {
805 805
 			$return_post->add_data( $updated_post, '$updated_post' );
806 806
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
807 807
 		} else {
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 		$input_type = RGFormsModel::get_input_type( $field );
824 824
 
825 825
 	    // Only certain custom field types are supported
826
-	    switch( $input_type ) {
826
+	    switch ( $input_type ) {
827 827
 		    case 'fileupload':
828 828
 		    case 'list':
829 829
 		    case 'multiselect':
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
861 861
 
862 862
 		// replace conditional shortcodes
863
-		if( $do_shortcode ) {
863
+		if ( $do_shortcode ) {
864 864
 			$output = do_shortcode( $output );
865 865
 		}
866 866
 
@@ -879,19 +879,19 @@  discard block
 block discarded – undo
879 879
 	 */
880 880
 	private function after_update() {
881 881
 
882
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
883
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
882
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
883
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
884 884
 
885 885
 		// Re-define the entry now that we've updated it.
886
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
886
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
887 887
 
888 888
 		$entry = GFFormsModel::set_entry_meta( $entry, $this->form );
889 889
 
890 890
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
891 891
 			// We need to clear the cache because Gravity Forms caches the field values, which
892 892
 			// we have just updated.
893
-			foreach ($this->form['fields'] as $key => $field) {
894
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
893
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
894
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
895 895
 			}
896 896
 		}
897 897
 
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 
911 911
 		<div class="gv-edit-entry-wrapper"><?php
912 912
 
913
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
913
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
914 914
 
915 915
 			/**
916 916
 			 * Fixes weird wpautop() issue
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
927 927
 				     * @param GravityView_Edit_Entry_Render $this This object
928 928
 				     */
929
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
929
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
930 930
 
931 931
 				    echo esc_attr( $edit_entry_title );
932 932
 			?></span>
@@ -976,16 +976,16 @@  discard block
 block discarded – undo
976 976
 
977 977
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
978 978
 
979
-			if( ! $this->is_valid ){
979
+			if ( ! $this->is_valid ) {
980 980
 
981 981
 				// Keeping this compatible with Gravity Forms.
982
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
983
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
982
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
983
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
984 984
 
985
-				echo GVCommon::generate_notice( $message , 'gv-error' );
985
+				echo GVCommon::generate_notice( $message, 'gv-error' );
986 986
 
987 987
 			} else {
988
-				$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
988
+				$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
989 989
 
990 990
 				/**
991 991
 				 * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
 				 * @param array $entry Gravity Forms entry array
996 996
 				 * @param string $back_link URL to return to the original entry. @since 1.6
997 997
 				 */
998
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
998
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
999 999
 
1000 1000
 				echo GVCommon::generate_notice( $message );
1001 1001
 			}
@@ -1019,21 +1019,21 @@  discard block
 block discarded – undo
1019 1019
 		 */
1020 1020
 		do_action( 'gravityview/edit-entry/render/before', $this );
1021 1021
 
1022
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1023
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1022
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1023
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1024 1024
 		add_filter( 'gform_disable_view_counter', '__return_true' );
1025 1025
 
1026 1026
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
1027 1027
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1028 1028
 
1029 1029
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1030
-		unset( $_GET['page'] );
1030
+		unset( $_GET[ 'page' ] );
1031 1031
 
1032 1032
 		// TODO: Verify multiple-page forms
1033 1033
 
1034 1034
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1035 1035
 
1036
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1036
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1037 1037
 
1038 1038
 		ob_get_clean();
1039 1039
 
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
 	 * @return string
1060 1060
 	 */
1061 1061
 	public function render_form_buttons() {
1062
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1062
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1063 1063
 	}
1064 1064
 
1065 1065
 
@@ -1079,10 +1079,10 @@  discard block
 block discarded – undo
1079 1079
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1080 1080
 
1081 1081
 		// In case we have validated the form, use it to inject the validation results into the form render
1082
-		if( isset( $this->form_after_validation ) ) {
1082
+		if ( isset( $this->form_after_validation ) ) {
1083 1083
 			$form = $this->form_after_validation;
1084 1084
 		} else {
1085
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1085
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1086 1086
 		}
1087 1087
 
1088 1088
 		$form = $this->filter_conditional_logic( $form );
@@ -1090,8 +1090,8 @@  discard block
 block discarded – undo
1090 1090
 		$form = $this->prefill_conditional_logic( $form );
1091 1091
 
1092 1092
 		// for now we don't support Save and Continue feature.
1093
-		if( ! self::$supports_save_and_continue ) {
1094
-	        unset( $form['save'] );
1093
+		if ( ! self::$supports_save_and_continue ) {
1094
+	        unset( $form[ 'save' ] );
1095 1095
 		}
1096 1096
 
1097 1097
 		$form = $this->unselect_default_values( $form );
@@ -1114,31 +1114,31 @@  discard block
 block discarded – undo
1114 1114
 	 */
1115 1115
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1116 1116
 
1117
-		if( ! GFCommon::is_post_field( $field ) ) {
1117
+		if ( ! GFCommon::is_post_field( $field ) ) {
1118 1118
 			return $field_content;
1119 1119
 		}
1120 1120
 
1121 1121
         $message = null;
1122 1122
 
1123 1123
         // First, make sure they have the capability to edit the post.
1124
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1124
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1125 1125
 
1126 1126
             /**
1127 1127
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1128 1128
              * @param string $message The existing "You don't have permission..." text
1129 1129
              */
1130
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1130
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1131 1131
 
1132
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1132
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1133 1133
             /**
1134 1134
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1135 1135
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1136 1136
              */
1137
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1137
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1138 1138
         }
1139 1139
 
1140
-        if( $message ) {
1141
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1140
+        if ( $message ) {
1141
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1142 1142
         }
1143 1143
 
1144 1144
         return $field_content;
@@ -1162,8 +1162,8 @@  discard block
 block discarded – undo
1162 1162
 
1163 1163
 		// If the form has been submitted, then we don't need to pre-fill the values,
1164 1164
 		// Except for fileupload type and when a field input is overridden- run always!!
1165
-		if(
1166
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1165
+		if (
1166
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1167 1167
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1168 1168
 			&& ! GFCommon::is_product_field( $field->type )
1169 1169
 			|| ! empty( $field_content )
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 	    $return = null;
1184 1184
 
1185 1185
 		/** @var GravityView_Field $gv_field */
1186
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1186
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1187 1187
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1188 1188
 		} else {
1189 1189
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 	    // If there was output, it's an error
1193 1193
 	    $warnings = ob_get_clean();
1194 1194
 
1195
-	    if( !empty( $warnings ) ) {
1195
+	    if ( ! empty( $warnings ) ) {
1196 1196
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1197 1197
 	    }
1198 1198
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1218 1218
 
1219 1219
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1220
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1220
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1221 1221
 
1222 1222
 			$field_value = array();
1223 1223
 
@@ -1226,10 +1226,10 @@  discard block
 block discarded – undo
1226 1226
 
1227 1227
 			foreach ( (array)$field->inputs as $input ) {
1228 1228
 
1229
-				$input_id = strval( $input['id'] );
1229
+				$input_id = strval( $input[ 'id' ] );
1230 1230
 				
1231 1231
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1232
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1232
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1233 1233
 				    $allow_pre_populated = false;
1234 1234
 				}
1235 1235
 
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
 			$pre_value = $field->get_value_submission( array(), false );
1239 1239
 
1240
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1240
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1241 1241
 
1242 1242
 		} else {
1243 1243
 
@@ -1248,13 +1248,13 @@  discard block
 block discarded – undo
1248 1248
 
1249 1249
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1250 1250
 			// or pre-populated value if not empty and set to override saved value
1251
-			$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;
1251
+			$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;
1252 1252
 
1253 1253
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1254
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1254
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1255 1255
 				$categories = array();
1256 1256
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1257
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1257
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1258 1258
 				}
1259 1259
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1260 1260
 			}
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
 	     * @param GF_Field $field Gravity Forms field object
1283 1283
 	     * @param GravityView_Edit_Entry_Render $this Current object
1284 1284
 	     */
1285
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1285
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1286 1286
 
1287 1287
 		return $field_value;
1288 1288
 	}
@@ -1299,12 +1299,12 @@  discard block
 block discarded – undo
1299 1299
 	 */
1300 1300
 	public function gform_pre_validation( $form ) {
1301 1301
 
1302
-		if( ! $this->verify_nonce() ) {
1302
+		if ( ! $this->verify_nonce() ) {
1303 1303
 			return $form;
1304 1304
 		}
1305 1305
 
1306 1306
 		// Fix PHP warning regarding undefined index.
1307
-		foreach ( $form['fields'] as &$field) {
1307
+		foreach ( $form[ 'fields' ] as &$field ) {
1308 1308
 
1309 1309
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1310 1310
 			// expects certain field array items to be set.
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1313 1313
 			}
1314 1314
 
1315
-			switch( RGFormsModel::get_input_type( $field ) ) {
1315
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1316 1316
 
1317 1317
 				/**
1318 1318
 				 * 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.
@@ -1326,26 +1326,26 @@  discard block
 block discarded – undo
1326 1326
 				    // Set the previous value
1327 1327
 				    $entry = $this->get_entry();
1328 1328
 
1329
-				    $input_name = 'input_'.$field->id;
1330
-				    $form_id = $form['id'];
1329
+				    $input_name = 'input_' . $field->id;
1330
+				    $form_id = $form[ 'id' ];
1331 1331
 
1332 1332
 				    $value = NULL;
1333 1333
 
1334 1334
 				    // Use the previous entry value as the default.
1335
-				    if( isset( $entry[ $field->id ] ) ) {
1335
+				    if ( isset( $entry[ $field->id ] ) ) {
1336 1336
 				        $value = $entry[ $field->id ];
1337 1337
 				    }
1338 1338
 
1339 1339
 				    // If this is a single upload file
1340
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1341
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1342
-				        $value = $file_path['url'];
1340
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1341
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1342
+				        $value = $file_path[ 'url' ];
1343 1343
 
1344 1344
 				    } else {
1345 1345
 
1346 1346
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1347 1347
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1348
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1348
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1349 1349
 
1350 1350
 				    }
1351 1351
 
@@ -1353,10 +1353,10 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
 				        // If there are fresh uploads, process and merge them.
1355 1355
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1356
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1356
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1357 1357
 				            $value = empty( $value ) ? '[]' : $value;
1358 1358
 				            $value = stripslashes_deep( $value );
1359
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1359
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1360 1360
 				        }
1361 1361
 
1362 1362
 				    } else {
@@ -1374,8 +1374,8 @@  discard block
 block discarded – undo
1374 1374
 
1375 1375
 				case 'number':
1376 1376
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1377
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1378
-				        $_POST['input_'.$field->id ] = NULL;
1377
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1378
+				        $_POST[ 'input_' . $field->id ] = NULL;
1379 1379
 				    }
1380 1380
 				    break;
1381 1381
 			}
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 		 * You can enter whatever you want!
1413 1413
 		 * We try validating, and customize the results using `self::custom_validation()`
1414 1414
 		 */
1415
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1415
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1416 1416
 
1417 1417
 		// Needed by the validate funtion
1418 1418
 		$failed_validation_page = NULL;
@@ -1420,14 +1420,14 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
 		// Prevent entry limit from running when editing an entry, also
1422 1422
 		// prevent form scheduling from preventing editing
1423
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1423
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1424 1424
 
1425 1425
 		// Hide fields depending on Edit Entry settings
1426
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1426
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1427 1427
 
1428 1428
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1429 1429
 
1430
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1430
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1431 1431
 	}
1432 1432
 
1433 1433
 
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
 
1451 1451
 		$gv_valid = true;
1452 1452
 
1453
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1453
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1454 1454
 
1455 1455
 			$value = RGFormsModel::get_field_value( $field );
1456 1456
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1463,35 +1463,35 @@  discard block
 block discarded – undo
1463 1463
 				case 'post_image':
1464 1464
 
1465 1465
 				    // in case nothing is uploaded but there are already files saved
1466
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1466
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1467 1467
 				        $field->failed_validation = false;
1468 1468
 				        unset( $field->validation_message );
1469 1469
 				    }
1470 1470
 
1471 1471
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1472
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1472
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1473 1473
 
1474 1474
 				        $input_name = 'input_' . $field->id;
1475 1475
 				        //uploaded
1476
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1476
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1477 1477
 
1478 1478
 				        //existent
1479 1479
 				        $entry = $this->get_entry();
1480 1480
 				        $value = NULL;
1481
-				        if( isset( $entry[ $field->id ] ) ) {
1481
+				        if ( isset( $entry[ $field->id ] ) ) {
1482 1482
 				            $value = json_decode( $entry[ $field->id ], true );
1483 1483
 				        }
1484 1484
 
1485 1485
 				        // count uploaded files and existent entry files
1486 1486
 				        $count_files = count( $file_names ) + count( $value );
1487 1487
 
1488
-				        if( $count_files > $field->maxFiles ) {
1488
+				        if ( $count_files > $field->maxFiles ) {
1489 1489
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1490 1490
 				            $field->failed_validation = 1;
1491 1491
 				            $gv_valid = false;
1492 1492
 
1493 1493
 				            // in case of error make sure the newest upload files are removed from the upload input
1494
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1494
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1495 1495
 				        }
1496 1496
 
1497 1497
 				    }
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 			}
1503 1503
 
1504 1504
 			// This field has failed validation.
1505
-			if( !empty( $field->failed_validation ) ) {
1505
+			if ( ! empty( $field->failed_validation ) ) {
1506 1506
 
1507 1507
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1508 1508
 
@@ -1520,19 +1520,19 @@  discard block
 block discarded – undo
1520 1520
 				}
1521 1521
 
1522 1522
 				// You can't continue inside a switch, so we do it after.
1523
-				if( empty( $field->failed_validation ) ) {
1523
+				if ( empty( $field->failed_validation ) ) {
1524 1524
 				    continue;
1525 1525
 				}
1526 1526
 
1527 1527
 				// checks if the No Duplicates option is not validating entry against itself, since
1528 1528
 				// we're editing a stored entry, it would also assume it's a duplicate.
1529
-				if( !empty( $field->noDuplicates ) ) {
1529
+				if ( ! empty( $field->noDuplicates ) ) {
1530 1530
 
1531 1531
 				    $entry = $this->get_entry();
1532 1532
 
1533 1533
 				    // If the value of the entry is the same as the stored value
1534 1534
 				    // Then we can assume it's not a duplicate, it's the same.
1535
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1535
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1536 1536
 				        //if value submitted was not changed, then don't validate
1537 1537
 				        $field->failed_validation = false;
1538 1538
 
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 				}
1546 1546
 
1547 1547
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1548
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1548
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1549 1549
 				    unset( $field->validation_message );
1550 1550
 	                $field->validation_message = false;
1551 1551
 				    continue;
@@ -1557,12 +1557,12 @@  discard block
 block discarded – undo
1557 1557
 
1558 1558
 		}
1559 1559
 
1560
-		$validation_results['is_valid'] = $gv_valid;
1560
+		$validation_results[ 'is_valid' ] = $gv_valid;
1561 1561
 
1562 1562
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1563 1563
 
1564 1564
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1565
-		$this->form_after_validation = $validation_results['form'];
1565
+		$this->form_after_validation = $validation_results[ 'form' ];
1566 1566
 
1567 1567
 		return $validation_results;
1568 1568
 	}
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
 	 */
1576 1576
 	public function get_entry() {
1577 1577
 
1578
-		if( empty( $this->entry ) ) {
1578
+		if ( empty( $this->entry ) ) {
1579 1579
 			// Get the database value of the entry that's being edited
1580 1580
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1581 1581
 		}
@@ -1607,10 +1607,10 @@  discard block
 block discarded – undo
1607 1607
 		}
1608 1608
 
1609 1609
 		// If edit tab not yet configured, show all fields
1610
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1610
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1611 1611
 
1612 1612
 		// Hide fields depending on admin settings
1613
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1613
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1614 1614
 
1615 1615
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1616 1616
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
 	 */
1643 1643
 	private function filter_fields( $fields, $configured_fields ) {
1644 1644
 
1645
-		if( empty( $fields ) || !is_array( $fields ) ) {
1645
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1646 1646
 			return $fields;
1647 1647
 		}
1648 1648
 
@@ -1655,18 +1655,18 @@  discard block
 block discarded – undo
1655 1655
 
1656 1656
 			// Remove the fields that have calculation properties and keep them to be used later
1657 1657
 			// @since 1.16.2
1658
-			if( $field->has_calculation() ) {
1659
-				$this->fields_with_calculation[] = $field;
1658
+			if ( $field->has_calculation() ) {
1659
+				$this->fields_with_calculation[ ] = $field;
1660 1660
 				// don't remove the calculation fields on form render.
1661 1661
 			}
1662 1662
 
1663
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1663
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1664 1664
 				unset( $fields[ $key ] );
1665 1665
 			}
1666 1666
 		}
1667 1667
 
1668 1668
 		// The Edit tab has not been configured, so we return all fields by default.
1669
-		if( empty( $configured_fields ) ) {
1669
+		if ( empty( $configured_fields ) ) {
1670 1670
 			return $fields;
1671 1671
 		}
1672 1672
 
@@ -1675,8 +1675,8 @@  discard block
 block discarded – undo
1675 1675
 
1676 1676
 	        /** @var GF_Field $field */
1677 1677
 	        foreach ( $fields as $field ) {
1678
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1679
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1678
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1679
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1680 1680
 				    break;
1681 1681
 				}
1682 1682
 
@@ -1699,14 +1699,14 @@  discard block
 block discarded – undo
1699 1699
 
1700 1700
 		$return_field = $field;
1701 1701
 
1702
-		if( empty( $field_setting['show_label'] ) ) {
1702
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1703 1703
 			$return_field->label = '';
1704
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1705
-			$return_field->label = $field_setting['custom_label'];
1704
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1705
+			$return_field->label = $field_setting[ 'custom_label' ];
1706 1706
 		}
1707 1707
 
1708
-		if( !empty( $field_setting['custom_class'] ) ) {
1709
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1708
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1709
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1710 1710
 		}
1711 1711
 
1712 1712
 		/**
@@ -1744,16 +1744,16 @@  discard block
 block discarded – undo
1744 1744
 	     */
1745 1745
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1746 1746
 
1747
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1748
-			foreach( $fields as $k => $field ) {
1749
-				if( $field->adminOnly ) {
1747
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1748
+			foreach ( $fields as $k => $field ) {
1749
+				if ( $field->adminOnly ) {
1750 1750
 				    unset( $fields[ $k ] );
1751 1751
 				}
1752 1752
 			}
1753 1753
 			return $fields;
1754 1754
 		}
1755 1755
 
1756
-	    foreach( $fields as &$field ) {
1756
+	    foreach ( $fields as &$field ) {
1757 1757
 		    $field->adminOnly = false;
1758 1758
 		}
1759 1759
 
@@ -1774,7 +1774,7 @@  discard block
 block discarded – undo
1774 1774
 	 */
1775 1775
 	private function unselect_default_values( $form ) {
1776 1776
 
1777
-	    foreach ( $form['fields'] as &$field ) {
1777
+	    foreach ( $form[ 'fields' ] as &$field ) {
1778 1778
 
1779 1779
 			if ( empty( $field->choices ) ) {
1780 1780
                 continue;
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
 
1783 1783
             foreach ( $field->choices as &$choice ) {
1784 1784
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1785
-					$choice['isSelected'] = false;
1785
+					$choice[ 'isSelected' ] = false;
1786 1786
 				}
1787 1787
 			}
1788 1788
 		}
@@ -1807,22 +1807,22 @@  discard block
 block discarded – undo
1807 1807
 	 */
1808 1808
 	function prefill_conditional_logic( $form ) {
1809 1809
 
1810
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1810
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1811 1811
 			return $form;
1812 1812
 		}
1813 1813
 
1814 1814
 		// Have Conditional Logic pre-fill fields as if the data were default values
1815 1815
 		/** @var GF_Field $field */
1816
-		foreach ( $form['fields'] as &$field ) {
1816
+		foreach ( $form[ 'fields' ] as &$field ) {
1817 1817
 
1818
-			if( 'checkbox' === $field->type ) {
1818
+			if ( 'checkbox' === $field->type ) {
1819 1819
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1820
-				    $input_id = $input['id'];
1820
+				    $input_id = $input[ 'id' ];
1821 1821
 				    $choice = $field->choices[ $key ];
1822 1822
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1823 1823
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1824
-				    if( $match ) {
1825
-				        $field->choices[ $key ]['isSelected'] = true;
1824
+				    if ( $match ) {
1825
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1826 1826
 				    }
1827 1827
 				}
1828 1828
 			} else {
@@ -1830,15 +1830,15 @@  discard block
 block discarded – undo
1830 1830
 				// We need to run through each field to set the default values
1831 1831
 				foreach ( $this->entry as $field_id => $field_value ) {
1832 1832
 
1833
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1833
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1834 1834
 
1835
-				        if( 'list' === $field->type ) {
1835
+				        if ( 'list' === $field->type ) {
1836 1836
 				            $list_rows = maybe_unserialize( $field_value );
1837 1837
 
1838 1838
 				            $list_field_value = array();
1839
-				            foreach ( (array) $list_rows as $row ) {
1840
-				                foreach ( (array) $row as $column ) {
1841
-				                    $list_field_value[] = $column;
1839
+				            foreach ( (array)$list_rows as $row ) {
1840
+				                foreach ( (array)$row as $column ) {
1841
+				                    $list_field_value[ ] = $column;
1842 1842
 				                }
1843 1843
 				            }
1844 1844
 
@@ -1873,16 +1873,16 @@  discard block
 block discarded – undo
1873 1873
 		 */
1874 1874
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1875 1875
 
1876
-		if( $use_conditional_logic ) {
1876
+		if ( $use_conditional_logic ) {
1877 1877
 			return $form;
1878 1878
 		}
1879 1879
 
1880
-		foreach( $form['fields'] as &$field ) {
1880
+		foreach ( $form[ 'fields' ] as &$field ) {
1881 1881
 			/* @var GF_Field $field */
1882 1882
 			$field->conditionalLogic = null;
1883 1883
 		}
1884 1884
 
1885
-		unset( $form['button']['conditionalLogic'] );
1885
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1886 1886
 
1887 1887
 		return $form;
1888 1888
 
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
 	 */
1900 1900
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1901 1901
 
1902
-		if( ! $this->is_edit_entry() ) {
1902
+		if ( ! $this->is_edit_entry() ) {
1903 1903
 			return $has_conditional_logic;
1904 1904
 		}
1905 1905
 
@@ -1931,44 +1931,44 @@  discard block
 block discarded – undo
1931 1931
 		 *  2. There are two entries embedded using oEmbed
1932 1932
 		 *  3. One of the entries has just been saved
1933 1933
 		 */
1934
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1934
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1935 1935
 
1936 1936
 			$error = true;
1937 1937
 
1938 1938
 		}
1939 1939
 
1940
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1940
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1941 1941
 
1942 1942
 			$error = true;
1943 1943
 
1944
-		} elseif( ! $this->verify_nonce() ) {
1944
+		} elseif ( ! $this->verify_nonce() ) {
1945 1945
 
1946 1946
 			/**
1947 1947
 			 * If the Entry is embedded, there may be two entries on the same page.
1948 1948
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1949 1949
 			 */
1950
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1950
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1951 1951
 				$error = true;
1952 1952
 			} else {
1953
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1953
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1954 1954
 			}
1955 1955
 
1956 1956
 		}
1957 1957
 
1958
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1959
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1958
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1959
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1960 1960
 		}
1961 1961
 
1962
-		if( $this->entry['status'] === 'trash' ) {
1963
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1962
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1963
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1964 1964
 		}
1965 1965
 
1966 1966
 		// No errors; everything's fine here!
1967
-		if( empty( $error ) ) {
1967
+		if ( empty( $error ) ) {
1968 1968
 			return true;
1969 1969
 		}
1970 1970
 
1971
-		if( $echo && $error !== true ) {
1971
+		if ( $echo && $error !== true ) {
1972 1972
 
1973 1973
 	        $error = esc_html( $error );
1974 1974
 
@@ -1976,10 +1976,10 @@  discard block
 block discarded – undo
1976 1976
 	         * @since 1.9
1977 1977
 	         */
1978 1978
 	        if ( ! empty( $this->entry ) ) {
1979
-		        $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;" ) );
1979
+		        $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;" ) );
1980 1980
 	        }
1981 1981
 
1982
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1982
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1983 1983
 		}
1984 1984
 
1985 1985
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1999,17 +1999,17 @@  discard block
 block discarded – undo
1999 1999
 
2000 2000
 		$error = NULL;
2001 2001
 
2002
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2003
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2002
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2003
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2004 2004
 		}
2005 2005
 
2006 2006
 		// No errors; everything's fine here!
2007
-		if( empty( $error ) ) {
2007
+		if ( empty( $error ) ) {
2008 2008
 			return true;
2009 2009
 		}
2010 2010
 
2011
-		if( $echo ) {
2012
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2011
+		if ( $echo ) {
2012
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2013 2013
 		}
2014 2014
 
2015 2015
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2030,14 +2030,14 @@  discard block
 block discarded – undo
2030 2030
 	private function check_user_cap_edit_field( $field ) {
2031 2031
 
2032 2032
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2033
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2033
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2034 2034
 			return true;
2035 2035
 		}
2036 2036
 
2037
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2037
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2038 2038
 
2039
-		if( $field_cap ) {
2040
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2039
+		if ( $field_cap ) {
2040
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2041 2041
 		}
2042 2042
 
2043 2043
 		return false;
@@ -2051,17 +2051,17 @@  discard block
 block discarded – undo
2051 2051
 	public function verify_nonce() {
2052 2052
 
2053 2053
 		// Verify form submitted for editing single
2054
-		if( $this->is_edit_entry_submission() ) {
2054
+		if ( $this->is_edit_entry_submission() ) {
2055 2055
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2056 2056
 		}
2057 2057
 
2058 2058
 		// Verify
2059
-		else if( ! $this->is_edit_entry() ) {
2059
+		else if ( ! $this->is_edit_entry() ) {
2060 2060
 			$valid = false;
2061 2061
 		}
2062 2062
 
2063 2063
 		else {
2064
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2064
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2065 2065
 		}
2066 2066
 
2067 2067
 		/**
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.
includes/fields/class-gravityview-field-hidden.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	function edit_entry_fix_hidden_fields( $fields ) {
50 50
 
51 51
 		/** @var GF_Field $field */
52
-		foreach( $fields as &$field ) {
52
+		foreach ( $fields as &$field ) {
53 53
 			if ( 'hidden' === $field->type ) {
54 54
 
55 55
 				/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 				 */
61 61
 				$reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', true, $field );
62 62
 
63
-				if( ! $reveal_hidden_field ) {
63
+				if ( ! $reveal_hidden_field ) {
64 64
 					continue;
65 65
 				}
66 66
 
Please login to merge, or discard this patch.