Completed
Push — develop ( fd8780...ea9883 )
by Gennady
15:47
created
includes/extensions/edit-entry/class-edit-entry-render.php 4 patches
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.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 
977 977
 			$back_link = 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 982
 				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
@@ -2058,9 +2058,7 @@  discard block
 block discarded – undo
2058 2058
 		// Verify
2059 2059
 		else if( ! $this->is_edit_entry() ) {
2060 2060
 			$valid = false;
2061
-		}
2062
-
2063
-		else {
2061
+		} else {
2064 2062
 			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2065 2063
 		}
2066 2064
 
Please login to merge, or discard this patch.
Indentation   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 
95 95
 	/**
96 96
 	 * ID of the current post. May also be ID of the current View.
97
-     *
98
-     * @since 2.0.13
99
-     * 
100
-     * @var int
97
+	 *
98
+	 * @since 2.0.13
99
+	 * 
100
+	 * @var int
101 101
 	 */
102 102
 	public $post_id;
103 103
 
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171 171
 		if( ! empty( $_POST ) ) {
172
-	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
172
+			gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175 175
 		if( $this->is_edit_entry_submission() ) {
176 176
 			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
177
+			remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	 * When Edit entry view is requested setup the vars
203 203
 	 */
204 204
 	private function setup_vars() {
205
-        global $post;
205
+		global $post;
206 206
 
207 207
 		$gravityview_view = GravityView_View::getInstance();
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+		self::$original_entry = $entries[0];
212
+		$this->entry = $entries[0];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 
334 334
 			GFFormsModel::save_lead( $form, $this->entry );
335 335
 
336
-	        // Delete the values for hidden inputs
337
-	        $this->unset_hidden_field_values();
336
+			// Delete the values for hidden inputs
337
+			$this->unset_hidden_field_values();
338 338
 			
339 339
 			$this->entry['date_created'] = $date_created;
340 340
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			// Perform actions normally performed after updating a lead
345 345
 			$this->after_update();
346 346
 
347
-	        /**
347
+			/**
348 348
 			 * Must be AFTER after_update()!
349 349
 			 * @see https://github.com/gravityview/GravityView/issues/764
350 350
 			 */
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 			/**
354 354
 			 * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry
355
-             * @since 2.1 Added $gv_data parameter
355
+			 * @since 2.1 Added $gv_data parameter
356 356
 			 * @param array $form Gravity Forms form array
357 357
 			 * @param string $entry_id Numeric ID of the entry that was updated
358 358
 			 * @param GravityView_Edit_Entry_Render $this This object
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 * @return void
377 377
 	 */
378 378
 	private function unset_hidden_field_values() {
379
-	    global $wpdb;
379
+		global $wpdb;
380 380
 
381 381
 		/**
382 382
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -398,27 +398,27 @@  discard block
 block discarded – undo
398 398
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
399 399
 		}
400 400
 
401
-	    foreach ( $this->entry as $input_id => $field_value ) {
401
+		foreach ( $this->entry as $input_id => $field_value ) {
402 402
 
403
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
403
+			$field = RGFormsModel::get_field( $this->form, $input_id );
404 404
 
405
-		    // Reset fields that are hidden
406
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
407
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
405
+			// Reset fields that are hidden
406
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
407
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
408 408
 
409
-		        // List fields are stored as empty arrays when empty
410
-			    $empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
409
+				// List fields are stored as empty arrays when empty
410
+				$empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
411 411
 
412
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
412
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
413 413
 
414
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
414
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
415 415
 
416
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
416
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
417 417
 				// after submission
418
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
419
-			    $_POST[ $post_input_id ] = '';
420
-		    }
421
-	    }
418
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
419
+				$_POST[ $post_input_id ] = '';
420
+			}
421
+		}
422 422
 	}
423 423
 
424 424
 	/**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 		$form = $this->form;
514 514
 
515
-	    /** @var GF_Field $field */
515
+		/** @var GF_Field $field */
516 516
 		foreach( $form['fields'] as $k => &$field ) {
517 517
 
518 518
 			/**
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 
529 529
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530 530
 				foreach( $field->inputs as $key => $input ) {
531
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
531
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
532 532
 				}
533 533
 			}
534 534
 		}
@@ -560,9 +560,9 @@  discard block
 block discarded – undo
560 560
 			foreach ( $this->fields_with_calculation as $field ) {
561 561
 				$inputs = $field->get_entry_inputs();
562 562
 				if ( is_array( $inputs ) ) {
563
-				    foreach ( $inputs as $input ) {
563
+					foreach ( $inputs as $input ) {
564 564
 						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
565
-				    }
565
+					}
566 566
 				} else {
567 567
 					GFFormsModel::save_input( $form, $field, $entry, $current_fields, $field->id );
568 568
 				}
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
605 605
 
606 606
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
607
-	        $ary = stripslashes_deep( $ary );
607
+			$ary = stripslashes_deep( $ary );
608 608
 			$img_url = \GV\Utils::get( $ary, 0 );
609 609
 
610 610
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	private function maybe_update_post_fields( $form ) {
678 678
 
679 679
 		if( empty( $this->entry['post_id'] ) ) {
680
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
680
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
681 681
 			return;
682 682
 		}
683 683
 
@@ -712,51 +712,51 @@  discard block
 block discarded – undo
712 712
 
713 713
 				switch( $field->type ) {
714 714
 
715
-				    case 'post_title':
716
-				        $post_title = $value;
717
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
718
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
719
-				        }
720
-				        $updated_post->post_title = $post_title;
721
-				        $updated_post->post_name  = $post_title;
722
-				        unset( $post_title );
723
-				        break;
724
-
725
-				    case 'post_content':
726
-				        $post_content = $value;
727
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
728
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
729
-				        }
730
-				        $updated_post->post_content = $post_content;
731
-				        unset( $post_content );
732
-				        break;
733
-				    case 'post_excerpt':
734
-				        $updated_post->post_excerpt = $value;
735
-				        break;
736
-				    case 'post_tags':
737
-				        wp_set_post_tags( $post_id, $value, false );
738
-				        break;
739
-				    case 'post_category':
740
-				        break;
741
-				    case 'post_custom_field':
715
+					case 'post_title':
716
+						$post_title = $value;
717
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
718
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
719
+						}
720
+						$updated_post->post_title = $post_title;
721
+						$updated_post->post_name  = $post_title;
722
+						unset( $post_title );
723
+						break;
724
+
725
+					case 'post_content':
726
+						$post_content = $value;
727
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
728
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
729
+						}
730
+						$updated_post->post_content = $post_content;
731
+						unset( $post_content );
732
+						break;
733
+					case 'post_excerpt':
734
+						$updated_post->post_excerpt = $value;
735
+						break;
736
+					case 'post_tags':
737
+						wp_set_post_tags( $post_id, $value, false );
738
+						break;
739
+					case 'post_category':
740
+						break;
741
+					case 'post_custom_field':
742 742
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
743 743
 							$value = $value[ $field_id ];
744 744
 						}
745 745
 
746
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
747
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
748
-				        }
746
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
747
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
748
+						}
749 749
 
750
-	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
751
-		                    $value = wp_json_encode( $value );
752
-	                    }
750
+						if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
751
+							$value = wp_json_encode( $value );
752
+						}
753 753
 
754
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
755
-				        break;
754
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
755
+						break;
756 756
 
757
-				    case 'post_image':
758
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
759
-				        break;
757
+					case 'post_image':
758
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
759
+						break;
760 760
 
761 761
 				}
762 762
 
@@ -801,20 +801,20 @@  discard block
 block discarded – undo
801 801
 	 */
802 802
 	private function is_field_json_encoded( $field ) {
803 803
 
804
-	    $json_encoded = false;
804
+		$json_encoded = false;
805 805
 
806 806
 		$input_type = RGFormsModel::get_input_type( $field );
807 807
 
808
-	    // Only certain custom field types are supported
809
-	    switch( $input_type ) {
810
-		    case 'fileupload':
811
-		    case 'list':
812
-		    case 'multiselect':
813
-			    $json_encoded = true;
814
-			    break;
815
-	    }
808
+		// Only certain custom field types are supported
809
+		switch( $input_type ) {
810
+			case 'fileupload':
811
+			case 'list':
812
+			case 'multiselect':
813
+				$json_encoded = true;
814
+				break;
815
+		}
816 816
 
817
-	    return $json_encoded;
817
+		return $json_encoded;
818 818
 	}
819 819
 
820 820
 	/**
@@ -904,14 +904,14 @@  discard block
 block discarded – undo
904 904
 			?><h2 class="gv-edit-entry-title">
905 905
 				<span><?php
906 906
 
907
-				    /**
908
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
909
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
910
-				     * @param GravityView_Edit_Entry_Render $this This object
911
-				     */
912
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
907
+					/**
908
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
909
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
910
+					 * @param GravityView_Edit_Entry_Render $this This object
911
+					 */
912
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
913 913
 
914
-				    echo esc_attr( $edit_entry_title );
914
+					echo esc_attr( $edit_entry_title );
915 915
 			?></span>
916 916
 			</h2>
917 917
 
@@ -974,26 +974,26 @@  discard block
 block discarded – undo
974 974
 
975 975
 				switch ( $edit_redirect ) {
976 976
 
977
-                    case '0':
978
-	                    $redirect_url = $back_link;
979
-	                    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturning to Entry%s', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
980
-                        break;
981
-
982
-                    case '1':
983
-	                    $redirect_url = $directory_link = GravityView_API::directory_link();
984
-	                    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturning to %s%s', 'gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
985
-	                    break;
986
-
987
-                    case '2':
988
-	                    $redirect_url = $edit_redirect_url;
989
-	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
990
-	                    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sRedirecting to %s%s', 'gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
991
-                        break;
992
-
993
-                    case '':
994
-                    default:
995
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
996
-                        break;
977
+					case '0':
978
+						$redirect_url = $back_link;
979
+						$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturning to Entry%s', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
980
+						break;
981
+
982
+					case '1':
983
+						$redirect_url = $directory_link = GravityView_API::directory_link();
984
+						$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturning to %s%s', 'gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
985
+						break;
986
+
987
+					case '2':
988
+						$redirect_url = $edit_redirect_url;
989
+						$redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
990
+						$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sRedirecting to %s%s', 'gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
991
+						break;
992
+
993
+					case '':
994
+					default:
995
+						$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
996
+						break;
997 997
 				}
998 998
 
999 999
 				if ( isset( $redirect_url ) ) {
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 		ob_get_clean();
1052 1052
 
1053
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1053
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1054 1054
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1055 1055
 		remove_filter( 'gform_disable_view_counter', '__return_true' );
1056 1056
 		remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 );
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
 		// for now we don't support Save and Continue feature.
1106 1106
 		if( ! self::$supports_save_and_continue ) {
1107
-	        unset( $form['save'] );
1107
+			unset( $form['save'] );
1108 1108
 		}
1109 1109
 
1110 1110
 		$form = $this->unselect_default_values( $form );
@@ -1131,30 +1131,30 @@  discard block
 block discarded – undo
1131 1131
 			return $field_content;
1132 1132
 		}
1133 1133
 
1134
-        $message = null;
1134
+		$message = null;
1135 1135
 
1136
-        // First, make sure they have the capability to edit the post.
1137
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1136
+		// First, make sure they have the capability to edit the post.
1137
+		if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1138 1138
 
1139
-            /**
1140
-             * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1141
-             * @param string $message The existing "You don't have permission..." text
1142
-             */
1143
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1139
+			/**
1140
+			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1141
+			 * @param string $message The existing "You don't have permission..." text
1142
+			 */
1143
+			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1144 1144
 
1145
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1146
-            /**
1147
-             * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1148
-             * @param string $message The existing "This field is not editable; the post no longer exists." text
1149
-             */
1150
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1151
-        }
1145
+		} elseif( null === get_post( $this->entry['post_id'] ) ) {
1146
+			/**
1147
+			 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1148
+			 * @param string $message The existing "This field is not editable; the post no longer exists." text
1149
+			 */
1150
+			$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1151
+		}
1152 1152
 
1153
-        if( $message ) {
1154
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1155
-        }
1153
+		if( $message ) {
1154
+			$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1155
+		}
1156 1156
 
1157
-        return $field_content;
1157
+		return $field_content;
1158 1158
 	}
1159 1159
 
1160 1160
 	/**
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 			|| ! empty( $field_content )
1183 1183
 			|| in_array( $field->type, array( 'honeypot' ) )
1184 1184
 		) {
1185
-	        return $field_content;
1185
+			return $field_content;
1186 1186
 		}
1187 1187
 
1188 1188
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1190,24 +1190,24 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 		$field_value = $this->get_field_value( $field );
1192 1192
 
1193
-	    // Prevent any PHP warnings, like undefined index
1194
-	    ob_start();
1193
+		// Prevent any PHP warnings, like undefined index
1194
+		ob_start();
1195 1195
 
1196
-	    $return = null;
1196
+		$return = null;
1197 1197
 
1198 1198
 		/** @var GravityView_Field $gv_field */
1199 1199
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1200 1200
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1201 1201
 		} else {
1202
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1203
-	    }
1202
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1203
+		}
1204 1204
 
1205
-	    // If there was output, it's an error
1206
-	    $warnings = ob_get_clean();
1205
+		// If there was output, it's an error
1206
+		$warnings = ob_get_clean();
1207 1207
 
1208
-	    if( !empty( $warnings ) ) {
1209
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1210
-	    }
1208
+		if( !empty( $warnings ) ) {
1209
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1210
+		}
1211 1211
 
1212 1212
 		return $return;
1213 1213
 	}
@@ -1242,8 +1242,8 @@  discard block
 block discarded – undo
1242 1242
 				$input_id = strval( $input['id'] );
1243 1243
 				
1244 1244
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1245
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1246
-				    $allow_pre_populated = false;
1245
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1246
+					$allow_pre_populated = false;
1247 1247
 				}
1248 1248
 
1249 1249
 			}
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1268 1268
 				$categories = array();
1269 1269
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1270
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1270
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1271 1271
 				}
1272 1272
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1273 1273
 			}
@@ -1277,25 +1277,25 @@  discard block
 block discarded – undo
1277 1277
 		// if value is empty get the default value if defined
1278 1278
 		$field_value = $field->get_value_default_if_empty( $field_value );
1279 1279
 
1280
-	    /**
1281
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1282
-	     * @since 1.11
1283
-	     * @since 1.20 Added third param
1284
-	     * @param mixed $field_value field value used to populate the input
1285
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1286
-	     * @param GravityView_Edit_Entry_Render $this Current object
1287
-	     */
1288
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1289
-
1290
-	    /**
1291
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1292
-	     * @since 1.17
1293
-	     * @since 1.20 Added third param
1294
-	     * @param mixed $field_value field value used to populate the input
1295
-	     * @param GF_Field $field Gravity Forms field object
1296
-	     * @param GravityView_Edit_Entry_Render $this Current object
1297
-	     */
1298
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1280
+		/**
1281
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1282
+		 * @since 1.11
1283
+		 * @since 1.20 Added third param
1284
+		 * @param mixed $field_value field value used to populate the input
1285
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1286
+		 * @param GravityView_Edit_Entry_Render $this Current object
1287
+		 */
1288
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1289
+
1290
+		/**
1291
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1292
+		 * @since 1.17
1293
+		 * @since 1.20 Added third param
1294
+		 * @param mixed $field_value field value used to populate the input
1295
+		 * @param GF_Field $field Gravity Forms field object
1296
+		 * @param GravityView_Edit_Entry_Render $this Current object
1297
+		 */
1298
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1299 1299
 
1300 1300
 		return $field_value;
1301 1301
 	}
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1323 1323
 			// expects certain field array items to be set.
1324 1324
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1325
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1325
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1326 1326
 			}
1327 1327
 
1328 1328
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1336,61 +1336,61 @@  discard block
 block discarded – undo
1336 1336
 				 */
1337 1337
 				case 'fileupload':
1338 1338
 
1339
-				    // Set the previous value
1340
-				    $entry = $this->get_entry();
1339
+					// Set the previous value
1340
+					$entry = $this->get_entry();
1341 1341
 
1342
-				    $input_name = 'input_'.$field->id;
1343
-				    $form_id = $form['id'];
1342
+					$input_name = 'input_'.$field->id;
1343
+					$form_id = $form['id'];
1344 1344
 
1345
-				    $value = NULL;
1345
+					$value = NULL;
1346 1346
 
1347
-				    // Use the previous entry value as the default.
1348
-				    if( isset( $entry[ $field->id ] ) ) {
1349
-				        $value = $entry[ $field->id ];
1350
-				    }
1347
+					// Use the previous entry value as the default.
1348
+					if( isset( $entry[ $field->id ] ) ) {
1349
+						$value = $entry[ $field->id ];
1350
+					}
1351 1351
 
1352
-				    // If this is a single upload file
1353
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1354
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1355
-				        $value = $file_path['url'];
1352
+					// If this is a single upload file
1353
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1354
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1355
+						$value = $file_path['url'];
1356 1356
 
1357
-				    } else {
1357
+					} else {
1358 1358
 
1359
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1360
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1361
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1359
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1360
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1361
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1362 1362
 
1363
-				    }
1363
+					}
1364 1364
 
1365
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1365
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1366 1366
 
1367
-				        // If there are fresh uploads, process and merge them.
1368
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1369
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1370
-				            $value = empty( $value ) ? '[]' : $value;
1371
-				            $value = stripslashes_deep( $value );
1372
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1373
-				        }
1367
+						// If there are fresh uploads, process and merge them.
1368
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1369
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1370
+							$value = empty( $value ) ? '[]' : $value;
1371
+							$value = stripslashes_deep( $value );
1372
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1373
+						}
1374 1374
 
1375
-				    } else {
1375
+					} else {
1376 1376
 
1377
-				        // A file already exists when editing an entry
1378
-				        // We set this to solve issue when file upload fields are required.
1379
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1377
+						// A file already exists when editing an entry
1378
+						// We set this to solve issue when file upload fields are required.
1379
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1380 1380
 
1381
-				    }
1381
+					}
1382 1382
 
1383
-				    $this->entry[ $input_name ] = $value;
1384
-				    $_POST[ $input_name ] = $value;
1383
+					$this->entry[ $input_name ] = $value;
1384
+					$_POST[ $input_name ] = $value;
1385 1385
 
1386
-				    break;
1386
+					break;
1387 1387
 
1388 1388
 				case 'number':
1389
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1390
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1391
-				        $_POST['input_'.$field->id ] = NULL;
1392
-				    }
1393
-				    break;
1389
+					// Fix "undefined index" issue at line 1286 in form_display.php
1390
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1391
+						$_POST['input_'.$field->id ] = NULL;
1392
+					}
1393
+					break;
1394 1394
 			}
1395 1395
 
1396 1396
 		}
@@ -1475,42 +1475,42 @@  discard block
 block discarded – undo
1475 1475
 				case 'fileupload' :
1476 1476
 				case 'post_image':
1477 1477
 
1478
-				    // in case nothing is uploaded but there are already files saved
1479
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1480
-				        $field->failed_validation = false;
1481
-				        unset( $field->validation_message );
1482
-				    }
1478
+					// in case nothing is uploaded but there are already files saved
1479
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1480
+						$field->failed_validation = false;
1481
+						unset( $field->validation_message );
1482
+					}
1483 1483
 
1484
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1485
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1484
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1485
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1486 1486
 
1487
-				        $input_name = 'input_' . $field->id;
1488
-				        //uploaded
1489
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1487
+						$input_name = 'input_' . $field->id;
1488
+						//uploaded
1489
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1490 1490
 
1491
-				        //existent
1492
-				        $entry = $this->get_entry();
1493
-				        $value = NULL;
1494
-				        if( isset( $entry[ $field->id ] ) ) {
1495
-				            $value = json_decode( $entry[ $field->id ], true );
1496
-				        }
1491
+						//existent
1492
+						$entry = $this->get_entry();
1493
+						$value = NULL;
1494
+						if( isset( $entry[ $field->id ] ) ) {
1495
+							$value = json_decode( $entry[ $field->id ], true );
1496
+						}
1497 1497
 
1498
-				        // count uploaded files and existent entry files
1499
-				        $count_files = count( $file_names ) + count( $value );
1498
+						// count uploaded files and existent entry files
1499
+						$count_files = count( $file_names ) + count( $value );
1500 1500
 
1501
-				        if( $count_files > $field->maxFiles ) {
1502
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1503
-				            $field->failed_validation = 1;
1504
-				            $gv_valid = false;
1501
+						if( $count_files > $field->maxFiles ) {
1502
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1503
+							$field->failed_validation = 1;
1504
+							$gv_valid = false;
1505 1505
 
1506
-				            // in case of error make sure the newest upload files are removed from the upload input
1507
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1508
-				        }
1506
+							// in case of error make sure the newest upload files are removed from the upload input
1507
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1508
+						}
1509 1509
 
1510
-				    }
1510
+					}
1511 1511
 
1512 1512
 
1513
-				    break;
1513
+					break;
1514 1514
 
1515 1515
 			}
1516 1516
 
@@ -1521,47 +1521,47 @@  discard block
 block discarded – undo
1521 1521
 
1522 1522
 				switch ( $field_type ) {
1523 1523
 
1524
-				    // Captchas don't need to be re-entered.
1525
-				    case 'captcha':
1524
+					// Captchas don't need to be re-entered.
1525
+					case 'captcha':
1526 1526
 
1527
-				        // Post Image fields aren't editable, so we un-fail them.
1528
-				    case 'post_image':
1529
-				        $field->failed_validation = false;
1530
-				        unset( $field->validation_message );
1531
-				        break;
1527
+						// Post Image fields aren't editable, so we un-fail them.
1528
+					case 'post_image':
1529
+						$field->failed_validation = false;
1530
+						unset( $field->validation_message );
1531
+						break;
1532 1532
 
1533 1533
 				}
1534 1534
 
1535 1535
 				// You can't continue inside a switch, so we do it after.
1536 1536
 				if( empty( $field->failed_validation ) ) {
1537
-				    continue;
1537
+					continue;
1538 1538
 				}
1539 1539
 
1540 1540
 				// checks if the No Duplicates option is not validating entry against itself, since
1541 1541
 				// we're editing a stored entry, it would also assume it's a duplicate.
1542 1542
 				if( !empty( $field->noDuplicates ) ) {
1543 1543
 
1544
-				    $entry = $this->get_entry();
1544
+					$entry = $this->get_entry();
1545 1545
 
1546
-				    // If the value of the entry is the same as the stored value
1547
-				    // Then we can assume it's not a duplicate, it's the same.
1548
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1549
-				        //if value submitted was not changed, then don't validate
1550
-				        $field->failed_validation = false;
1546
+					// If the value of the entry is the same as the stored value
1547
+					// Then we can assume it's not a duplicate, it's the same.
1548
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1549
+						//if value submitted was not changed, then don't validate
1550
+						$field->failed_validation = false;
1551 1551
 
1552
-				        unset( $field->validation_message );
1552
+						unset( $field->validation_message );
1553 1553
 
1554
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1554
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1555 1555
 
1556
-				        continue;
1557
-				    }
1556
+						continue;
1557
+					}
1558 1558
 				}
1559 1559
 
1560 1560
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1561 1561
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1562
-				    unset( $field->validation_message );
1563
-	                $field->validation_message = false;
1564
-				    continue;
1562
+					unset( $field->validation_message );
1563
+					$field->validation_message = false;
1564
+					continue;
1565 1565
 				}
1566 1566
 
1567 1567
 				$gv_valid = false;
@@ -1625,8 +1625,8 @@  discard block
 block discarded – undo
1625 1625
 		// Hide fields depending on admin settings
1626 1626
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1627 1627
 
1628
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1629
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1628
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1629
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1630 1630
 
1631 1631
 		/**
1632 1632
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1686,11 +1686,11 @@  discard block
 block discarded – undo
1686 1686
 		// The edit tab has been configured, so we loop through to configured settings
1687 1687
 		foreach ( $configured_fields as $configured_field ) {
1688 1688
 
1689
-	        /** @var GF_Field $field */
1690
-	        foreach ( $fields as $field ) {
1689
+			/** @var GF_Field $field */
1690
+			foreach ( $fields as $field ) {
1691 1691
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1692
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1693
-				    break;
1692
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1693
+					break;
1694 1694
 				}
1695 1695
 
1696 1696
 			}
@@ -1746,28 +1746,28 @@  discard block
 block discarded – undo
1746 1746
 	 */
1747 1747
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1748 1748
 
1749
-	    /**
1749
+		/**
1750 1750
 		 * @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
1751
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1752
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1753
-	     * @since 1.9.1
1754
-	     * @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.
1755
-	     * @param array $form GF Form array
1756
-	     * @param int $view_id View ID
1757
-	     */
1758
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1759
-
1760
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1751
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1752
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1753
+		 * @since 1.9.1
1754
+		 * @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.
1755
+		 * @param array $form GF Form array
1756
+		 * @param int $view_id View ID
1757
+		 */
1758
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1759
+
1760
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1761 1761
 			foreach( $fields as $k => $field ) {
1762 1762
 				if( $field->adminOnly ) {
1763
-				    unset( $fields[ $k ] );
1763
+					unset( $fields[ $k ] );
1764 1764
 				}
1765 1765
 			}
1766 1766
 			return array_values( $fields );
1767 1767
 		}
1768 1768
 
1769
-	    foreach( $fields as &$field ) {
1770
-		    $field->adminOnly = false;
1769
+		foreach( $fields as &$field ) {
1770
+			$field->adminOnly = false;
1771 1771
 		}
1772 1772
 
1773 1773
 		return $fields;
@@ -1787,13 +1787,13 @@  discard block
 block discarded – undo
1787 1787
 	 */
1788 1788
 	private function unselect_default_values( $form ) {
1789 1789
 
1790
-	    foreach ( $form['fields'] as &$field ) {
1790
+		foreach ( $form['fields'] as &$field ) {
1791 1791
 
1792 1792
 			if ( empty( $field->choices ) ) {
1793
-                continue;
1793
+				continue;
1794 1794
 			}
1795 1795
 
1796
-            foreach ( $field->choices as &$choice ) {
1796
+			foreach ( $field->choices as &$choice ) {
1797 1797
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1798 1798
 					$choice['isSelected'] = false;
1799 1799
 				}
@@ -1830,36 +1830,36 @@  discard block
 block discarded – undo
1830 1830
 
1831 1831
 			if( 'checkbox' === $field->type ) {
1832 1832
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1833
-				    $input_id = $input['id'];
1834
-				    $choice = $field->choices[ $key ];
1835
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1836
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1837
-				    if( $match ) {
1838
-				        $field->choices[ $key ]['isSelected'] = true;
1839
-				    }
1833
+					$input_id = $input['id'];
1834
+					$choice = $field->choices[ $key ];
1835
+					$value = \GV\Utils::get( $this->entry, $input_id );
1836
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1837
+					if( $match ) {
1838
+						$field->choices[ $key ]['isSelected'] = true;
1839
+					}
1840 1840
 				}
1841 1841
 			} else {
1842 1842
 
1843 1843
 				// We need to run through each field to set the default values
1844 1844
 				foreach ( $this->entry as $field_id => $field_value ) {
1845 1845
 
1846
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1846
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1847 1847
 
1848
-				        if( 'list' === $field->type ) {
1849
-				            $list_rows = maybe_unserialize( $field_value );
1848
+						if( 'list' === $field->type ) {
1849
+							$list_rows = maybe_unserialize( $field_value );
1850 1850
 
1851
-				            $list_field_value = array();
1852
-				            foreach ( (array) $list_rows as $row ) {
1853
-				                foreach ( (array) $row as $column ) {
1854
-				                    $list_field_value[] = $column;
1855
-				                }
1856
-				            }
1851
+							$list_field_value = array();
1852
+							foreach ( (array) $list_rows as $row ) {
1853
+								foreach ( (array) $row as $column ) {
1854
+									$list_field_value[] = $column;
1855
+								}
1856
+							}
1857 1857
 
1858
-				            $field->defaultValue = serialize( $list_field_value );
1859
-				        } else {
1860
-				            $field->defaultValue = $field_value;
1861
-				        }
1862
-				    }
1858
+							$field->defaultValue = serialize( $list_field_value );
1859
+						} else {
1860
+							$field->defaultValue = $field_value;
1861
+						}
1862
+					}
1863 1863
 				}
1864 1864
 			}
1865 1865
 		}
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
 			return $has_conditional_logic;
1917 1917
 		}
1918 1918
 
1919
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1919
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1920 1920
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
1921 1921
 	}
1922 1922
 
@@ -1983,14 +1983,14 @@  discard block
 block discarded – undo
1983 1983
 
1984 1984
 		if( $echo && $error !== true ) {
1985 1985
 
1986
-	        $error = esc_html( $error );
1986
+			$error = esc_html( $error );
1987 1987
 
1988
-	        /**
1989
-	         * @since 1.9
1990
-	         */
1991
-	        if ( ! empty( $this->entry ) ) {
1992
-		        $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;" ) );
1993
-	        }
1988
+			/**
1989
+			 * @since 1.9
1990
+			 */
1991
+			if ( ! empty( $this->entry ) ) {
1992
+				$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;" ) );
1993
+			}
1994 1994
 
1995 1995
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1996 1996
 		}
Please login to merge, or discard this patch.
Spacing   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 	function load() {
116 116
 
117 117
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
118
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
118
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
119 119
 
120 120
 		// Don't display an embedded form when editing an entry
121 121
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
122 122
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
123 123
 
124 124
 		// Stop Gravity Forms processing what is ours!
125
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
125
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
126 126
 
127
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
127
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
128 128
 
129 129
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
130 130
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
136 136
 
137 137
 		// Add fields expected by GFFormDisplay::validate()
138
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
138
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
139 139
 
140 140
 		// Fix multiselect value for GF 2.2
141 141
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @return void
153 153
 	 */
154 154
 	public function prevent_render_form() {
155
-		if( $this->is_edit_entry() ) {
156
-			if( 'wp_head' === current_filter() ) {
155
+		if ( $this->is_edit_entry() ) {
156
+			if ( 'wp_head' === current_filter() ) {
157 157
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
158 158
 			} else {
159 159
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171
-		if( ! empty( $_POST ) ) {
171
+		if ( ! empty( $_POST ) ) {
172 172
 	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175
-		if( $this->is_edit_entry_submission() ) {
176
-			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
175
+		if ( $this->is_edit_entry_submission() ) {
176
+			remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
177
+	        remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function is_edit_entry() {
186 186
 
187
-		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
187
+		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
188 188
 
189 189
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
190 190
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @return boolean
196 196
 	 */
197 197
 	public function is_edit_entry_submission() {
198
-		return !empty( $_POST[ self::$nonce_field ] );
198
+		return ! empty( $_POST[ self::$nonce_field ] );
199 199
 	}
200 200
 
201 201
 	/**
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+	    self::$original_entry = $entries[ 0 ];
212
+	    $this->entry = $entries[ 0 ];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		$this->view_id = $gravityview_view->getViewId();
218 218
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
219 219
 
220
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
220
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
221 221
 	}
222 222
 
223 223
 
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 	private function print_scripts() {
269 269
 		$gravityview_view = GravityView_View::getInstance();
270 270
 
271
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
271
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
272 272
 
273
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
273
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
274 274
 
275 275
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
276 276
 
@@ -286,19 +286,19 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	private function process_save( $gv_data ) {
288 288
 
289
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
289
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
290 290
 			return;
291 291
 		}
292 292
 
293 293
 		// Make sure the entry, view, and form IDs are all correct
294 294
 		$valid = $this->verify_nonce();
295 295
 
296
-		if ( !$valid ) {
296
+		if ( ! $valid ) {
297 297
 			gravityview()->log->error( 'Nonce validation failed.' );
298 298
 			return;
299 299
 		}
300 300
 
301
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
301
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
302 302
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
303 303
 			return;
304 304
 		}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
 		$this->validate();
311 311
 
312
-		if( $this->is_valid ) {
312
+		if ( $this->is_valid ) {
313 313
 
314 314
 			gravityview()->log->debug( 'Submission is valid.' );
315 315
 
@@ -321,22 +321,22 @@  discard block
 block discarded – undo
321 321
 			/**
322 322
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
323 323
 			 */
324
-			unset( $_GET['page'] );
324
+			unset( $_GET[ 'page' ] );
325 325
 
326
-			$date_created = $this->entry['date_created'];
326
+			$date_created = $this->entry[ 'date_created' ];
327 327
 
328 328
 			/**
329 329
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
330 330
 			 * @since 1.17.2
331 331
 			 */
332
-			unset( $this->entry['date_created'] );
332
+			unset( $this->entry[ 'date_created' ] );
333 333
 
334 334
 			GFFormsModel::save_lead( $form, $this->entry );
335 335
 
336 336
 	        // Delete the values for hidden inputs
337 337
 	        $this->unset_hidden_field_values();
338 338
 			
339
-			$this->entry['date_created'] = $date_created;
339
+			$this->entry[ 'date_created' ] = $date_created;
340 340
 
341 341
 			// Process calculation fields
342 342
 			$this->update_calculation_fields();
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 			 * @param GravityView_Edit_Entry_Render $this This object
359 359
 			 * @param GravityView_View_Data $gv_data The View data
360 360
 			 */
361
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
361
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
362 362
 
363 363
 		} else {
364 364
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -386,16 +386,16 @@  discard block
 block discarded – undo
386 386
 		 */
387 387
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
388 388
 
389
-		if( ! $unset_hidden_field_values ) {
389
+		if ( ! $unset_hidden_field_values ) {
390 390
 			return;
391 391
 		}
392 392
 
393 393
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
394 394
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
395
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
395
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
396 396
 		} else {
397 397
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
398
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
398
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
399 399
 		}
400 400
 
401 401
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		}
477 477
 
478 478
 		/** No file is being uploaded. */
479
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
479
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
480 480
 			/** So return the original upload */
481 481
 			return $entry[ $input_id ];
482 482
 		}
@@ -494,11 +494,11 @@  discard block
 block discarded – undo
494 494
 	 * @return mixed
495 495
 	 */
496 496
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
497
-		if( ! $this->is_edit_entry() ) {
497
+		if ( ! $this->is_edit_entry() ) {
498 498
 			return $plupload_init;
499 499
 		}
500 500
 
501
-		$plupload_init['gf_vars']['max_files'] = 0;
501
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
502 502
 
503 503
 		return $plupload_init;
504 504
 	}
@@ -513,27 +513,27 @@  discard block
 block discarded – undo
513 513
 		$form = $this->form;
514 514
 
515 515
 	    /** @var GF_Field $field */
516
-		foreach( $form['fields'] as $k => &$field ) {
516
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
517 517
 
518 518
 			/**
519 519
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
520 520
 			 * @since 1.16.3
521 521
 			 * @var GF_Field $field
522 522
 			 */
523
-			if( $field->has_calculation() ) {
524
-				unset( $form['fields'][ $k ] );
523
+			if ( $field->has_calculation() ) {
524
+				unset( $form[ 'fields' ][ $k ] );
525 525
 			}
526 526
 
527 527
 			$field->adminOnly = false;
528 528
 
529
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530
-				foreach( $field->inputs as $key => $input ) {
531
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
529
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530
+				foreach ( $field->inputs as $key => $input ) {
531
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
532 532
 				}
533 533
 			}
534 534
 		}
535 535
 
536
-		$form['fields'] = array_values( $form['fields'] );
536
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
537 537
 
538 538
 		return $form;
539 539
 	}
@@ -545,14 +545,14 @@  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 550
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
551 551
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
552
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, meta_key FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) );
552
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, meta_key FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) );
553 553
 		} else {
554 554
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
555
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) );
555
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) );
556 556
 		}
557 557
 
558 558
 		if ( ! empty( $this->fields_with_calculation ) ) {
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 				$inputs = $field->get_entry_inputs();
562 562
 				if ( is_array( $inputs ) ) {
563 563
 				    foreach ( $inputs as $input ) {
564
-						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
564
+						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] );
565 565
 				    }
566 566
 				} else {
567 567
 					GFFormsModel::save_input( $form, $field, $entry, $current_fields, $field->id );
@@ -597,19 +597,19 @@  discard block
 block discarded – undo
597 597
 
598 598
 		$input_name = 'input_' . $field_id;
599 599
 
600
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
600
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
601 601
 
602 602
 			// We have a new image
603 603
 
604
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
604
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
605 605
 
606 606
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
607 607
 	        $ary = stripslashes_deep( $ary );
608 608
 			$img_url = \GV\Utils::get( $ary, 0 );
609 609
 
610
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
611
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
612
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
610
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
611
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
612
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
613 613
 
614 614
 			$image_meta = array(
615 615
 				'post_excerpt' => $img_caption,
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 
619 619
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
620 620
 			if ( ! empty( $img_title ) ) {
621
-				$image_meta['post_title'] = $img_title;
621
+				$image_meta[ 'post_title' ] = $img_title;
622 622
 			}
623 623
 
624 624
 			/**
@@ -676,15 +676,15 @@  discard block
 block discarded – undo
676 676
 	 */
677 677
 	private function maybe_update_post_fields( $form ) {
678 678
 
679
-		if( empty( $this->entry['post_id'] ) ) {
679
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
680 680
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
681 681
 			return;
682 682
 		}
683 683
 
684
-		$post_id = $this->entry['post_id'];
684
+		$post_id = $this->entry[ 'post_id' ];
685 685
 
686 686
 		// Security check
687
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
687
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
688 688
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
689 689
 			return;
690 690
 		}
@@ -697,25 +697,25 @@  discard block
 block discarded – undo
697 697
 
698 698
 			$field = RGFormsModel::get_field( $form, $field_id );
699 699
 
700
-			if( ! $field ) {
700
+			if ( ! $field ) {
701 701
 				continue;
702 702
 			}
703 703
 
704
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
704
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
705 705
 
706 706
 				// Get the value of the field, including $_POSTed value
707 707
 				$value = RGFormsModel::get_field_value( $field );
708 708
 
709 709
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
710 710
 				$entry_tmp = $this->entry;
711
-				$entry_tmp["{$field_id}"] = $value;
711
+				$entry_tmp[ "{$field_id}" ] = $value;
712 712
 
713
-				switch( $field->type ) {
713
+				switch ( $field->type ) {
714 714
 
715 715
 				    case 'post_title':
716 716
 				        $post_title = $value;
717 717
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
718
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
718
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
719 719
 				        }
720 720
 				        $updated_post->post_title = $post_title;
721 721
 				        $updated_post->post_name  = $post_title;
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 				    case 'post_content':
726 726
 				        $post_content = $value;
727 727
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
728
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
728
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
729 729
 				        }
730 730
 				        $updated_post->post_content = $post_content;
731 731
 				        unset( $post_content );
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 							$value = $value[ $field_id ];
744 744
 						}
745 745
 
746
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
746
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
747 747
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
748 748
 				        }
749 749
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 				}
762 762
 
763 763
 				// update entry after
764
-				$this->entry["{$field_id}"] = $value;
764
+				$this->entry[ "{$field_id}" ] = $value;
765 765
 
766 766
 				$update_entry = true;
767 767
 
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
 
771 771
 		}
772 772
 
773
-		if( $update_entry ) {
773
+		if ( $update_entry ) {
774 774
 
775 775
 			$return_entry = GFAPI::update_entry( $this->entry );
776 776
 
777
-			if( is_wp_error( $return_entry ) ) {
777
+			if ( is_wp_error( $return_entry ) ) {
778 778
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
779 779
 			} else {
780 780
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 
785 785
 		$return_post = wp_update_post( $updated_post, true );
786 786
 
787
-		if( is_wp_error( $return_post ) ) {
787
+		if ( is_wp_error( $return_post ) ) {
788 788
 			$return_post->add_data( $updated_post, '$updated_post' );
789 789
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
790 790
 		} else {
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 		$input_type = RGFormsModel::get_input_type( $field );
807 807
 
808 808
 	    // Only certain custom field types are supported
809
-	    switch( $input_type ) {
809
+	    switch ( $input_type ) {
810 810
 		    case 'fileupload':
811 811
 		    case 'list':
812 812
 		    case 'multiselect':
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
844 844
 
845 845
 		// replace conditional shortcodes
846
-		if( $do_shortcode ) {
846
+		if ( $do_shortcode ) {
847 847
 			$output = do_shortcode( $output );
848 848
 		}
849 849
 
@@ -862,19 +862,19 @@  discard block
 block discarded – undo
862 862
 	 */
863 863
 	private function after_update() {
864 864
 
865
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
866
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
865
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
866
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
867 867
 
868 868
 		// Re-define the entry now that we've updated it.
869
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
869
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
870 870
 
871 871
 		$entry = GFFormsModel::set_entry_meta( $entry, self::$original_form );
872 872
 
873 873
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
874 874
 			// We need to clear the cache because Gravity Forms caches the field values, which
875 875
 			// we have just updated.
876
-			foreach ($this->form['fields'] as $key => $field) {
877
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
876
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
877
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
878 878
 			}
879 879
 		}
880 880
 
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 
894 894
 		<div class="gv-edit-entry-wrapper"><?php
895 895
 
896
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
896
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
897 897
 
898 898
 			/**
899 899
 			 * Fixes weird wpautop() issue
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
910 910
 				     * @param GravityView_Edit_Entry_Render $this This object
911 911
 				     */
912
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
912
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
913 913
 
914 914
 				    echo esc_attr( $edit_entry_title );
915 915
 			?></span>
@@ -959,13 +959,13 @@  discard block
 block discarded – undo
959 959
 
960 960
 			$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
961 961
 
962
-			if( ! $this->is_valid ){
962
+			if ( ! $this->is_valid ) {
963 963
 
964 964
 				// Keeping this compatible with Gravity Forms.
965
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
966
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
965
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
966
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
967 967
 
968
-				echo GVCommon::generate_notice( $message , 'gv-error' );
968
+				echo GVCommon::generate_notice( $message, 'gv-error' );
969 969
 
970 970
 			} else {
971 971
 				$view = \GV\View::by_id( $this->view_id );
@@ -976,23 +976,23 @@  discard block
 block discarded – undo
976 976
 
977 977
                     case '0':
978 978
 	                    $redirect_url = $back_link;
979
-	                    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturning to Entry%s', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
979
+	                    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturning to Entry%s', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' );
980 980
                         break;
981 981
 
982 982
                     case '1':
983 983
 	                    $redirect_url = $directory_link = GravityView_API::directory_link();
984
-	                    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturning to %s%s', 'gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
984
+	                    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturning to %s%s', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
985 985
 	                    break;
986 986
 
987 987
                     case '2':
988 988
 	                    $redirect_url = $edit_redirect_url;
989 989
 	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
990
-	                    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sRedirecting to %s%s', 'gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
990
+	                    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sRedirecting to %s%s', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
991 991
                         break;
992 992
 
993 993
                     case '':
994 994
                     default:
995
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
995
+					    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' );
996 996
                         break;
997 997
 				}
998 998
 
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
 				 * @param array $entry Gravity Forms entry array
1009 1009
 				 * @param string $back_link URL to return to the original entry. @since 1.6
1010 1010
 				 */
1011
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
1011
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
1012 1012
 
1013 1013
 				echo GVCommon::generate_notice( $message );
1014 1014
 			}
@@ -1032,21 +1032,21 @@  discard block
 block discarded – undo
1032 1032
 		 */
1033 1033
 		do_action( 'gravityview/edit-entry/render/before', $this );
1034 1034
 
1035
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1036
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1035
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1036
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1037 1037
 		add_filter( 'gform_disable_view_counter', '__return_true' );
1038 1038
 
1039 1039
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
1040 1040
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1041 1041
 
1042 1042
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1043
-		unset( $_GET['page'] );
1043
+		unset( $_GET[ 'page' ] );
1044 1044
 
1045 1045
 		// TODO: Verify multiple-page forms
1046 1046
 
1047 1047
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1048 1048
 
1049
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1049
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1050 1050
 
1051 1051
 		ob_get_clean();
1052 1052
 
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
 	 * @return string
1073 1073
 	 */
1074 1074
 	public function render_form_buttons() {
1075
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1075
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1076 1076
 	}
1077 1077
 
1078 1078
 
@@ -1092,10 +1092,10 @@  discard block
 block discarded – undo
1092 1092
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1093 1093
 
1094 1094
 		// In case we have validated the form, use it to inject the validation results into the form render
1095
-		if( isset( $this->form_after_validation ) ) {
1095
+		if ( isset( $this->form_after_validation ) ) {
1096 1096
 			$form = $this->form_after_validation;
1097 1097
 		} else {
1098
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1098
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1099 1099
 		}
1100 1100
 
1101 1101
 		$form = $this->filter_conditional_logic( $form );
@@ -1103,8 +1103,8 @@  discard block
 block discarded – undo
1103 1103
 		$form = $this->prefill_conditional_logic( $form );
1104 1104
 
1105 1105
 		// for now we don't support Save and Continue feature.
1106
-		if( ! self::$supports_save_and_continue ) {
1107
-	        unset( $form['save'] );
1106
+		if ( ! self::$supports_save_and_continue ) {
1107
+	        unset( $form[ 'save' ] );
1108 1108
 		}
1109 1109
 
1110 1110
 		$form = $this->unselect_default_values( $form );
@@ -1127,31 +1127,31 @@  discard block
 block discarded – undo
1127 1127
 	 */
1128 1128
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1129 1129
 
1130
-		if( ! GFCommon::is_post_field( $field ) ) {
1130
+		if ( ! GFCommon::is_post_field( $field ) ) {
1131 1131
 			return $field_content;
1132 1132
 		}
1133 1133
 
1134 1134
         $message = null;
1135 1135
 
1136 1136
         // First, make sure they have the capability to edit the post.
1137
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1137
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1138 1138
 
1139 1139
             /**
1140 1140
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1141 1141
              * @param string $message The existing "You don't have permission..." text
1142 1142
              */
1143
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1143
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1144 1144
 
1145
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1145
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1146 1146
             /**
1147 1147
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1148 1148
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1149 1149
              */
1150
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1150
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1151 1151
         }
1152 1152
 
1153
-        if( $message ) {
1154
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1153
+        if ( $message ) {
1154
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1155 1155
         }
1156 1156
 
1157 1157
         return $field_content;
@@ -1175,8 +1175,8 @@  discard block
 block discarded – undo
1175 1175
 
1176 1176
 		// If the form has been submitted, then we don't need to pre-fill the values,
1177 1177
 		// Except for fileupload type and when a field input is overridden- run always!!
1178
-		if(
1179
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1178
+		if (
1179
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1180 1180
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1181 1181
 			&& ! GFCommon::is_product_field( $field->type )
1182 1182
 			|| ! empty( $field_content )
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 	    $return = null;
1197 1197
 
1198 1198
 		/** @var GravityView_Field $gv_field */
1199
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1199
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1200 1200
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1201 1201
 		} else {
1202 1202
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 	    // If there was output, it's an error
1206 1206
 	    $warnings = ob_get_clean();
1207 1207
 
1208
-	    if( !empty( $warnings ) ) {
1208
+	    if ( ! empty( $warnings ) ) {
1209 1209
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1210 1210
 	    }
1211 1211
 
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1231 1231
 
1232 1232
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1233
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1233
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1234 1234
 
1235 1235
 			$field_value = array();
1236 1236
 
@@ -1239,10 +1239,10 @@  discard block
 block discarded – undo
1239 1239
 
1240 1240
 			foreach ( (array)$field->inputs as $input ) {
1241 1241
 
1242
-				$input_id = strval( $input['id'] );
1242
+				$input_id = strval( $input[ 'id' ] );
1243 1243
 				
1244 1244
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1245
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1245
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1246 1246
 				    $allow_pre_populated = false;
1247 1247
 				}
1248 1248
 
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
 
1251 1251
 			$pre_value = $field->get_value_submission( array(), false );
1252 1252
 
1253
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1253
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1254 1254
 
1255 1255
 		} else {
1256 1256
 
@@ -1261,13 +1261,13 @@  discard block
 block discarded – undo
1261 1261
 
1262 1262
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1263 1263
 			// or pre-populated value if not empty and set to override saved value
1264
-			$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;
1264
+			$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;
1265 1265
 
1266 1266
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1267
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1267
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1268 1268
 				$categories = array();
1269 1269
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1270
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1270
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1271 1271
 				}
1272 1272
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1273 1273
 			}
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
 	     * @param GF_Field $field Gravity Forms field object
1296 1296
 	     * @param GravityView_Edit_Entry_Render $this Current object
1297 1297
 	     */
1298
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1298
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1299 1299
 
1300 1300
 		return $field_value;
1301 1301
 	}
@@ -1312,12 +1312,12 @@  discard block
 block discarded – undo
1312 1312
 	 */
1313 1313
 	public function gform_pre_validation( $form ) {
1314 1314
 
1315
-		if( ! $this->verify_nonce() ) {
1315
+		if ( ! $this->verify_nonce() ) {
1316 1316
 			return $form;
1317 1317
 		}
1318 1318
 
1319 1319
 		// Fix PHP warning regarding undefined index.
1320
-		foreach ( $form['fields'] as &$field) {
1320
+		foreach ( $form[ 'fields' ] as &$field ) {
1321 1321
 
1322 1322
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1323 1323
 			// expects certain field array items to be set.
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1326 1326
 			}
1327 1327
 
1328
-			switch( RGFormsModel::get_input_type( $field ) ) {
1328
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1329 1329
 
1330 1330
 				/**
1331 1331
 				 * 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.
@@ -1339,26 +1339,26 @@  discard block
 block discarded – undo
1339 1339
 				    // Set the previous value
1340 1340
 				    $entry = $this->get_entry();
1341 1341
 
1342
-				    $input_name = 'input_'.$field->id;
1343
-				    $form_id = $form['id'];
1342
+				    $input_name = 'input_' . $field->id;
1343
+				    $form_id = $form[ 'id' ];
1344 1344
 
1345 1345
 				    $value = NULL;
1346 1346
 
1347 1347
 				    // Use the previous entry value as the default.
1348
-				    if( isset( $entry[ $field->id ] ) ) {
1348
+				    if ( isset( $entry[ $field->id ] ) ) {
1349 1349
 				        $value = $entry[ $field->id ];
1350 1350
 				    }
1351 1351
 
1352 1352
 				    // If this is a single upload file
1353
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1354
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1355
-				        $value = $file_path['url'];
1353
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1354
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1355
+				        $value = $file_path[ 'url' ];
1356 1356
 
1357 1357
 				    } else {
1358 1358
 
1359 1359
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1360 1360
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1361
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1361
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1362 1362
 
1363 1363
 				    }
1364 1364
 
@@ -1366,10 +1366,10 @@  discard block
 block discarded – undo
1366 1366
 
1367 1367
 				        // If there are fresh uploads, process and merge them.
1368 1368
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1369
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1369
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1370 1370
 				            $value = empty( $value ) ? '[]' : $value;
1371 1371
 				            $value = stripslashes_deep( $value );
1372
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1372
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1373 1373
 				        }
1374 1374
 
1375 1375
 				    } else {
@@ -1387,8 +1387,8 @@  discard block
 block discarded – undo
1387 1387
 
1388 1388
 				case 'number':
1389 1389
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1390
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1391
-				        $_POST['input_'.$field->id ] = NULL;
1390
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1391
+				        $_POST[ 'input_' . $field->id ] = NULL;
1392 1392
 				    }
1393 1393
 				    break;
1394 1394
 			}
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
 		 * You can enter whatever you want!
1426 1426
 		 * We try validating, and customize the results using `self::custom_validation()`
1427 1427
 		 */
1428
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1428
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1429 1429
 
1430 1430
 		// Needed by the validate funtion
1431 1431
 		$failed_validation_page = NULL;
@@ -1433,14 +1433,14 @@  discard block
 block discarded – undo
1433 1433
 
1434 1434
 		// Prevent entry limit from running when editing an entry, also
1435 1435
 		// prevent form scheduling from preventing editing
1436
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1436
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1437 1437
 
1438 1438
 		// Hide fields depending on Edit Entry settings
1439
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1439
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1440 1440
 
1441 1441
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1442 1442
 
1443
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1443
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1444 1444
 	}
1445 1445
 
1446 1446
 
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 
1464 1464
 		$gv_valid = true;
1465 1465
 
1466
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1466
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1467 1467
 
1468 1468
 			$value = RGFormsModel::get_field_value( $field );
1469 1469
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1476,35 +1476,35 @@  discard block
 block discarded – undo
1476 1476
 				case 'post_image':
1477 1477
 
1478 1478
 				    // in case nothing is uploaded but there are already files saved
1479
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1479
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1480 1480
 				        $field->failed_validation = false;
1481 1481
 				        unset( $field->validation_message );
1482 1482
 				    }
1483 1483
 
1484 1484
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1485
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1485
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1486 1486
 
1487 1487
 				        $input_name = 'input_' . $field->id;
1488 1488
 				        //uploaded
1489
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1489
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1490 1490
 
1491 1491
 				        //existent
1492 1492
 				        $entry = $this->get_entry();
1493 1493
 				        $value = NULL;
1494
-				        if( isset( $entry[ $field->id ] ) ) {
1494
+				        if ( isset( $entry[ $field->id ] ) ) {
1495 1495
 				            $value = json_decode( $entry[ $field->id ], true );
1496 1496
 				        }
1497 1497
 
1498 1498
 				        // count uploaded files and existent entry files
1499 1499
 				        $count_files = count( $file_names ) + count( $value );
1500 1500
 
1501
-				        if( $count_files > $field->maxFiles ) {
1501
+				        if ( $count_files > $field->maxFiles ) {
1502 1502
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1503 1503
 				            $field->failed_validation = 1;
1504 1504
 				            $gv_valid = false;
1505 1505
 
1506 1506
 				            // in case of error make sure the newest upload files are removed from the upload input
1507
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1507
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1508 1508
 				        }
1509 1509
 
1510 1510
 				    }
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
 			}
1516 1516
 
1517 1517
 			// This field has failed validation.
1518
-			if( !empty( $field->failed_validation ) ) {
1518
+			if ( ! empty( $field->failed_validation ) ) {
1519 1519
 
1520 1520
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1521 1521
 
@@ -1533,19 +1533,19 @@  discard block
 block discarded – undo
1533 1533
 				}
1534 1534
 
1535 1535
 				// You can't continue inside a switch, so we do it after.
1536
-				if( empty( $field->failed_validation ) ) {
1536
+				if ( empty( $field->failed_validation ) ) {
1537 1537
 				    continue;
1538 1538
 				}
1539 1539
 
1540 1540
 				// checks if the No Duplicates option is not validating entry against itself, since
1541 1541
 				// we're editing a stored entry, it would also assume it's a duplicate.
1542
-				if( !empty( $field->noDuplicates ) ) {
1542
+				if ( ! empty( $field->noDuplicates ) ) {
1543 1543
 
1544 1544
 				    $entry = $this->get_entry();
1545 1545
 
1546 1546
 				    // If the value of the entry is the same as the stored value
1547 1547
 				    // Then we can assume it's not a duplicate, it's the same.
1548
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1548
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1549 1549
 				        //if value submitted was not changed, then don't validate
1550 1550
 				        $field->failed_validation = false;
1551 1551
 
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
 				}
1559 1559
 
1560 1560
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1561
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1561
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1562 1562
 				    unset( $field->validation_message );
1563 1563
 	                $field->validation_message = false;
1564 1564
 				    continue;
@@ -1570,12 +1570,12 @@  discard block
 block discarded – undo
1570 1570
 
1571 1571
 		}
1572 1572
 
1573
-		$validation_results['is_valid'] = $gv_valid;
1573
+		$validation_results[ 'is_valid' ] = $gv_valid;
1574 1574
 
1575 1575
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1576 1576
 
1577 1577
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1578
-		$this->form_after_validation = $validation_results['form'];
1578
+		$this->form_after_validation = $validation_results[ 'form' ];
1579 1579
 
1580 1580
 		return $validation_results;
1581 1581
 	}
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
 	 */
1589 1589
 	public function get_entry() {
1590 1590
 
1591
-		if( empty( $this->entry ) ) {
1591
+		if ( empty( $this->entry ) ) {
1592 1592
 			// Get the database value of the entry that's being edited
1593 1593
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1594 1594
 		}
@@ -1620,10 +1620,10 @@  discard block
 block discarded – undo
1620 1620
 		}
1621 1621
 
1622 1622
 		// If edit tab not yet configured, show all fields
1623
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1623
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1624 1624
 
1625 1625
 		// Hide fields depending on admin settings
1626
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1626
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1627 1627
 
1628 1628
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1629 1629
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 	 */
1656 1656
 	private function filter_fields( $fields, $configured_fields ) {
1657 1657
 
1658
-		if( empty( $fields ) || !is_array( $fields ) ) {
1658
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1659 1659
 			return $fields;
1660 1660
 		}
1661 1661
 
@@ -1668,18 +1668,18 @@  discard block
 block discarded – undo
1668 1668
 
1669 1669
 			// Remove the fields that have calculation properties and keep them to be used later
1670 1670
 			// @since 1.16.2
1671
-			if( $field->has_calculation() ) {
1672
-				$this->fields_with_calculation[] = $field;
1671
+			if ( $field->has_calculation() ) {
1672
+				$this->fields_with_calculation[ ] = $field;
1673 1673
 				// don't remove the calculation fields on form render.
1674 1674
 			}
1675 1675
 
1676
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1676
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1677 1677
 				unset( $fields[ $key ] );
1678 1678
 			}
1679 1679
 		}
1680 1680
 
1681 1681
 		// The Edit tab has not been configured, so we return all fields by default.
1682
-		if( empty( $configured_fields ) ) {
1682
+		if ( empty( $configured_fields ) ) {
1683 1683
 			return array_values( $fields );
1684 1684
 		}
1685 1685
 
@@ -1688,8 +1688,8 @@  discard block
 block discarded – undo
1688 1688
 
1689 1689
 	        /** @var GF_Field $field */
1690 1690
 	        foreach ( $fields as $field ) {
1691
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1692
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1691
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1692
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1693 1693
 				    break;
1694 1694
 				}
1695 1695
 
@@ -1712,14 +1712,14 @@  discard block
 block discarded – undo
1712 1712
 
1713 1713
 		$return_field = $field;
1714 1714
 
1715
-		if( empty( $field_setting['show_label'] ) ) {
1715
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1716 1716
 			$return_field->label = '';
1717
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1718
-			$return_field->label = $field_setting['custom_label'];
1717
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1718
+			$return_field->label = $field_setting[ 'custom_label' ];
1719 1719
 		}
1720 1720
 
1721
-		if( !empty( $field_setting['custom_class'] ) ) {
1722
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1721
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1722
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1723 1723
 		}
1724 1724
 
1725 1725
 		/**
@@ -1757,16 +1757,16 @@  discard block
 block discarded – undo
1757 1757
 	     */
1758 1758
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1759 1759
 
1760
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1761
-			foreach( $fields as $k => $field ) {
1762
-				if( $field->adminOnly ) {
1760
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1761
+			foreach ( $fields as $k => $field ) {
1762
+				if ( $field->adminOnly ) {
1763 1763
 				    unset( $fields[ $k ] );
1764 1764
 				}
1765 1765
 			}
1766 1766
 			return array_values( $fields );
1767 1767
 		}
1768 1768
 
1769
-	    foreach( $fields as &$field ) {
1769
+	    foreach ( $fields as &$field ) {
1770 1770
 		    $field->adminOnly = false;
1771 1771
 		}
1772 1772
 
@@ -1787,7 +1787,7 @@  discard block
 block discarded – undo
1787 1787
 	 */
1788 1788
 	private function unselect_default_values( $form ) {
1789 1789
 
1790
-	    foreach ( $form['fields'] as &$field ) {
1790
+	    foreach ( $form[ 'fields' ] as &$field ) {
1791 1791
 
1792 1792
 			if ( empty( $field->choices ) ) {
1793 1793
                 continue;
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
 
1796 1796
             foreach ( $field->choices as &$choice ) {
1797 1797
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1798
-					$choice['isSelected'] = false;
1798
+					$choice[ 'isSelected' ] = false;
1799 1799
 				}
1800 1800
 			}
1801 1801
 		}
@@ -1820,22 +1820,22 @@  discard block
 block discarded – undo
1820 1820
 	 */
1821 1821
 	function prefill_conditional_logic( $form ) {
1822 1822
 
1823
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1823
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1824 1824
 			return $form;
1825 1825
 		}
1826 1826
 
1827 1827
 		// Have Conditional Logic pre-fill fields as if the data were default values
1828 1828
 		/** @var GF_Field $field */
1829
-		foreach ( $form['fields'] as &$field ) {
1829
+		foreach ( $form[ 'fields' ] as &$field ) {
1830 1830
 
1831
-			if( 'checkbox' === $field->type ) {
1831
+			if ( 'checkbox' === $field->type ) {
1832 1832
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1833
-				    $input_id = $input['id'];
1833
+				    $input_id = $input[ 'id' ];
1834 1834
 				    $choice = $field->choices[ $key ];
1835 1835
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1836 1836
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1837
-				    if( $match ) {
1838
-				        $field->choices[ $key ]['isSelected'] = true;
1837
+				    if ( $match ) {
1838
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1839 1839
 				    }
1840 1840
 				}
1841 1841
 			} else {
@@ -1843,15 +1843,15 @@  discard block
 block discarded – undo
1843 1843
 				// We need to run through each field to set the default values
1844 1844
 				foreach ( $this->entry as $field_id => $field_value ) {
1845 1845
 
1846
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1846
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1847 1847
 
1848
-				        if( 'list' === $field->type ) {
1848
+				        if ( 'list' === $field->type ) {
1849 1849
 				            $list_rows = maybe_unserialize( $field_value );
1850 1850
 
1851 1851
 				            $list_field_value = array();
1852
-				            foreach ( (array) $list_rows as $row ) {
1853
-				                foreach ( (array) $row as $column ) {
1854
-				                    $list_field_value[] = $column;
1852
+				            foreach ( (array)$list_rows as $row ) {
1853
+				                foreach ( (array)$row as $column ) {
1854
+				                    $list_field_value[ ] = $column;
1855 1855
 				                }
1856 1856
 				            }
1857 1857
 
@@ -1886,16 +1886,16 @@  discard block
 block discarded – undo
1886 1886
 		 */
1887 1887
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1888 1888
 
1889
-		if( $use_conditional_logic ) {
1889
+		if ( $use_conditional_logic ) {
1890 1890
 			return $form;
1891 1891
 		}
1892 1892
 
1893
-		foreach( $form['fields'] as &$field ) {
1893
+		foreach ( $form[ 'fields' ] as &$field ) {
1894 1894
 			/* @var GF_Field $field */
1895 1895
 			$field->conditionalLogic = null;
1896 1896
 		}
1897 1897
 
1898
-		unset( $form['button']['conditionalLogic'] );
1898
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1899 1899
 
1900 1900
 		return $form;
1901 1901
 
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
 	 */
1913 1913
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1914 1914
 
1915
-		if( ! $this->is_edit_entry() ) {
1915
+		if ( ! $this->is_edit_entry() ) {
1916 1916
 			return $has_conditional_logic;
1917 1917
 		}
1918 1918
 
@@ -1944,44 +1944,44 @@  discard block
 block discarded – undo
1944 1944
 		 *  2. There are two entries embedded using oEmbed
1945 1945
 		 *  3. One of the entries has just been saved
1946 1946
 		 */
1947
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1947
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1948 1948
 
1949 1949
 			$error = true;
1950 1950
 
1951 1951
 		}
1952 1952
 
1953
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1953
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1954 1954
 
1955 1955
 			$error = true;
1956 1956
 
1957
-		} elseif( ! $this->verify_nonce() ) {
1957
+		} elseif ( ! $this->verify_nonce() ) {
1958 1958
 
1959 1959
 			/**
1960 1960
 			 * If the Entry is embedded, there may be two entries on the same page.
1961 1961
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1962 1962
 			 */
1963
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1963
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1964 1964
 				$error = true;
1965 1965
 			} else {
1966
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1966
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1967 1967
 			}
1968 1968
 
1969 1969
 		}
1970 1970
 
1971
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1972
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1971
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1972
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1973 1973
 		}
1974 1974
 
1975
-		if( $this->entry['status'] === 'trash' ) {
1976
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1975
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1976
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1977 1977
 		}
1978 1978
 
1979 1979
 		// No errors; everything's fine here!
1980
-		if( empty( $error ) ) {
1980
+		if ( empty( $error ) ) {
1981 1981
 			return true;
1982 1982
 		}
1983 1983
 
1984
-		if( $echo && $error !== true ) {
1984
+		if ( $echo && $error !== true ) {
1985 1985
 
1986 1986
 	        $error = esc_html( $error );
1987 1987
 
@@ -1989,10 +1989,10 @@  discard block
 block discarded – undo
1989 1989
 	         * @since 1.9
1990 1990
 	         */
1991 1991
 	        if ( ! empty( $this->entry ) ) {
1992
-		        $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;" ) );
1992
+		        $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;" ) );
1993 1993
 	        }
1994 1994
 
1995
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1995
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1996 1996
 		}
1997 1997
 
1998 1998
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2012,17 +2012,17 @@  discard block
 block discarded – undo
2012 2012
 
2013 2013
 		$error = NULL;
2014 2014
 
2015
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2016
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2015
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2016
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2017 2017
 		}
2018 2018
 
2019 2019
 		// No errors; everything's fine here!
2020
-		if( empty( $error ) ) {
2020
+		if ( empty( $error ) ) {
2021 2021
 			return true;
2022 2022
 		}
2023 2023
 
2024
-		if( $echo ) {
2025
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2024
+		if ( $echo ) {
2025
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2026 2026
 		}
2027 2027
 
2028 2028
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2043,14 +2043,14 @@  discard block
 block discarded – undo
2043 2043
 	private function check_user_cap_edit_field( $field ) {
2044 2044
 
2045 2045
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2046
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2046
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2047 2047
 			return true;
2048 2048
 		}
2049 2049
 
2050
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2050
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2051 2051
 
2052
-		if( $field_cap ) {
2053
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2052
+		if ( $field_cap ) {
2053
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2054 2054
 		}
2055 2055
 
2056 2056
 		return false;
@@ -2064,17 +2064,17 @@  discard block
 block discarded – undo
2064 2064
 	public function verify_nonce() {
2065 2065
 
2066 2066
 		// Verify form submitted for editing single
2067
-		if( $this->is_edit_entry_submission() ) {
2067
+		if ( $this->is_edit_entry_submission() ) {
2068 2068
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2069 2069
 		}
2070 2070
 
2071 2071
 		// Verify
2072
-		else if( ! $this->is_edit_entry() ) {
2072
+		else if ( ! $this->is_edit_entry() ) {
2073 2073
 			$valid = false;
2074 2074
 		}
2075 2075
 
2076 2076
 		else {
2077
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2077
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2078 2078
 		}
2079 2079
 
2080 2080
 		/**
Please login to merge, or discard this patch.
includes/class-gravityview-shortcode.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		gravityview()->log->debug( '$passed_atts: ', array( 'data' => $passed_atts ) );
49 49
 
50 50
 		// Get details about the current View
51
-		if( !empty( $passed_atts['detail'] ) ) {
52
-			return $this->get_view_detail( $passed_atts['detail'] );
51
+		if ( ! empty( $passed_atts[ 'detail' ] ) ) {
52
+			return $this->get_view_detail( $passed_atts[ 'detail' ] );
53 53
 		}
54 54
 
55 55
 		$atts = $this->parse_and_sanitize_atts( $passed_atts );
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
86 86
 
87 87
 		// Only keep the passed attributes after making sure that they're valid pairs
88
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
88
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
89 89
 
90 90
 		$atts = array();
91 91
 
92
-		foreach( $filtered_atts as $key => $passed_value ) {
92
+		foreach ( $filtered_atts as $key => $passed_value ) {
93 93
 
94 94
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
95 95
 			$passed_value = GravityView_Merge_Tags::replace_variables( $passed_value );
96 96
 
97
-			switch( $defaults[ $key ]['type'] ) {
97
+			switch ( $defaults[ $key ][ 'type' ] ) {
98 98
 
99 99
 				/**
100 100
 				 * Make sure number fields are numeric.
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
103 103
 				 */
104 104
 				case 'number':
105
-					if( is_numeric( $passed_value ) ) {
105
+					if ( is_numeric( $passed_value ) ) {
106 106
 						$atts[ $key ] = ( $passed_value + 0 );
107 107
 					}
108 108
 					break;
109 109
 
110 110
 				/** @since 2.1 */
111 111
 				case 'operator':
112
-					if( GFFormsModel::is_valid_operator( $passed_value ) ) {
112
+					if ( GFFormsModel::is_valid_operator( $passed_value ) ) {
113 113
 						$atts[ $key ] = $passed_value;
114 114
 					}
115 115
 					break;
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 				 */
125 125
 				case 'select':
126 126
 				case 'radio':
127
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
128
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
127
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
128
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
129 129
 						$atts[ $key ] = $passed_value;
130 130
 					}
131 131
 					break;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		$gravityview_view = GravityView_View::getInstance();
155 155
 		$return = '';
156 156
 
157
-		switch( $detail ) {
157
+		switch ( $detail ) {
158 158
 			case 'total_entries':
159 159
 				$return = number_format_i18n( $gravityview_view->getTotalEntries() );
160 160
 				break;
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-list.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@
 block discarded – undo
57 57
 		$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
58 58
 
59 59
 		if ( is_numeric( $field->ID ) ) {
60
-			$extras['field'] = $field->as_configuration();
60
+			$extras[ 'field' ] = $field->as_configuration();
61 61
 		}
62 62
 
63
-		$extras['entry'] = $this->entry->as_entry();
64
-		$extras['hide_empty'] = $hide_empty;
65
-		$extras['label'] = $label;
66
-		$extras['value'] = $value;
63
+		$extras[ 'entry' ] = $this->entry->as_entry();
64
+		$extras[ 'hide_empty' ] = $hide_empty;
65
+		$extras[ 'label' ] = $label;
66
+		$extras[ 'value' ] = $value;
67 67
 
68 68
 		return \gravityview_field_output( $extras, $context );
69 69
 	}
Please login to merge, or discard this patch.
includes/class-gravityview-extension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
  */
15 15
 abstract class GravityView_Extension extends \GV\Extension {
16 16
 	public function __construct() {
17
-		if( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) {
17
+		if ( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) {
18 18
 			gravityview()->log->warning( '\GravityView_Extension is deprecated. Inherit from \GV\Extension instead', array( 'data' => $this ) );
19 19
 		}
20 20
 		parent::__construct();
Please login to merge, or discard this patch.
future/includes/rest/class-gv-rest-views-route.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			'total' => wp_count_posts( 'gravityview' )->publish,
64 64
 		);
65 65
 		foreach ( $items as $item ) {
66
-			$data['views'][] = $this->prepare_view_for_response( $item, $request );
66
+			$data[ 'views' ][ ] = $this->prepare_view_for_response( $item, $request );
67 67
 		}
68 68
 
69 69
 		return new \WP_REST_Response( $data, 200 );
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 		$url = $request->get_url_params();
84 84
 
85
-		$view_id = intval( $url['id'] );
85
+		$view_id = intval( $url[ 'id' ] );
86 86
 
87 87
 		$item = get_post( $view_id );
88 88
 
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	public function get_sub_items( $request ) {
167 167
 
168 168
 		$url     = $request->get_url_params();
169
-		$view_id = intval( $url['id'] );
169
+		$view_id = intval( $url[ 'id' ] );
170 170
 		$format  = \GV\Utils::get( $url, 'format', 'json' );
171 171
 
172
-		if( $post_id = $request->get_param('post_id') ) {
172
+		if ( $post_id = $request->get_param( 'post_id' ) ) {
173 173
 			global $post;
174 174
 
175 175
 			$post = get_post( $post_id );
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
 		$data = array( 'entries' => $entries->all(), 'total' => $entries->total() );
262 262
 
263
-		foreach ( $data['entries'] as &$entry ) {
263
+		foreach ( $data[ 'entries' ] as &$entry ) {
264 264
 			$entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' );
265 265
 		}
266 266
 
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function get_sub_item( $request ) {
281 281
 		$url      = $request->get_url_params();
282
-		$view_id  = intval( $url['id'] );
283
-		$entry_id = intval( $url['s_id'] );
282
+		$view_id  = intval( $url[ 'id' ] );
283
+		$entry_id = intval( $url[ 's_id' ] );
284 284
 		$format   = \GV\Utils::get( $url, 'format', 'json' );
285 285
 
286 286
 		$view  = \GV\View::by_id( $view_id );
@@ -315,32 +315,32 @@  discard block
 block discarded – undo
315 315
 		// Add all the WP_Post data
316 316
 		$view_post = $view_post->to_array();
317 317
 
318
-		unset( $view_post['to_ping'], $view_post['ping_status'], $view_post['pinged'], $view_post['post_type'], $view_post['filter'], $view_post['post_category'], $view_post['tags_input'], $view_post['post_content'], $view_post['post_content_filtered'] );
318
+		unset( $view_post[ 'to_ping' ], $view_post[ 'ping_status' ], $view_post[ 'pinged' ], $view_post[ 'post_type' ], $view_post[ 'filter' ], $view_post[ 'post_category' ], $view_post[ 'tags_input' ], $view_post[ 'post_content' ], $view_post[ 'post_content_filtered' ] );
319 319
 
320 320
 		$return = wp_parse_args( $item, $view_post );
321 321
 
322
-		$return['title'] = $return['post_title'];
322
+		$return[ 'title' ] = $return[ 'post_title' ];
323 323
 
324
-		$return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array();
325
-		unset( $return['atts'], $return['view_id'] );
324
+		$return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array();
325
+		unset( $return[ 'atts' ], $return[ 'view_id' ] );
326 326
 
327
-		$return['search_criteria'] = array(
327
+		$return[ 'search_criteria' ] = array(
328 328
 			'page_size' => rgars( $return, 'settings/page_size' ),
329 329
 			'sort_field' => rgars( $return, 'settings/sort_field' ),
330 330
 			'sort_direction' => rgars( $return, 'settings/sort_direction' ),
331 331
 			'offset' => rgars( $return, 'settings/offset' ),
332 332
 		);
333 333
 
334
-		unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] );
334
+		unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] );
335 335
 
336 336
 		// Redact for non-logged ins
337 337
 		if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) {
338
-			unset( $return['settings'] );
339
-			unset( $return['search_criteria'] );
338
+			unset( $return[ 'settings' ] );
339
+			unset( $return[ 'search_criteria' ] );
340 340
 		}
341 341
 		
342 342
 		if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) {
343
-			unset( $return['form'] );
343
+			unset( $return[ 'form' ] );
344 344
 		}
345 345
 
346 346
 		return $return;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 			$view_id = func_get_arg( 1 ); // $view_id override
357 357
 		} else {
358 358
 			$url     = $request->get_url_params();
359
-			$view_id = intval( $url['id'] );
359
+			$view_id = intval( $url[ 'id' ] );
360 360
 		}
361 361
 
362 362
 		if ( ! $view = \GV\View::by_id( $view_id ) ) {
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
 		}
401 401
 
402 402
 		$url     = $request->get_url_params();
403
-		$view_id = intval( $url['id'] );
404
-		$entry_id = intval( $url['s_id'] );
403
+		$view_id = intval( $url[ 'id' ] );
404
+		$entry_id = intval( $url[ 's_id' ] );
405 405
 
406 406
 		$view = \GV\View::by_id( $view_id );
407 407
 
@@ -409,11 +409,11 @@  discard block
 block discarded – undo
409 409
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
410 410
 		}
411 411
 
412
-		if ( $entry['form_id'] != $view->form->ID ) {
412
+		if ( $entry[ 'form_id' ] != $view->form->ID ) {
413 413
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
414 414
 		}
415 415
 
416
-		if ( $entry['status'] != 'active' ) {
416
+		if ( $entry[ 'status' ] != 'active' ) {
417 417
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
418 418
 		}
419 419
 
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
422 422
 		}
423 423
 
424
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
424
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
425 425
 
426 426
 		if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
427
-			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
427
+			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
428 428
 				return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
429 429
 			}
430 430
 		}
Please login to merge, or discard this patch.
includes/widgets/register-gravityview-widgets.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@
 block discarded – undo
20 20
  */
21 21
 function gravityview_register_gravityview_widgets() {
22 22
 
23
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' );
23
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' );
24 24
 
25
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' );
26
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' );
27
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' );
28
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' );
29
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' );
25
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' );
26
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' );
27
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' );
28
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' );
29
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' );
30 30
 
31
-	if( class_exists('GFPolls') ) {
32
-		include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' );
31
+	if ( class_exists( 'GFPolls' ) ) {
32
+		include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' );
33 33
 	}
34 34
 
35 35
 }
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-page-size.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 	/**
76 76
 	 * Render the page size widget
77
-     *
77
+	 *
78 78
 	 * @param array $widget_args The Widget shortcode args.
79 79
 	 * @param string $content The content.
80 80
 	 * @param string|\GV\Template_Context $context The context, if available.
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 						<?php } ?>
116 116
                     </select>
117 117
                     <input type="submit" value="Submit" style="visibility: hidden; position: absolute;" /><?php
118
-                    if( ! empty( $_GET ) ) {
119
-                        $get = $_GET;
120
-                        unset( $get['page_size'] );
121
-	                    foreach ( $get as $key => $value ) {
122
-		                    printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $key ), esc_attr( $value ) );
123
-	                    }
124
-                    }
125
-                    ?>
118
+					if( ! empty( $_GET ) ) {
119
+						$get = $_GET;
120
+						unset( $get['page_size'] );
121
+						foreach ( $get as $key => $value ) {
122
+							printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $key ), esc_attr( $value ) );
123
+						}
124
+					}
125
+					?>
126 126
                 </div>
127 127
             </form>
128 128
         </div>
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		$default_size = 25;
46 46
 
47 47
 		if ( $context instanceof \GV\Template_Context ) {
48
-			$default_size = (int) $context->view->settings->get( 'page_size' );
48
+			$default_size = (int)$context->view->settings->get( 'page_size' );
49 49
 		}
50 50
 
51 51
 		$sizes = array( 10, 25, $default_size, 50, 100 );
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 		$page_sizes = array();
58 58
 		foreach ( $sizes as $size ) {
59
-			$page_sizes [] = array(
59
+			$page_sizes [ ] = array(
60 60
 				'value' => $size,
61 61
 				'text'  => $size
62 62
 			);
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function render_frontend( $widget_args, $content = '', $context = null ) {
83 83
 
84
-		if( ! $this->pre_render_frontend() ) {
84
+		if ( ! $this->pre_render_frontend() ) {
85 85
 			return;
86 86
 		}
87 87
 
88
-		$page_size = (int) \GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) );
88
+		$page_size = (int)\GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) );
89 89
 
90 90
 		$settings = shortcode_atts( array(
91 91
 			'label'   => __( 'Page Size', 'gravityview' ),
@@ -104,20 +104,20 @@  discard block
 block discarded – undo
104 104
         <div class="gv-widget-page-size">
105 105
             <form method="get" action="<?php echo esc_url( add_query_arg( array() ) ); ?>" onchange="this.submit();">
106 106
                 <div>
107
-                    <?php if( ! empty( $settings['label'] ) ) { ?>
108
-                    <label for="gv-page_size"><?php echo esc_html( $settings['label'] ); ?></label>
107
+                    <?php if ( ! empty( $settings[ 'label' ] ) ) { ?>
108
+                    <label for="gv-page_size"><?php echo esc_html( $settings[ 'label' ] ); ?></label>
109 109
                     <?php } ?>
110 110
                     <select name="page_size" id="gv-page_size">
111
-                        <option value=""><?php echo esc_html( $settings['default_choice_text'] ); ?></option>
111
+                        <option value=""><?php echo esc_html( $settings[ 'default_choice_text' ] ); ?></option>
112 112
 						<?php
113
-						foreach ( $settings['choices'] as $choice ) { ?>
114
-                            <option value='<?php echo esc_attr( $choice['value'] ); ?>'<?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option>
113
+						foreach ( $settings[ 'choices' ] as $choice ) { ?>
114
+                            <option value='<?php echo esc_attr( $choice[ 'value' ] ); ?>'<?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option>
115 115
 						<?php } ?>
116 116
                     </select>
117 117
                     <input type="submit" value="Submit" style="visibility: hidden; position: absolute;" /><?php
118
-                    if( ! empty( $_GET ) ) {
118
+                    if ( ! empty( $_GET ) ) {
119 119
                         $get = $_GET;
120
-                        unset( $get['page_size'] );
120
+                        unset( $get[ 'page_size' ] );
121 121
 	                    foreach ( $get as $key => $value ) {
122 122
 		                    printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $key ), esc_attr( $value ) );
123 123
 	                    }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		}
151 151
 
152 152
 		// Already overridden
153
-		if ( (int) $page_size === (int) $view->settings->get( 'page_size' ) ) {
153
+		if ( (int)$page_size === (int)$view->settings->get( 'page_size' ) ) {
154 154
 			return;
155 155
 		}
156 156
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			'view' => $view,
159 159
 		) );
160 160
 
161
-		if ( ! in_array( (int) $page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) {
161
+		if ( ! in_array( (int)$page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) {
162 162
 			gravityview()->log->warning( 'The passed page size is not allowed: {page_size}. Not modifying result.', array( 'page_size' => $page_size ) );
163 163
 			return;
164 164
 		}
Please login to merge, or discard this patch.
includes/admin/class-gravityview-support-port.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 			'payment_id'       => '',
105 105
 			'customer_name'    => '',
106 106
 			'customer_email'   => '',
107
-            'price_id'         => '0',
107
+			'price_id'         => '0',
108 108
 		) );
109 109
 
110 110
 		// This is just HTML we don't need.
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 			case 3:
122 122
 				$package = 'All Access';
123 123
 				break;
124
-            case 4:
125
-                $package = 'Lifetime';
126
-                break;
124
+			case 4:
125
+				$package = 'Lifetime';
126
+				break;
127 127
 		}
128 128
 
129 129
 		$data = array(
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 			'contactEnabled' => (int)GVCommon::has_cap( 'gravityview_contact_support' ),
153 153
 			'data' => $data,
154 154
 			'translation' => $translation,
155
-            'suggest' => array(),
155
+			'suggest' => array(),
156 156
 		);
157 157
 
158 158
 		/**
159
-         * @filter `gravityview/support_port/localization_data` Filter data passed to the Support Port, before localize_script is run
159
+		 * @filter `gravityview/support_port/localization_data` Filter data passed to the Support Port, before localize_script is run
160 160
 		 * @since 2.0
161
-         * @param array $localization_data {
162
-         *   @type int $contactEnabled Can the user contact support?
163
-         *   @type array $data Support/license info
164
-         *   @type array $translation i18n strings
165
-         *   @type array $suggest Article IDs to recommend to the user (per page in the admin
166
-         * }
161
+		 * @param array $localization_data {
162
+		 *   @type int $contactEnabled Can the user contact support?
163
+		 *   @type array $data Support/license info
164
+		 *   @type array $translation i18n strings
165
+		 *   @type array $suggest Article IDs to recommend to the user (per page in the admin
166
+		 * }
167 167
 		 */
168 168
 		$localization_data = apply_filters( 'gravityview/support_port/localization_data', $localization_data );
169 169
 
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * If the user doesn't have the `gravityview_support_port` capability, returns false; then
179 179
 	 * If global setting is "hide", returns false; then
180
-     * If user preference is not set, return global setting; then
181
-     * If user preference is set, return that setting.
180
+	 * If user preference is not set, return global setting; then
181
+	 * If user preference is set, return that setting.
182 182
 	 *
183 183
 	 * @since 1.15
184
-     * @since 1.17.5 Changed behavior to respect global setting
184
+	 * @since 1.17.5 Changed behavior to respect global setting
185 185
 	 *
186 186
 	 * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
187 187
 	 *
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		$global_setting = gravityview()->plugin->settings->get( 'support_port' );
197 197
 
198 198
 		if ( empty( $global_setting ) ) {
199
-            return false;
199
+			return false;
200 200
 		}
201 201
 
202 202
 		// Get the per-user Support Port setting
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * Modifies the output of profile.php to add GravityView Support preference
233 233
 	 *
234 234
 	 * @since 1.15
235
-     * @since 1.17.5 Only show if global setting is active
235
+	 * @since 1.17.5 Only show if global setting is active
236 236
 	 *
237 237
 	 * @param WP_User $user Current user info
238 238
 	 *
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		$global_setting = gravityview()->plugin->settings->get( 'support_port' );
244 244
 
245 245
 		if ( empty( $global_setting ) ) {
246
-            return;
246
+			return;
247 247
 		}
248 248
 
249 249
 		/**
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 		) );
109 109
 
110 110
 		// This is just HTML we don't need.
111
-		unset( $response['message'] );
111
+		unset( $response[ 'message' ] );
112 112
 
113
-		switch ( intval( $response['price_id'] ) ) {
113
+		switch ( intval( $response[ 'price_id' ] ) ) {
114 114
 			default:
115 115
 			case 1:
116 116
 				$package = 'Core';
@@ -128,19 +128,19 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$data = array(
130 130
 			'email'                 => gravityview()->plugin->settings->get( 'support-email' ),
131
-			'name'                  => $response['customer_name'],
132
-			'Valid License?'        => ucwords( $response['license'] ),
133
-			'License Key'           => $response['license_key'],
131
+			'name'                  => $response[ 'customer_name' ],
132
+			'Valid License?'        => ucwords( $response[ 'license' ] ),
133
+			'License Key'           => $response[ 'license_key' ],
134 134
 			'License Level'         => $package,
135 135
 			'Site Admin Email'      => get_bloginfo( 'admin_email' ),
136 136
 			'Support Email'         => gravityview()->plugin->settings->get( 'support-email' ),
137
-			'License Limit'         => $response['license_limit'],
138
-			'Site Count'            => $response['site_count'],
139
-			'License Expires'       => $response['expires'],
140
-			'Activations Left'      => $response['activations_left'],
141
-			'Payment ID'            => $response['payment_id'],
142
-			'Payment Name'          => $response['customer_name'],
143
-			'Payment Email'         => $response['customer_email'],
137
+			'License Limit'         => $response[ 'license_limit' ],
138
+			'Site Count'            => $response[ 'site_count' ],
139
+			'License Expires'       => $response[ 'expires' ],
140
+			'Activations Left'      => $response[ 'activations_left' ],
141
+			'Payment ID'            => $response[ 'payment_id' ],
142
+			'Payment Name'          => $response[ 'customer_name' ],
143
+			'Payment Email'         => $response[ 'customer_email' ],
144 144
 			'WordPress Version'     => get_bloginfo( 'version', 'display' ),
145 145
 			'PHP Version'           => phpversion(),
146 146
 			'GravityView Version'   => \GV\Plugin::$version,
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-woothemes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 		$gv_page = gravityview()->request->is_admin( '', 'single' );
79 79
 
80 80
 		// New View or Edit View page
81
-		if( $gv_page && $pagenow === 'post-new.php' ) {
81
+		if ( $gv_page && $pagenow === 'post-new.php' ) {
82 82
 			remove_meta_box( 'woothemes-settings', 'gravityview', 'normal' );
83 83
 		}
84 84
 	}
Please login to merge, or discard this patch.