Completed
Pull Request — master (#1131)
by Gennady
24:11 queued 19:32
created
includes/widgets/search-widget/templates/search-field-single_checkbox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
 ?>
13 13
 
14 14
 <div class="gv-search-box gv-search-field-single_checkbox">
15
-	<label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" class="gv-check-radio">
16
-		<input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" <?php checked( '1', $search_field['value'], true ); ?>>
17
-			<?php if( ! gv_empty( $search_field['label'], false, false ) ) { echo esc_html(  $search_field['label'] ); } ?>
15
+	<label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" class="gv-check-radio">
16
+		<input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" <?php checked( '1', $search_field[ 'value' ], true ); ?>>
17
+			<?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { echo esc_html( $search_field[ 'label' ] ); } ?>
18 18
 	</label>
19 19
 </div>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-elegant-themes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 		}
80 80
 
81 81
 		$sidebars_widgets = wp_get_sidebars_widgets();
82
-		if ( empty( $sidebars_widgets[ $matches[1] ] ) ) {
82
+		if ( empty( $sidebars_widgets[ $matches[ 1 ] ] ) ) {
83 83
 			return $shortcodes;
84 84
 		}
85 85
 
86
-		foreach ( $sidebars_widgets[ $matches[1] ] as $widgets ) {
86
+		foreach ( $sidebars_widgets[ $matches[ 1 ] ] as $widgets ) {
87 87
 			if (
88 88
 				/**
89 89
 				 * Blacklisted widgets.
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				strpos( $widgets, 'gv_recent_entries' ) === 0
93 93
 			) {
94 94
 
95
-					$shortcodes []= 'et_pb_sidebar';
95
+					$shortcodes [ ] = 'et_pb_sidebar';
96 96
 					break;
97 97
 			}
98 98
 		}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-excerpt.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@
 block discarded – undo
22 22
 
23 23
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
24 24
 
25
-		unset( $field_options['show_as_link'] );
25
+		unset( $field_options[ 'show_as_link' ] );
26 26
 
27
-		if( 'edit' === $context ) {
27
+		if ( 'edit' === $context ) {
28 28
 			return $field_options;
29 29
 		}
30 30
 
31
-		$this->add_field_support('dynamic_data', $field_options );
31
+		$this->add_field_support( 'dynamic_data', $field_options );
32 32
 
33 33
 		return $field_options;
34 34
 	}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 
943 943
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
944 944
 
945
-			if( ! $this->is_valid ){
945
+			if( ! $this->is_valid ) {
946 946
 
947 947
 				// Keeping this compatible with Gravity Forms.
948 948
 				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
@@ -1996,9 +1996,7 @@  discard block
 block discarded – undo
1996 1996
 		// Verify
1997 1997
 		else if( ! $this->is_edit_entry() ) {
1998 1998
 			$valid = false;
1999
-		}
2000
-
2001
-		else {
1999
+		} else {
2002 2000
 			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2003 2001
 		}
2004 2002
 
Please login to merge, or discard this patch.
Indentation   +264 added lines, -264 removed lines patch added patch discarded remove patch
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 
95 95
 	/**
96 96
 	 * ID of the current post. May also be ID of the current View.
97
-     *
98
-     * @since 2.0.13
99
-     * 
100
-     * @var int
97
+	 *
98
+	 * @since 2.0.13
99
+	 * 
100
+	 * @var int
101 101
 	 */
102 102
 	public $post_id;
103 103
 
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171 171
 		if( ! empty( $_POST ) ) {
172
-	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
172
+			gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175 175
 		if( $this->is_edit_entry_submission() ) {
176 176
 			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
177
+			remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	 * When Edit entry view is requested setup the vars
203 203
 	 */
204 204
 	private function setup_vars() {
205
-        global $post;
205
+		global $post;
206 206
 
207 207
 		$gravityview_view = GravityView_View::getInstance();
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+		self::$original_entry = $entries[0];
212
+		$this->entry = $entries[0];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 
332 332
 			GFFormsModel::save_lead( $form, $this->entry );
333 333
 
334
-	        // Delete the values for hidden inputs
335
-	        $this->unset_hidden_field_values();
334
+			// Delete the values for hidden inputs
335
+			$this->unset_hidden_field_values();
336 336
 			
337 337
 			$this->entry['date_created'] = $date_created;
338 338
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			// Perform actions normally performed after updating a lead
343 343
 			$this->after_update();
344 344
 
345
-	        /**
345
+			/**
346 346
 			 * Must be AFTER after_update()!
347 347
 			 * @see https://github.com/gravityview/GravityView/issues/764
348 348
 			 */
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 * @return void
373 373
 	 */
374 374
 	private function unset_hidden_field_values() {
375
-	    global $wpdb;
375
+		global $wpdb;
376 376
 
377 377
 		/**
378 378
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -394,27 +394,27 @@  discard block
 block discarded – undo
394 394
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
395 395
 		}
396 396
 
397
-	    foreach ( $this->entry as $input_id => $field_value ) {
397
+		foreach ( $this->entry as $input_id => $field_value ) {
398 398
 
399
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
399
+			$field = RGFormsModel::get_field( $this->form, $input_id );
400 400
 
401
-		    // Reset fields that are hidden
402
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
403
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
401
+			// Reset fields that are hidden
402
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
403
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
404 404
 
405
-		        // List fields are stored as empty arrays when empty
406
-			    $empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
405
+				// List fields are stored as empty arrays when empty
406
+				$empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
407 407
 
408
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
408
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
409 409
 
410
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
410
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
411 411
 
412
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
412
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
413 413
 				// after submission
414
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
415
-			    $_POST[ $post_input_id ] = '';
416
-		    }
417
-	    }
414
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
415
+				$_POST[ $post_input_id ] = '';
416
+			}
417
+		}
418 418
 	}
419 419
 
420 420
 	/**
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 
509 509
 		$form = $this->form;
510 510
 
511
-	    /** @var GF_Field $field */
511
+		/** @var GF_Field $field */
512 512
 		foreach( $form['fields'] as $k => &$field ) {
513 513
 
514 514
 			/**
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 
525 525
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
526 526
 				foreach( $field->inputs as $key => $input ) {
527
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
527
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
528 528
 				}
529 529
 			}
530 530
 		}
@@ -545,13 +545,13 @@  discard block
 block discarded – undo
545 545
 			foreach ( $this->fields_with_calculation as $calc_field ) {
546 546
 				$inputs = $calc_field->get_entry_inputs();
547 547
 				if ( is_array( $inputs ) ) {
548
-				    foreach ( $inputs as $input ) {
549
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
550
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
551
-				    }
548
+					foreach ( $inputs as $input ) {
549
+						$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
550
+						$entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
551
+					}
552 552
 				} else {
553
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
554
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
553
+					$input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
554
+					$entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
555 555
 				}
556 556
 			}
557 557
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
600 600
 
601 601
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
602
-	        $ary = stripslashes_deep( $ary );
602
+			$ary = stripslashes_deep( $ary );
603 603
 			$img_url = \GV\Utils::get( $ary, 0 );
604 604
 
605 605
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 	private function maybe_update_post_fields( $form ) {
673 673
 
674 674
 		if( empty( $this->entry['post_id'] ) ) {
675
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
675
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
676 676
 			return;
677 677
 		}
678 678
 
@@ -707,51 +707,51 @@  discard block
 block discarded – undo
707 707
 
708 708
 				switch( $field->type ) {
709 709
 
710
-				    case 'post_title':
711
-				        $post_title = $value;
712
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
713
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
714
-				        }
715
-				        $updated_post->post_title = $post_title;
716
-				        $updated_post->post_name  = $post_title;
717
-				        unset( $post_title );
718
-				        break;
719
-
720
-				    case 'post_content':
721
-				        $post_content = $value;
722
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
723
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
724
-				        }
725
-				        $updated_post->post_content = $post_content;
726
-				        unset( $post_content );
727
-				        break;
728
-				    case 'post_excerpt':
729
-				        $updated_post->post_excerpt = $value;
730
-				        break;
731
-				    case 'post_tags':
732
-				        wp_set_post_tags( $post_id, $value, false );
733
-				        break;
734
-				    case 'post_category':
735
-				        break;
736
-				    case 'post_custom_field':
710
+					case 'post_title':
711
+						$post_title = $value;
712
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
713
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
714
+						}
715
+						$updated_post->post_title = $post_title;
716
+						$updated_post->post_name  = $post_title;
717
+						unset( $post_title );
718
+						break;
719
+
720
+					case 'post_content':
721
+						$post_content = $value;
722
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
723
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
724
+						}
725
+						$updated_post->post_content = $post_content;
726
+						unset( $post_content );
727
+						break;
728
+					case 'post_excerpt':
729
+						$updated_post->post_excerpt = $value;
730
+						break;
731
+					case 'post_tags':
732
+						wp_set_post_tags( $post_id, $value, false );
733
+						break;
734
+					case 'post_category':
735
+						break;
736
+					case 'post_custom_field':
737 737
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
738 738
 							$value = $value[ $field_id ];
739 739
 						}
740 740
 
741
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
742
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
743
-				        }
741
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
742
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
743
+						}
744 744
 
745
-	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
746
-		                    $value = wp_json_encode( $value );
747
-	                    }
745
+						if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
746
+							$value = wp_json_encode( $value );
747
+						}
748 748
 
749
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
750
-				        break;
749
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
750
+						break;
751 751
 
752
-				    case 'post_image':
753
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
754
-				        break;
752
+					case 'post_image':
753
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
754
+						break;
755 755
 
756 756
 				}
757 757
 
@@ -796,20 +796,20 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	private function is_field_json_encoded( $field ) {
798 798
 
799
-	    $json_encoded = false;
799
+		$json_encoded = false;
800 800
 
801 801
 		$input_type = RGFormsModel::get_input_type( $field );
802 802
 
803
-	    // Only certain custom field types are supported
804
-	    switch( $input_type ) {
805
-		    case 'fileupload':
806
-		    case 'list':
807
-		    case 'multiselect':
808
-			    $json_encoded = true;
809
-			    break;
810
-	    }
803
+		// Only certain custom field types are supported
804
+		switch( $input_type ) {
805
+			case 'fileupload':
806
+			case 'list':
807
+			case 'multiselect':
808
+				$json_encoded = true;
809
+				break;
810
+		}
811 811
 
812
-	    return $json_encoded;
812
+		return $json_encoded;
813 813
 	}
814 814
 
815 815
 	/**
@@ -899,14 +899,14 @@  discard block
 block discarded – undo
899 899
 			?><h2 class="gv-edit-entry-title">
900 900
 				<span><?php
901 901
 
902
-				    /**
903
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
904
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
905
-				     * @param GravityView_Edit_Entry_Render $this This object
906
-				     */
907
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
902
+					/**
903
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
904
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
905
+					 * @param GravityView_Edit_Entry_Render $this This object
906
+					 */
907
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
908 908
 
909
-				    echo esc_attr( $edit_entry_title );
909
+					echo esc_attr( $edit_entry_title );
910 910
 			?></span>
911 911
 			</h2>
912 912
 
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 
1016 1016
 		ob_get_clean();
1017 1017
 
1018
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1018
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1019 1019
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1020 1020
 		remove_filter( 'gform_disable_view_counter', '__return_true' );
1021 1021
 		remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 );
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 
1070 1070
 		// for now we don't support Save and Continue feature.
1071 1071
 		if( ! self::$supports_save_and_continue ) {
1072
-	        unset( $form['save'] );
1072
+			unset( $form['save'] );
1073 1073
 		}
1074 1074
 
1075 1075
 		return $form;
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 			|| ! empty( $field_content )
1145 1145
 			|| in_array( $field->type, array( 'honeypot' ) )
1146 1146
 		) {
1147
-	        return $field_content;
1147
+			return $field_content;
1148 1148
 		}
1149 1149
 
1150 1150
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1152,24 +1152,24 @@  discard block
 block discarded – undo
1152 1152
 
1153 1153
 		$field_value = $this->get_field_value( $field );
1154 1154
 
1155
-	    // Prevent any PHP warnings, like undefined index
1156
-	    ob_start();
1155
+		// Prevent any PHP warnings, like undefined index
1156
+		ob_start();
1157 1157
 
1158
-	    $return = null;
1158
+		$return = null;
1159 1159
 
1160 1160
 		/** @var GravityView_Field $gv_field */
1161 1161
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1162 1162
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1163 1163
 		} else {
1164
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1165
-	    }
1164
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1165
+		}
1166 1166
 
1167
-	    // If there was output, it's an error
1168
-	    $warnings = ob_get_clean();
1167
+		// If there was output, it's an error
1168
+		$warnings = ob_get_clean();
1169 1169
 
1170
-	    if( !empty( $warnings ) ) {
1171
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1172
-	    }
1170
+		if( !empty( $warnings ) ) {
1171
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1172
+		}
1173 1173
 
1174 1174
 		return $return;
1175 1175
 	}
@@ -1204,8 +1204,8 @@  discard block
 block discarded – undo
1204 1204
 				$input_id = strval( $input['id'] );
1205 1205
 				
1206 1206
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1207
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1208
-				    $allow_pre_populated = false;
1207
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1208
+					$allow_pre_populated = false;
1209 1209
 				}
1210 1210
 
1211 1211
 			}
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1230 1230
 				$categories = array();
1231 1231
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1232
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1232
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1233 1233
 				}
1234 1234
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1235 1235
 			}
@@ -1239,25 +1239,25 @@  discard block
 block discarded – undo
1239 1239
 		// if value is empty get the default value if defined
1240 1240
 		$field_value = $field->get_value_default_if_empty( $field_value );
1241 1241
 
1242
-	    /**
1243
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1244
-	     * @since 1.11
1245
-	     * @since 1.20 Added third param
1246
-	     * @param mixed $field_value field value used to populate the input
1247
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1248
-	     * @param GravityView_Edit_Entry_Render $this Current object
1249
-	     */
1250
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1251
-
1252
-	    /**
1253
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1254
-	     * @since 1.17
1255
-	     * @since 1.20 Added third param
1256
-	     * @param mixed $field_value field value used to populate the input
1257
-	     * @param GF_Field $field Gravity Forms field object
1258
-	     * @param GravityView_Edit_Entry_Render $this Current object
1259
-	     */
1260
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1242
+		/**
1243
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1244
+		 * @since 1.11
1245
+		 * @since 1.20 Added third param
1246
+		 * @param mixed $field_value field value used to populate the input
1247
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1248
+		 * @param GravityView_Edit_Entry_Render $this Current object
1249
+		 */
1250
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1251
+
1252
+		/**
1253
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1254
+		 * @since 1.17
1255
+		 * @since 1.20 Added third param
1256
+		 * @param mixed $field_value field value used to populate the input
1257
+		 * @param GF_Field $field Gravity Forms field object
1258
+		 * @param GravityView_Edit_Entry_Render $this Current object
1259
+		 */
1260
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1261 1261
 
1262 1262
 		return $field_value;
1263 1263
 	}
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1285 1285
 			// expects certain field array items to be set.
1286 1286
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1287
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1287
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1288 1288
 			}
1289 1289
 
1290 1290
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1298,61 +1298,61 @@  discard block
 block discarded – undo
1298 1298
 				 */
1299 1299
 				case 'fileupload':
1300 1300
 
1301
-				    // Set the previous value
1302
-				    $entry = $this->get_entry();
1301
+					// Set the previous value
1302
+					$entry = $this->get_entry();
1303 1303
 
1304
-				    $input_name = 'input_'.$field->id;
1305
-				    $form_id = $form['id'];
1304
+					$input_name = 'input_'.$field->id;
1305
+					$form_id = $form['id'];
1306 1306
 
1307
-				    $value = NULL;
1307
+					$value = NULL;
1308 1308
 
1309
-				    // Use the previous entry value as the default.
1310
-				    if( isset( $entry[ $field->id ] ) ) {
1311
-				        $value = $entry[ $field->id ];
1312
-				    }
1309
+					// Use the previous entry value as the default.
1310
+					if( isset( $entry[ $field->id ] ) ) {
1311
+						$value = $entry[ $field->id ];
1312
+					}
1313 1313
 
1314
-				    // If this is a single upload file
1315
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1316
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1317
-				        $value = $file_path['url'];
1314
+					// If this is a single upload file
1315
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1316
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1317
+						$value = $file_path['url'];
1318 1318
 
1319
-				    } else {
1319
+					} else {
1320 1320
 
1321
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1322
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1323
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1321
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1322
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1323
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1324 1324
 
1325
-				    }
1325
+					}
1326 1326
 
1327
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1327
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1328 1328
 
1329
-				        // If there are fresh uploads, process and merge them.
1330
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1331
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1332
-				            $value = empty( $value ) ? '[]' : $value;
1333
-				            $value = stripslashes_deep( $value );
1334
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1335
-				        }
1329
+						// If there are fresh uploads, process and merge them.
1330
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1331
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1332
+							$value = empty( $value ) ? '[]' : $value;
1333
+							$value = stripslashes_deep( $value );
1334
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1335
+						}
1336 1336
 
1337
-				    } else {
1337
+					} else {
1338 1338
 
1339
-				        // A file already exists when editing an entry
1340
-				        // We set this to solve issue when file upload fields are required.
1341
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1339
+						// A file already exists when editing an entry
1340
+						// We set this to solve issue when file upload fields are required.
1341
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1342 1342
 
1343
-				    }
1343
+					}
1344 1344
 
1345
-				    $this->entry[ $input_name ] = $value;
1346
-				    $_POST[ $input_name ] = $value;
1345
+					$this->entry[ $input_name ] = $value;
1346
+					$_POST[ $input_name ] = $value;
1347 1347
 
1348
-				    break;
1348
+					break;
1349 1349
 
1350 1350
 				case 'number':
1351
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1352
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1353
-				        $_POST['input_'.$field->id ] = NULL;
1354
-				    }
1355
-				    break;
1351
+					// Fix "undefined index" issue at line 1286 in form_display.php
1352
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1353
+						$_POST['input_'.$field->id ] = NULL;
1354
+					}
1355
+					break;
1356 1356
 			}
1357 1357
 
1358 1358
 		}
@@ -1437,42 +1437,42 @@  discard block
 block discarded – undo
1437 1437
 				case 'fileupload' :
1438 1438
 				case 'post_image':
1439 1439
 
1440
-				    // in case nothing is uploaded but there are already files saved
1441
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1442
-				        $field->failed_validation = false;
1443
-				        unset( $field->validation_message );
1444
-				    }
1440
+					// in case nothing is uploaded but there are already files saved
1441
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1442
+						$field->failed_validation = false;
1443
+						unset( $field->validation_message );
1444
+					}
1445 1445
 
1446
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1447
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1446
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1447
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1448 1448
 
1449
-				        $input_name = 'input_' . $field->id;
1450
-				        //uploaded
1451
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1449
+						$input_name = 'input_' . $field->id;
1450
+						//uploaded
1451
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1452 1452
 
1453
-				        //existent
1454
-				        $entry = $this->get_entry();
1455
-				        $value = NULL;
1456
-				        if( isset( $entry[ $field->id ] ) ) {
1457
-				            $value = json_decode( $entry[ $field->id ], true );
1458
-				        }
1453
+						//existent
1454
+						$entry = $this->get_entry();
1455
+						$value = NULL;
1456
+						if( isset( $entry[ $field->id ] ) ) {
1457
+							$value = json_decode( $entry[ $field->id ], true );
1458
+						}
1459 1459
 
1460
-				        // count uploaded files and existent entry files
1461
-				        $count_files = count( $file_names ) + count( $value );
1460
+						// count uploaded files and existent entry files
1461
+						$count_files = count( $file_names ) + count( $value );
1462 1462
 
1463
-				        if( $count_files > $field->maxFiles ) {
1464
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1465
-				            $field->failed_validation = 1;
1466
-				            $gv_valid = false;
1463
+						if( $count_files > $field->maxFiles ) {
1464
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1465
+							$field->failed_validation = 1;
1466
+							$gv_valid = false;
1467 1467
 
1468
-				            // in case of error make sure the newest upload files are removed from the upload input
1469
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1470
-				        }
1468
+							// in case of error make sure the newest upload files are removed from the upload input
1469
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1470
+						}
1471 1471
 
1472
-				    }
1472
+					}
1473 1473
 
1474 1474
 
1475
-				    break;
1475
+					break;
1476 1476
 
1477 1477
 			}
1478 1478
 
@@ -1483,47 +1483,47 @@  discard block
 block discarded – undo
1483 1483
 
1484 1484
 				switch ( $field_type ) {
1485 1485
 
1486
-				    // Captchas don't need to be re-entered.
1487
-				    case 'captcha':
1486
+					// Captchas don't need to be re-entered.
1487
+					case 'captcha':
1488 1488
 
1489
-				        // Post Image fields aren't editable, so we un-fail them.
1490
-				    case 'post_image':
1491
-				        $field->failed_validation = false;
1492
-				        unset( $field->validation_message );
1493
-				        break;
1489
+						// Post Image fields aren't editable, so we un-fail them.
1490
+					case 'post_image':
1491
+						$field->failed_validation = false;
1492
+						unset( $field->validation_message );
1493
+						break;
1494 1494
 
1495 1495
 				}
1496 1496
 
1497 1497
 				// You can't continue inside a switch, so we do it after.
1498 1498
 				if( empty( $field->failed_validation ) ) {
1499
-				    continue;
1499
+					continue;
1500 1500
 				}
1501 1501
 
1502 1502
 				// checks if the No Duplicates option is not validating entry against itself, since
1503 1503
 				// we're editing a stored entry, it would also assume it's a duplicate.
1504 1504
 				if( !empty( $field->noDuplicates ) ) {
1505 1505
 
1506
-				    $entry = $this->get_entry();
1506
+					$entry = $this->get_entry();
1507 1507
 
1508
-				    // If the value of the entry is the same as the stored value
1509
-				    // Then we can assume it's not a duplicate, it's the same.
1510
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1511
-				        //if value submitted was not changed, then don't validate
1512
-				        $field->failed_validation = false;
1508
+					// If the value of the entry is the same as the stored value
1509
+					// Then we can assume it's not a duplicate, it's the same.
1510
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1511
+						//if value submitted was not changed, then don't validate
1512
+						$field->failed_validation = false;
1513 1513
 
1514
-				        unset( $field->validation_message );
1514
+						unset( $field->validation_message );
1515 1515
 
1516
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1516
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1517 1517
 
1518
-				        continue;
1519
-				    }
1518
+						continue;
1519
+					}
1520 1520
 				}
1521 1521
 
1522 1522
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1523 1523
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1524
-				    unset( $field->validation_message );
1525
-	                $field->validation_message = false;
1526
-				    continue;
1524
+					unset( $field->validation_message );
1525
+					$field->validation_message = false;
1526
+					continue;
1527 1527
 				}
1528 1528
 
1529 1529
 				$gv_valid = false;
@@ -1587,8 +1587,8 @@  discard block
 block discarded – undo
1587 1587
 		// Hide fields depending on admin settings
1588 1588
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1589 1589
 
1590
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1591
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1590
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1591
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1592 1592
 
1593 1593
 		/**
1594 1594
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1648,11 +1648,11 @@  discard block
 block discarded – undo
1648 1648
 		// The edit tab has been configured, so we loop through to configured settings
1649 1649
 		foreach ( $configured_fields as $configured_field ) {
1650 1650
 
1651
-	        /** @var GF_Field $field */
1652
-	        foreach ( $fields as $field ) {
1651
+			/** @var GF_Field $field */
1652
+			foreach ( $fields as $field ) {
1653 1653
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1654
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1655
-				    break;
1654
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1655
+					break;
1656 1656
 				}
1657 1657
 
1658 1658
 			}
@@ -1708,28 +1708,28 @@  discard block
 block discarded – undo
1708 1708
 	 */
1709 1709
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1710 1710
 
1711
-	    /**
1711
+		/**
1712 1712
 		 * @filter `gravityview/edit_entry/use_gf_admin_only_setting` When Edit tab isn't configured, should the Gravity Forms "Admin Only" field settings be used to control field display to non-admins? Default: true
1713
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1714
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1715
-	     * @since 1.9.1
1716
-	     * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
1717
-	     * @param array $form GF Form array
1718
-	     * @param int $view_id View ID
1719
-	     */
1720
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1721
-
1722
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1713
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1714
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1715
+		 * @since 1.9.1
1716
+		 * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
1717
+		 * @param array $form GF Form array
1718
+		 * @param int $view_id View ID
1719
+		 */
1720
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1721
+
1722
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1723 1723
 			foreach( $fields as $k => $field ) {
1724 1724
 				if( $field->adminOnly ) {
1725
-				    unset( $fields[ $k ] );
1725
+					unset( $fields[ $k ] );
1726 1726
 				}
1727 1727
 			}
1728 1728
 			return $fields;
1729 1729
 		}
1730 1730
 
1731
-	    foreach( $fields as &$field ) {
1732
-		    $field->adminOnly = false;
1731
+		foreach( $fields as &$field ) {
1732
+			$field->adminOnly = false;
1733 1733
 		}
1734 1734
 
1735 1735
 		return $fields;
@@ -1762,36 +1762,36 @@  discard block
 block discarded – undo
1762 1762
 
1763 1763
 			if( 'checkbox' === $field->type ) {
1764 1764
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1765
-				    $input_id = $input['id'];
1766
-				    $choice = $field->choices[ $key ];
1767
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1768
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1769
-				    if( $match ) {
1770
-				        $field->choices[ $key ]['isSelected'] = true;
1771
-				    }
1765
+					$input_id = $input['id'];
1766
+					$choice = $field->choices[ $key ];
1767
+					$value = \GV\Utils::get( $this->entry, $input_id );
1768
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1769
+					if( $match ) {
1770
+						$field->choices[ $key ]['isSelected'] = true;
1771
+					}
1772 1772
 				}
1773 1773
 			} else {
1774 1774
 
1775 1775
 				// We need to run through each field to set the default values
1776 1776
 				foreach ( $this->entry as $field_id => $field_value ) {
1777 1777
 
1778
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1778
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1779 1779
 
1780
-				        if( 'list' === $field->type ) {
1781
-				            $list_rows = maybe_unserialize( $field_value );
1780
+						if( 'list' === $field->type ) {
1781
+							$list_rows = maybe_unserialize( $field_value );
1782 1782
 
1783
-				            $list_field_value = array();
1784
-				            foreach ( (array) $list_rows as $row ) {
1785
-				                foreach ( (array) $row as $column ) {
1786
-				                    $list_field_value[] = $column;
1787
-				                }
1788
-				            }
1783
+							$list_field_value = array();
1784
+							foreach ( (array) $list_rows as $row ) {
1785
+								foreach ( (array) $row as $column ) {
1786
+									$list_field_value[] = $column;
1787
+								}
1788
+							}
1789 1789
 
1790
-				            $field->defaultValue = serialize( $list_field_value );
1791
-				        } else {
1792
-				            $field->defaultValue = $field_value;
1793
-				        }
1794
-				    }
1790
+							$field->defaultValue = serialize( $list_field_value );
1791
+						} else {
1792
+							$field->defaultValue = $field_value;
1793
+						}
1794
+					}
1795 1795
 				}
1796 1796
 			}
1797 1797
 		}
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
 			return $has_conditional_logic;
1849 1849
 		}
1850 1850
 
1851
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1851
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1852 1852
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
1853 1853
 	}
1854 1854
 
@@ -1915,14 +1915,14 @@  discard block
 block discarded – undo
1915 1915
 
1916 1916
 		if( $echo && $error !== true ) {
1917 1917
 
1918
-	        $error = esc_html( $error );
1918
+			$error = esc_html( $error );
1919 1919
 
1920
-	        /**
1921
-	         * @since 1.9
1922
-	         */
1923
-	        if ( ! empty( $this->entry ) ) {
1924
-		        $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1925
-	        }
1920
+			/**
1921
+			 * @since 1.9
1922
+			 */
1923
+			if ( ! empty( $this->entry ) ) {
1924
+				$error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1925
+			}
1926 1926
 
1927 1927
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1928 1928
 		}
Please login to merge, or discard this patch.
Spacing   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 	function load() {
116 116
 
117 117
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
118
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
118
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
119 119
 
120 120
 		// Don't display an embedded form when editing an entry
121 121
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
122 122
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
123 123
 
124 124
 		// Stop Gravity Forms processing what is ours!
125
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
125
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
126 126
 
127
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
127
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
128 128
 
129 129
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
130 130
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
136 136
 
137 137
 		// Add fields expected by GFFormDisplay::validate()
138
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
138
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
139 139
 
140 140
 		// Fix multiselect value for GF 2.2
141 141
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @return void
153 153
 	 */
154 154
 	public function prevent_render_form() {
155
-		if( $this->is_edit_entry() ) {
156
-			if( 'wp_head' === current_filter() ) {
155
+		if ( $this->is_edit_entry() ) {
156
+			if ( 'wp_head' === current_filter() ) {
157 157
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
158 158
 			} else {
159 159
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171
-		if( ! empty( $_POST ) ) {
171
+		if ( ! empty( $_POST ) ) {
172 172
 	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175
-		if( $this->is_edit_entry_submission() ) {
176
-			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
175
+		if ( $this->is_edit_entry_submission() ) {
176
+			remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
177
+	        remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function is_edit_entry() {
186 186
 
187
-		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
187
+		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
188 188
 
189 189
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
190 190
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @return boolean
196 196
 	 */
197 197
 	public function is_edit_entry_submission() {
198
-		return !empty( $_POST[ self::$nonce_field ] );
198
+		return ! empty( $_POST[ self::$nonce_field ] );
199 199
 	}
200 200
 
201 201
 	/**
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+	    self::$original_entry = $entries[ 0 ];
212
+	    $this->entry = $entries[ 0 ];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		$this->view_id = $gravityview_view->getViewId();
218 218
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
219 219
 
220
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
220
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
221 221
 	}
222 222
 
223 223
 
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 		}
242 242
 
243 243
 		// Multiple Views embedded, don't proceed if nonce fails
244
-		if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) {
244
+		if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) {
245 245
 			gravityview()->log->error( 'Nonce validation failed for the Edit Entry request; returning' );
246 246
 			return;
247 247
 		}
248 248
 
249 249
 		// Sorry, you're not allowed here.
250
-		if( false === $this->user_can_edit_entry( true ) ) {
250
+		if ( false === $this->user_can_edit_entry( true ) ) {
251 251
 			gravityview()->log->error( 'User is not allowed to edit this entry; returning', array( 'data' => $this->entry ) );
252 252
 			return;
253 253
 		}
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 	private function print_scripts() {
269 269
 		$gravityview_view = GravityView_View::getInstance();
270 270
 
271
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
271
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
272 272
 
273
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
273
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
274 274
 
275 275
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
276 276
 
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	private function process_save() {
286 286
 
287
-		if( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
287
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
288 288
 			return;
289 289
 		}
290 290
 
291 291
 		// Make sure the entry, view, and form IDs are all correct
292 292
 		$valid = $this->verify_nonce();
293 293
 
294
-		if( !$valid ) {
294
+		if ( ! $valid ) {
295 295
 			gravityview()->log->error( 'Nonce validation failed.' );
296 296
 			return;
297 297
 		}
298 298
 
299
-		if( $this->entry['id'] !== $_POST['lid'] ) {
299
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
300 300
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
301 301
 			return;
302 302
 		}
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
 		$this->validate();
309 309
 
310
-		if( $this->is_valid ) {
310
+		if ( $this->is_valid ) {
311 311
 
312 312
 			gravityview()->log->debug( 'Submission is valid.' );
313 313
 
@@ -319,22 +319,22 @@  discard block
 block discarded – undo
319 319
 			/**
320 320
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
321 321
 			 */
322
-			unset( $_GET['page'] );
322
+			unset( $_GET[ 'page' ] );
323 323
 
324
-			$date_created = $this->entry['date_created'];
324
+			$date_created = $this->entry[ 'date_created' ];
325 325
 
326 326
 			/**
327 327
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
328 328
 			 * @since 1.17.2
329 329
 			 */
330
-			unset( $this->entry['date_created'] );
330
+			unset( $this->entry[ 'date_created' ] );
331 331
 
332 332
 			GFFormsModel::save_lead( $form, $this->entry );
333 333
 
334 334
 	        // Delete the values for hidden inputs
335 335
 	        $this->unset_hidden_field_values();
336 336
 			
337
-			$this->entry['date_created'] = $date_created;
337
+			$this->entry[ 'date_created' ] = $date_created;
338 338
 
339 339
 			// Process calculation fields
340 340
 			$this->update_calculation_fields();
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 			 * @param string $entry_id Numeric ID of the entry that was updated
355 355
 			 * @param GravityView_Edit_Entry_Render $this This object
356 356
 			 */
357
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this );
357
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this );
358 358
 
359 359
 		} else {
360 360
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
 		 */
383 383
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
384 384
 
385
-		if( ! $unset_hidden_field_values ) {
385
+		if ( ! $unset_hidden_field_values ) {
386 386
 			return;
387 387
 		}
388 388
 
389 389
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
390 390
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
391
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
391
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
392 392
 		} else {
393 393
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
394
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
394
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
395 395
 		}
396 396
 
397 397
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		}
473 473
 
474 474
 		/** No file is being uploaded. */
475
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
475
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
476 476
 			/** So return the original upload */
477 477
 			return $entry[ $input_id ];
478 478
 		}
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 	 * @return mixed
491 491
 	 */
492 492
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
493
-		if( ! $this->is_edit_entry() ) {
493
+		if ( ! $this->is_edit_entry() ) {
494 494
 			return $plupload_init;
495 495
 		}
496 496
 
497
-		$plupload_init['gf_vars']['max_files'] = 0;
497
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
498 498
 
499 499
 		return $plupload_init;
500 500
 	}
@@ -509,22 +509,22 @@  discard block
 block discarded – undo
509 509
 		$form = $this->form;
510 510
 
511 511
 	    /** @var GF_Field $field */
512
-		foreach( $form['fields'] as $k => &$field ) {
512
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
513 513
 
514 514
 			/**
515 515
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
516 516
 			 * @since 1.16.3
517 517
 			 * @var GF_Field $field
518 518
 			 */
519
-			if( $field->has_calculation() ) {
520
-				unset( $form['fields'][ $k ] );
519
+			if ( $field->has_calculation() ) {
520
+				unset( $form[ 'fields' ][ $k ] );
521 521
 			}
522 522
 
523 523
 			$field->adminOnly = false;
524 524
 
525
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
526
-				foreach( $field->inputs as $key => $input ) {
527
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
525
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
526
+				foreach ( $field->inputs as $key => $input ) {
527
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
528 528
 				}
529 529
 			}
530 530
 		}
@@ -538,30 +538,30 @@  discard block
 block discarded – undo
538 538
 		$update = false;
539 539
 
540 540
 		// get the most up to date entry values
541
-		$entry = GFAPI::get_entry( $this->entry['id'] );
541
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
542 542
 
543
-		if( !empty( $this->fields_with_calculation ) ) {
543
+		if ( ! empty( $this->fields_with_calculation ) ) {
544 544
 			$update = true;
545 545
 			foreach ( $this->fields_with_calculation as $calc_field ) {
546 546
 				$inputs = $calc_field->get_entry_inputs();
547 547
 				if ( is_array( $inputs ) ) {
548 548
 				    foreach ( $inputs as $input ) {
549
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
550
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
549
+				        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
550
+				        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
551 551
 				    }
552 552
 				} else {
553
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
554
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
553
+				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
554
+				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
555 555
 				}
556 556
 			}
557 557
 
558 558
 		}
559 559
 
560
-		if( $update ) {
560
+		if ( $update ) {
561 561
 
562 562
 			$return_entry = GFAPI::update_entry( $entry );
563 563
 
564
-			if( is_wp_error( $return_entry ) ) {
564
+			if ( is_wp_error( $return_entry ) ) {
565 565
 				gravityview()->log->error( 'Updating the entry calculation fields failed', array( 'data' => $return_entry ) );
566 566
 			} else {
567 567
 				gravityview()->log->debug( 'Updating the entry calculation fields succeeded' );
@@ -592,19 +592,19 @@  discard block
 block discarded – undo
592 592
 
593 593
 		$input_name = 'input_' . $field_id;
594 594
 
595
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
595
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
596 596
 
597 597
 			// We have a new image
598 598
 
599
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
599
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
600 600
 
601 601
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
602 602
 	        $ary = stripslashes_deep( $ary );
603 603
 			$img_url = \GV\Utils::get( $ary, 0 );
604 604
 
605
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
606
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
607
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
605
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
606
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
607
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
608 608
 
609 609
 			$image_meta = array(
610 610
 				'post_excerpt' => $img_caption,
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 
614 614
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
615 615
 			if ( ! empty( $img_title ) ) {
616
-				$image_meta['post_title'] = $img_title;
616
+				$image_meta[ 'post_title' ] = $img_title;
617 617
 			}
618 618
 
619 619
 			/**
@@ -671,15 +671,15 @@  discard block
 block discarded – undo
671 671
 	 */
672 672
 	private function maybe_update_post_fields( $form ) {
673 673
 
674
-		if( empty( $this->entry['post_id'] ) ) {
674
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
675 675
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
676 676
 			return;
677 677
 		}
678 678
 
679
-		$post_id = $this->entry['post_id'];
679
+		$post_id = $this->entry[ 'post_id' ];
680 680
 
681 681
 		// Security check
682
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
682
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
683 683
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
684 684
 			return;
685 685
 		}
@@ -692,25 +692,25 @@  discard block
 block discarded – undo
692 692
 
693 693
 			$field = RGFormsModel::get_field( $form, $field_id );
694 694
 
695
-			if( ! $field ) {
695
+			if ( ! $field ) {
696 696
 				continue;
697 697
 			}
698 698
 
699
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
699
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
700 700
 
701 701
 				// Get the value of the field, including $_POSTed value
702 702
 				$value = RGFormsModel::get_field_value( $field );
703 703
 
704 704
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
705 705
 				$entry_tmp = $this->entry;
706
-				$entry_tmp["{$field_id}"] = $value;
706
+				$entry_tmp[ "{$field_id}" ] = $value;
707 707
 
708
-				switch( $field->type ) {
708
+				switch ( $field->type ) {
709 709
 
710 710
 				    case 'post_title':
711 711
 				        $post_title = $value;
712 712
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
713
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
713
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
714 714
 				        }
715 715
 				        $updated_post->post_title = $post_title;
716 716
 				        $updated_post->post_name  = $post_title;
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 				    case 'post_content':
721 721
 				        $post_content = $value;
722 722
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
723
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
723
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
724 724
 				        }
725 725
 				        $updated_post->post_content = $post_content;
726 726
 				        unset( $post_content );
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 							$value = $value[ $field_id ];
739 739
 						}
740 740
 
741
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
741
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
742 742
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
743 743
 				        }
744 744
 
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 				}
757 757
 
758 758
 				// update entry after
759
-				$this->entry["{$field_id}"] = $value;
759
+				$this->entry[ "{$field_id}" ] = $value;
760 760
 
761 761
 				$update_entry = true;
762 762
 
@@ -765,11 +765,11 @@  discard block
 block discarded – undo
765 765
 
766 766
 		}
767 767
 
768
-		if( $update_entry ) {
768
+		if ( $update_entry ) {
769 769
 
770 770
 			$return_entry = GFAPI::update_entry( $this->entry );
771 771
 
772
-			if( is_wp_error( $return_entry ) ) {
772
+			if ( is_wp_error( $return_entry ) ) {
773 773
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
774 774
 			} else {
775 775
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 
780 780
 		$return_post = wp_update_post( $updated_post, true );
781 781
 
782
-		if( is_wp_error( $return_post ) ) {
782
+		if ( is_wp_error( $return_post ) ) {
783 783
 			$return_post->add_data( $updated_post, '$updated_post' );
784 784
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
785 785
 		} else {
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 		$input_type = RGFormsModel::get_input_type( $field );
802 802
 
803 803
 	    // Only certain custom field types are supported
804
-	    switch( $input_type ) {
804
+	    switch ( $input_type ) {
805 805
 		    case 'fileupload':
806 806
 		    case 'list':
807 807
 		    case 'multiselect':
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
839 839
 
840 840
 		// replace conditional shortcodes
841
-		if( $do_shortcode ) {
841
+		if ( $do_shortcode ) {
842 842
 			$output = do_shortcode( $output );
843 843
 		}
844 844
 
@@ -857,19 +857,19 @@  discard block
 block discarded – undo
857 857
 	 */
858 858
 	private function after_update() {
859 859
 
860
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
861
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
860
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
861
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
862 862
 
863 863
 		// Re-define the entry now that we've updated it.
864
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
864
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
865 865
 
866 866
 		$entry = GFFormsModel::set_entry_meta( $entry, $this->form );
867 867
 
868 868
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
869 869
 			// We need to clear the cache because Gravity Forms caches the field values, which
870 870
 			// we have just updated.
871
-			foreach ($this->form['fields'] as $key => $field) {
872
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
871
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
872
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
873 873
 			}
874 874
 		}
875 875
 
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 
889 889
 		<div class="gv-edit-entry-wrapper"><?php
890 890
 
891
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
891
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
892 892
 
893 893
 			/**
894 894
 			 * Fixes weird wpautop() issue
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
905 905
 				     * @param GravityView_Edit_Entry_Render $this This object
906 906
 				     */
907
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
907
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
908 908
 
909 909
 				    echo esc_attr( $edit_entry_title );
910 910
 			?></span>
@@ -954,16 +954,16 @@  discard block
 block discarded – undo
954 954
 
955 955
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
956 956
 
957
-			if( ! $this->is_valid ){
957
+			if ( ! $this->is_valid ) {
958 958
 
959 959
 				// Keeping this compatible with Gravity Forms.
960
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
961
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
960
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
961
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
962 962
 
963
-				echo GVCommon::generate_notice( $message , 'gv-error' );
963
+				echo GVCommon::generate_notice( $message, 'gv-error' );
964 964
 
965 965
 			} else {
966
-				$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
966
+				$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
967 967
 
968 968
 				/**
969 969
 				 * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
 				 * @param array $entry Gravity Forms entry array
974 974
 				 * @param string $back_link URL to return to the original entry. @since 1.6
975 975
 				 */
976
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
976
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
977 977
 
978 978
 				echo GVCommon::generate_notice( $message );
979 979
 			}
@@ -997,21 +997,21 @@  discard block
 block discarded – undo
997 997
 		 */
998 998
 		do_action( 'gravityview/edit-entry/render/before', $this );
999 999
 
1000
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1001
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1000
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1001
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1002 1002
 		add_filter( 'gform_disable_view_counter', '__return_true' );
1003 1003
 
1004 1004
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
1005 1005
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1006 1006
 
1007 1007
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1008
-		unset( $_GET['page'] );
1008
+		unset( $_GET[ 'page' ] );
1009 1009
 
1010 1010
 		// TODO: Verify multiple-page forms
1011 1011
 
1012 1012
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1013 1013
 
1014
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1014
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1015 1015
 
1016 1016
 		ob_get_clean();
1017 1017
 
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 	 * @return string
1038 1038
 	 */
1039 1039
 	public function render_form_buttons() {
1040
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1040
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1041 1041
 	}
1042 1042
 
1043 1043
 
@@ -1057,10 +1057,10 @@  discard block
 block discarded – undo
1057 1057
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1058 1058
 
1059 1059
 		// In case we have validated the form, use it to inject the validation results into the form render
1060
-		if( isset( $this->form_after_validation ) ) {
1060
+		if ( isset( $this->form_after_validation ) ) {
1061 1061
 			$form = $this->form_after_validation;
1062 1062
 		} else {
1063
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1063
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1064 1064
 		}
1065 1065
 
1066 1066
 		$form = $this->filter_conditional_logic( $form );
@@ -1068,8 +1068,8 @@  discard block
 block discarded – undo
1068 1068
 		$form = $this->prefill_conditional_logic( $form );
1069 1069
 
1070 1070
 		// for now we don't support Save and Continue feature.
1071
-		if( ! self::$supports_save_and_continue ) {
1072
-	        unset( $form['save'] );
1071
+		if ( ! self::$supports_save_and_continue ) {
1072
+	        unset( $form[ 'save' ] );
1073 1073
 		}
1074 1074
 
1075 1075
 		return $form;
@@ -1090,29 +1090,29 @@  discard block
 block discarded – undo
1090 1090
 	 */
1091 1091
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1092 1092
 
1093
-		if( GFCommon::is_post_field( $field ) ) {
1093
+		if ( GFCommon::is_post_field( $field ) ) {
1094 1094
 
1095 1095
 			$message = null;
1096 1096
 
1097 1097
 			// First, make sure they have the capability to edit the post.
1098
-			if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1098
+			if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1099 1099
 
1100 1100
 				/**
1101 1101
 				 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1102 1102
 				 * @param string $message The existing "You don't have permission..." text
1103 1103
 				 */
1104
-				$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1104
+				$message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1105 1105
 
1106
-			} elseif( null === get_post( $this->entry['post_id'] ) ) {
1106
+			} elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1107 1107
 				/**
1108 1108
 				 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1109 1109
 				 * @param string $message The existing "This field is not editable; the post no longer exists." text
1110 1110
 				 */
1111
-				$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1111
+				$message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1112 1112
 			}
1113 1113
 
1114
-			if( $message ) {
1115
-				$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1114
+			if ( $message ) {
1115
+				$field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1116 1116
 			}
1117 1117
 		}
1118 1118
 
@@ -1137,8 +1137,8 @@  discard block
 block discarded – undo
1137 1137
 
1138 1138
 		// If the form has been submitted, then we don't need to pre-fill the values,
1139 1139
 		// Except for fileupload type and when a field input is overridden- run always!!
1140
-		if(
1141
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1140
+		if (
1141
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1142 1142
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1143 1143
 			&& ! GFCommon::is_product_field( $field->type )
1144 1144
 			|| ! empty( $field_content )
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 	    $return = null;
1159 1159
 
1160 1160
 		/** @var GravityView_Field $gv_field */
1161
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1161
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1162 1162
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1163 1163
 		} else {
1164 1164
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 	    // If there was output, it's an error
1168 1168
 	    $warnings = ob_get_clean();
1169 1169
 
1170
-	    if( !empty( $warnings ) ) {
1170
+	    if ( ! empty( $warnings ) ) {
1171 1171
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1172 1172
 	    }
1173 1173
 
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1193 1193
 
1194 1194
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1195
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1195
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1196 1196
 
1197 1197
 			$field_value = array();
1198 1198
 
@@ -1201,10 +1201,10 @@  discard block
 block discarded – undo
1201 1201
 
1202 1202
 			foreach ( (array)$field->inputs as $input ) {
1203 1203
 
1204
-				$input_id = strval( $input['id'] );
1204
+				$input_id = strval( $input[ 'id' ] );
1205 1205
 				
1206 1206
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1207
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1207
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1208 1208
 				    $allow_pre_populated = false;
1209 1209
 				}
1210 1210
 
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
 			$pre_value = $field->get_value_submission( array(), false );
1214 1214
 
1215
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1215
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1216 1216
 
1217 1217
 		} else {
1218 1218
 
@@ -1223,13 +1223,13 @@  discard block
 block discarded – undo
1223 1223
 
1224 1224
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1225 1225
 			// or pre-populated value if not empty and set to override saved value
1226
-			$field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1226
+			$field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1227 1227
 
1228 1228
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1229
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1229
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1230 1230
 				$categories = array();
1231 1231
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1232
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1232
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1233 1233
 				}
1234 1234
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1235 1235
 			}
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 	     * @param GF_Field $field Gravity Forms field object
1258 1258
 	     * @param GravityView_Edit_Entry_Render $this Current object
1259 1259
 	     */
1260
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1260
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1261 1261
 
1262 1262
 		return $field_value;
1263 1263
 	}
@@ -1274,12 +1274,12 @@  discard block
 block discarded – undo
1274 1274
 	 */
1275 1275
 	public function gform_pre_validation( $form ) {
1276 1276
 
1277
-		if( ! $this->verify_nonce() ) {
1277
+		if ( ! $this->verify_nonce() ) {
1278 1278
 			return $form;
1279 1279
 		}
1280 1280
 
1281 1281
 		// Fix PHP warning regarding undefined index.
1282
-		foreach ( $form['fields'] as &$field) {
1282
+		foreach ( $form[ 'fields' ] as &$field ) {
1283 1283
 
1284 1284
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1285 1285
 			// expects certain field array items to be set.
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1288 1288
 			}
1289 1289
 
1290
-			switch( RGFormsModel::get_input_type( $field ) ) {
1290
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1291 1291
 
1292 1292
 				/**
1293 1293
 				 * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend.
@@ -1301,26 +1301,26 @@  discard block
 block discarded – undo
1301 1301
 				    // Set the previous value
1302 1302
 				    $entry = $this->get_entry();
1303 1303
 
1304
-				    $input_name = 'input_'.$field->id;
1305
-				    $form_id = $form['id'];
1304
+				    $input_name = 'input_' . $field->id;
1305
+				    $form_id = $form[ 'id' ];
1306 1306
 
1307 1307
 				    $value = NULL;
1308 1308
 
1309 1309
 				    // Use the previous entry value as the default.
1310
-				    if( isset( $entry[ $field->id ] ) ) {
1310
+				    if ( isset( $entry[ $field->id ] ) ) {
1311 1311
 				        $value = $entry[ $field->id ];
1312 1312
 				    }
1313 1313
 
1314 1314
 				    // If this is a single upload file
1315
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1316
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1317
-				        $value = $file_path['url'];
1315
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1316
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1317
+				        $value = $file_path[ 'url' ];
1318 1318
 
1319 1319
 				    } else {
1320 1320
 
1321 1321
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1322 1322
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1323
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1323
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1324 1324
 
1325 1325
 				    }
1326 1326
 
@@ -1328,10 +1328,10 @@  discard block
 block discarded – undo
1328 1328
 
1329 1329
 				        // If there are fresh uploads, process and merge them.
1330 1330
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1331
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1331
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1332 1332
 				            $value = empty( $value ) ? '[]' : $value;
1333 1333
 				            $value = stripslashes_deep( $value );
1334
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1334
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1335 1335
 				        }
1336 1336
 
1337 1337
 				    } else {
@@ -1349,8 +1349,8 @@  discard block
 block discarded – undo
1349 1349
 
1350 1350
 				case 'number':
1351 1351
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1352
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1353
-				        $_POST['input_'.$field->id ] = NULL;
1352
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1353
+				        $_POST[ 'input_' . $field->id ] = NULL;
1354 1354
 				    }
1355 1355
 				    break;
1356 1356
 			}
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 		 * You can enter whatever you want!
1388 1388
 		 * We try validating, and customize the results using `self::custom_validation()`
1389 1389
 		 */
1390
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1390
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1391 1391
 
1392 1392
 		// Needed by the validate funtion
1393 1393
 		$failed_validation_page = NULL;
@@ -1395,14 +1395,14 @@  discard block
 block discarded – undo
1395 1395
 
1396 1396
 		// Prevent entry limit from running when editing an entry, also
1397 1397
 		// prevent form scheduling from preventing editing
1398
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1398
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1399 1399
 
1400 1400
 		// Hide fields depending on Edit Entry settings
1401
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1401
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1402 1402
 
1403 1403
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1404 1404
 
1405
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1405
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1406 1406
 	}
1407 1407
 
1408 1408
 
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
 
1426 1426
 		$gv_valid = true;
1427 1427
 
1428
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1428
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1429 1429
 
1430 1430
 			$value = RGFormsModel::get_field_value( $field );
1431 1431
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1438,35 +1438,35 @@  discard block
 block discarded – undo
1438 1438
 				case 'post_image':
1439 1439
 
1440 1440
 				    // in case nothing is uploaded but there are already files saved
1441
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1441
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1442 1442
 				        $field->failed_validation = false;
1443 1443
 				        unset( $field->validation_message );
1444 1444
 				    }
1445 1445
 
1446 1446
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1447
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1447
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1448 1448
 
1449 1449
 				        $input_name = 'input_' . $field->id;
1450 1450
 				        //uploaded
1451
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1451
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1452 1452
 
1453 1453
 				        //existent
1454 1454
 				        $entry = $this->get_entry();
1455 1455
 				        $value = NULL;
1456
-				        if( isset( $entry[ $field->id ] ) ) {
1456
+				        if ( isset( $entry[ $field->id ] ) ) {
1457 1457
 				            $value = json_decode( $entry[ $field->id ], true );
1458 1458
 				        }
1459 1459
 
1460 1460
 				        // count uploaded files and existent entry files
1461 1461
 				        $count_files = count( $file_names ) + count( $value );
1462 1462
 
1463
-				        if( $count_files > $field->maxFiles ) {
1463
+				        if ( $count_files > $field->maxFiles ) {
1464 1464
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1465 1465
 				            $field->failed_validation = 1;
1466 1466
 				            $gv_valid = false;
1467 1467
 
1468 1468
 				            // in case of error make sure the newest upload files are removed from the upload input
1469
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1469
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1470 1470
 				        }
1471 1471
 
1472 1472
 				    }
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 			}
1478 1478
 
1479 1479
 			// This field has failed validation.
1480
-			if( !empty( $field->failed_validation ) ) {
1480
+			if ( ! empty( $field->failed_validation ) ) {
1481 1481
 
1482 1482
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1483 1483
 
@@ -1495,19 +1495,19 @@  discard block
 block discarded – undo
1495 1495
 				}
1496 1496
 
1497 1497
 				// You can't continue inside a switch, so we do it after.
1498
-				if( empty( $field->failed_validation ) ) {
1498
+				if ( empty( $field->failed_validation ) ) {
1499 1499
 				    continue;
1500 1500
 				}
1501 1501
 
1502 1502
 				// checks if the No Duplicates option is not validating entry against itself, since
1503 1503
 				// we're editing a stored entry, it would also assume it's a duplicate.
1504
-				if( !empty( $field->noDuplicates ) ) {
1504
+				if ( ! empty( $field->noDuplicates ) ) {
1505 1505
 
1506 1506
 				    $entry = $this->get_entry();
1507 1507
 
1508 1508
 				    // If the value of the entry is the same as the stored value
1509 1509
 				    // Then we can assume it's not a duplicate, it's the same.
1510
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1510
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1511 1511
 				        //if value submitted was not changed, then don't validate
1512 1512
 				        $field->failed_validation = false;
1513 1513
 
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 				}
1521 1521
 
1522 1522
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1523
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1523
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1524 1524
 				    unset( $field->validation_message );
1525 1525
 	                $field->validation_message = false;
1526 1526
 				    continue;
@@ -1532,12 +1532,12 @@  discard block
 block discarded – undo
1532 1532
 
1533 1533
 		}
1534 1534
 
1535
-		$validation_results['is_valid'] = $gv_valid;
1535
+		$validation_results[ 'is_valid' ] = $gv_valid;
1536 1536
 
1537 1537
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1538 1538
 
1539 1539
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1540
-		$this->form_after_validation = $validation_results['form'];
1540
+		$this->form_after_validation = $validation_results[ 'form' ];
1541 1541
 
1542 1542
 		return $validation_results;
1543 1543
 	}
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 	 */
1551 1551
 	public function get_entry() {
1552 1552
 
1553
-		if( empty( $this->entry ) ) {
1553
+		if ( empty( $this->entry ) ) {
1554 1554
 			// Get the database value of the entry that's being edited
1555 1555
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1556 1556
 		}
@@ -1582,10 +1582,10 @@  discard block
 block discarded – undo
1582 1582
 		}
1583 1583
 
1584 1584
 		// If edit tab not yet configured, show all fields
1585
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1585
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1586 1586
 
1587 1587
 		// Hide fields depending on admin settings
1588
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1588
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1589 1589
 
1590 1590
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1591 1591
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
 	 */
1618 1618
 	private function filter_fields( $fields, $configured_fields ) {
1619 1619
 
1620
-		if( empty( $fields ) || !is_array( $fields ) ) {
1620
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1621 1621
 			return $fields;
1622 1622
 		}
1623 1623
 
@@ -1630,18 +1630,18 @@  discard block
 block discarded – undo
1630 1630
 
1631 1631
 			// Remove the fields that have calculation properties and keep them to be used later
1632 1632
 			// @since 1.16.2
1633
-			if( $field->has_calculation() ) {
1634
-				$this->fields_with_calculation[] = $field;
1633
+			if ( $field->has_calculation() ) {
1634
+				$this->fields_with_calculation[ ] = $field;
1635 1635
 				// don't remove the calculation fields on form render.
1636 1636
 			}
1637 1637
 
1638
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1638
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1639 1639
 				unset( $fields[ $key ] );
1640 1640
 			}
1641 1641
 		}
1642 1642
 
1643 1643
 		// The Edit tab has not been configured, so we return all fields by default.
1644
-		if( empty( $configured_fields ) ) {
1644
+		if ( empty( $configured_fields ) ) {
1645 1645
 			return $fields;
1646 1646
 		}
1647 1647
 
@@ -1650,8 +1650,8 @@  discard block
 block discarded – undo
1650 1650
 
1651 1651
 	        /** @var GF_Field $field */
1652 1652
 	        foreach ( $fields as $field ) {
1653
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1654
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1653
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1654
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1655 1655
 				    break;
1656 1656
 				}
1657 1657
 
@@ -1674,14 +1674,14 @@  discard block
 block discarded – undo
1674 1674
 
1675 1675
 		$return_field = $field;
1676 1676
 
1677
-		if( empty( $field_setting['show_label'] ) ) {
1677
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1678 1678
 			$return_field->label = '';
1679
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1680
-			$return_field->label = $field_setting['custom_label'];
1679
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1680
+			$return_field->label = $field_setting[ 'custom_label' ];
1681 1681
 		}
1682 1682
 
1683
-		if( !empty( $field_setting['custom_class'] ) ) {
1684
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1683
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1684
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1685 1685
 		}
1686 1686
 
1687 1687
 		/**
@@ -1719,16 +1719,16 @@  discard block
 block discarded – undo
1719 1719
 	     */
1720 1720
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1721 1721
 
1722
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1723
-			foreach( $fields as $k => $field ) {
1724
-				if( $field->adminOnly ) {
1722
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1723
+			foreach ( $fields as $k => $field ) {
1724
+				if ( $field->adminOnly ) {
1725 1725
 				    unset( $fields[ $k ] );
1726 1726
 				}
1727 1727
 			}
1728 1728
 			return $fields;
1729 1729
 		}
1730 1730
 
1731
-	    foreach( $fields as &$field ) {
1731
+	    foreach ( $fields as &$field ) {
1732 1732
 		    $field->adminOnly = false;
1733 1733
 		}
1734 1734
 
@@ -1752,22 +1752,22 @@  discard block
 block discarded – undo
1752 1752
 	 */
1753 1753
 	function prefill_conditional_logic( $form ) {
1754 1754
 
1755
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1755
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1756 1756
 			return $form;
1757 1757
 		}
1758 1758
 
1759 1759
 		// Have Conditional Logic pre-fill fields as if the data were default values
1760 1760
 		/** @var GF_Field $field */
1761
-		foreach ( $form['fields'] as &$field ) {
1761
+		foreach ( $form[ 'fields' ] as &$field ) {
1762 1762
 
1763
-			if( 'checkbox' === $field->type ) {
1763
+			if ( 'checkbox' === $field->type ) {
1764 1764
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1765
-				    $input_id = $input['id'];
1765
+				    $input_id = $input[ 'id' ];
1766 1766
 				    $choice = $field->choices[ $key ];
1767 1767
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1768 1768
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1769
-				    if( $match ) {
1770
-				        $field->choices[ $key ]['isSelected'] = true;
1769
+				    if ( $match ) {
1770
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1771 1771
 				    }
1772 1772
 				}
1773 1773
 			} else {
@@ -1775,15 +1775,15 @@  discard block
 block discarded – undo
1775 1775
 				// We need to run through each field to set the default values
1776 1776
 				foreach ( $this->entry as $field_id => $field_value ) {
1777 1777
 
1778
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1778
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1779 1779
 
1780
-				        if( 'list' === $field->type ) {
1780
+				        if ( 'list' === $field->type ) {
1781 1781
 				            $list_rows = maybe_unserialize( $field_value );
1782 1782
 
1783 1783
 				            $list_field_value = array();
1784
-				            foreach ( (array) $list_rows as $row ) {
1785
-				                foreach ( (array) $row as $column ) {
1786
-				                    $list_field_value[] = $column;
1784
+				            foreach ( (array)$list_rows as $row ) {
1785
+				                foreach ( (array)$row as $column ) {
1786
+				                    $list_field_value[ ] = $column;
1787 1787
 				                }
1788 1788
 				            }
1789 1789
 
@@ -1818,16 +1818,16 @@  discard block
 block discarded – undo
1818 1818
 		 */
1819 1819
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1820 1820
 
1821
-		if( $use_conditional_logic ) {
1821
+		if ( $use_conditional_logic ) {
1822 1822
 			return $form;
1823 1823
 		}
1824 1824
 
1825
-		foreach( $form['fields'] as &$field ) {
1825
+		foreach ( $form[ 'fields' ] as &$field ) {
1826 1826
 			/* @var GF_Field $field */
1827 1827
 			$field->conditionalLogic = null;
1828 1828
 		}
1829 1829
 
1830
-		unset( $form['button']['conditionalLogic'] );
1830
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1831 1831
 
1832 1832
 		return $form;
1833 1833
 
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 	 */
1845 1845
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1846 1846
 
1847
-		if( ! $this->is_edit_entry() ) {
1847
+		if ( ! $this->is_edit_entry() ) {
1848 1848
 			return $has_conditional_logic;
1849 1849
 		}
1850 1850
 
@@ -1876,44 +1876,44 @@  discard block
 block discarded – undo
1876 1876
 		 *  2. There are two entries embedded using oEmbed
1877 1877
 		 *  3. One of the entries has just been saved
1878 1878
 		 */
1879
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1879
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1880 1880
 
1881 1881
 			$error = true;
1882 1882
 
1883 1883
 		}
1884 1884
 
1885
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1885
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1886 1886
 
1887 1887
 			$error = true;
1888 1888
 
1889
-		} elseif( ! $this->verify_nonce() ) {
1889
+		} elseif ( ! $this->verify_nonce() ) {
1890 1890
 
1891 1891
 			/**
1892 1892
 			 * If the Entry is embedded, there may be two entries on the same page.
1893 1893
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1894 1894
 			 */
1895
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1895
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1896 1896
 				$error = true;
1897 1897
 			} else {
1898
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1898
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1899 1899
 			}
1900 1900
 
1901 1901
 		}
1902 1902
 
1903
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1904
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1903
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1904
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1905 1905
 		}
1906 1906
 
1907
-		if( $this->entry['status'] === 'trash' ) {
1908
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1907
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1908
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1909 1909
 		}
1910 1910
 
1911 1911
 		// No errors; everything's fine here!
1912
-		if( empty( $error ) ) {
1912
+		if ( empty( $error ) ) {
1913 1913
 			return true;
1914 1914
 		}
1915 1915
 
1916
-		if( $echo && $error !== true ) {
1916
+		if ( $echo && $error !== true ) {
1917 1917
 
1918 1918
 	        $error = esc_html( $error );
1919 1919
 
@@ -1921,10 +1921,10 @@  discard block
 block discarded – undo
1921 1921
 	         * @since 1.9
1922 1922
 	         */
1923 1923
 	        if ( ! empty( $this->entry ) ) {
1924
-		        $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1924
+		        $error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1925 1925
 	        }
1926 1926
 
1927
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1927
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1928 1928
 		}
1929 1929
 
1930 1930
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1944,17 +1944,17 @@  discard block
 block discarded – undo
1944 1944
 
1945 1945
 		$error = NULL;
1946 1946
 
1947
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
1948
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
1947
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
1948
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
1949 1949
 		}
1950 1950
 
1951 1951
 		// No errors; everything's fine here!
1952
-		if( empty( $error ) ) {
1952
+		if ( empty( $error ) ) {
1953 1953
 			return true;
1954 1954
 		}
1955 1955
 
1956
-		if( $echo ) {
1957
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1956
+		if ( $echo ) {
1957
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1958 1958
 		}
1959 1959
 
1960 1960
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1975,14 +1975,14 @@  discard block
 block discarded – undo
1975 1975
 	private function check_user_cap_edit_field( $field ) {
1976 1976
 
1977 1977
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
1978
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1978
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1979 1979
 			return true;
1980 1980
 		}
1981 1981
 
1982
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
1982
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
1983 1983
 
1984
-		if( $field_cap ) {
1985
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
1984
+		if ( $field_cap ) {
1985
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
1986 1986
 		}
1987 1987
 
1988 1988
 		return false;
@@ -1996,17 +1996,17 @@  discard block
 block discarded – undo
1996 1996
 	public function verify_nonce() {
1997 1997
 
1998 1998
 		// Verify form submitted for editing single
1999
-		if( $this->is_edit_entry_submission() ) {
1999
+		if ( $this->is_edit_entry_submission() ) {
2000 2000
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2001 2001
 		}
2002 2002
 
2003 2003
 		// Verify
2004
-		else if( ! $this->is_edit_entry() ) {
2004
+		else if ( ! $this->is_edit_entry() ) {
2005 2005
 			$valid = false;
2006 2006
 		}
2007 2007
 
2008 2008
 		else {
2009
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2009
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2010 2010
 		}
2011 2011
 
2012 2012
 		/**
Please login to merge, or discard this patch.
includes/class-gravityview-html-elements.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
 
43 43
 		$args = wp_parse_args( $args, $defaults );
44 44
 
45
-		$forms = gravityview_get_forms( (bool) $args['active'], (bool) $args['trash'] );
45
+		$forms = gravityview_get_forms( (bool)$args[ 'active' ], (bool)$args[ 'trash' ] );
46 46
 
47
-		if( array() === $args['options'] ) {
47
+		if ( array() === $args[ 'options' ] ) {
48 48
 			foreach ( $forms as $form ) {
49 49
 
50
-				if ( in_array( $form['id'], $args['exclude'] ) ) {
50
+				if ( in_array( $form[ 'id' ], $args[ 'exclude' ] ) ) {
51 51
 					continue;
52 52
 				}
53 53
 
54
-				$args['options'][ $form['id'] ] = esc_html( $form['title'] );
54
+				$args[ 'options' ][ $form[ 'id' ] ] = esc_html( $form[ 'title' ] );
55 55
 			}
56 56
 		}
57 57
 
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
 
84 84
 		$args = wp_parse_args( $args, $defaults );
85 85
 
86
-		if( empty( $args['form_id'] ) ) {
86
+		if ( empty( $args[ 'form_id' ] ) ) {
87 87
 			return '';
88 88
 		}
89 89
 
90
-		$fields = GVCommon::get_sortable_fields_array( $args['form_id'] );
90
+		$fields = GVCommon::get_sortable_fields_array( $args[ 'form_id' ] );
91 91
 
92
-		if( array() === $args['options'] ) {
92
+		if ( array() === $args[ 'options' ] ) {
93 93
 			foreach ( $fields as $field_id => $field ) {
94
-				$args['options'][ $field_id ] = esc_html( $field['label'] );
94
+				$args[ 'options' ][ $field_id ] = esc_html( $field[ 'label' ] );
95 95
 			}
96 96
 		}
97 97
 
@@ -127,43 +127,43 @@  discard block
 block discarded – undo
127 127
 		$args = wp_parse_args( $args, $defaults );
128 128
 
129 129
 		$data_elements = '';
130
-		foreach ( $args['data'] as $key => $value ) {
130
+		foreach ( $args[ 'data' ] as $key => $value ) {
131 131
 			$data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
132 132
 		}
133 133
 
134
-		if( $args['multiple'] ) {
134
+		if ( $args[ 'multiple' ] ) {
135 135
 			$multiple = ' MULTIPLE';
136 136
 		} else {
137 137
 			$multiple = '';
138 138
 		}
139 139
 
140
-		if( $args['placeholder'] ) {
141
-			$placeholder = $args['placeholder'];
140
+		if ( $args[ 'placeholder' ] ) {
141
+			$placeholder = $args[ 'placeholder' ];
142 142
 		} else {
143 143
 			$placeholder = '';
144 144
 		}
145 145
 
146
-		$disabled = $args['disabled'] ? ' disabled="disabled"' : '';
147
-		$class  = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
148
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( str_replace( '-', '_', $args['id'] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"'. $data_elements . '>';
146
+		$disabled = $args[ 'disabled' ] ? ' disabled="disabled"' : '';
147
+		$class  = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args[ 'class' ] ) ) );
148
+		$output = '<select name="' . esc_attr( $args[ 'name' ] ) . '" id="' . esc_attr( str_replace( '-', '_', $args[ 'id' ] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>';
149 149
 
150
-		if ( ! empty( $args['options'] ) ) {
150
+		if ( ! empty( $args[ 'options' ] ) ) {
151 151
 
152
-			if ( $args['show_option_none'] ) {
153
-				if( $args['multiple'] ) {
154
-					$selected = selected( true, in_array( -1, $args['selected'] ), false );
152
+			if ( $args[ 'show_option_none' ] ) {
153
+				if ( $args[ 'multiple' ] ) {
154
+					$selected = selected( true, in_array( -1, $args[ 'selected' ] ), false );
155 155
 				} else {
156
-					$selected = selected( $args['selected'], -1, false );
156
+					$selected = selected( $args[ 'selected' ], -1, false );
157 157
 				}
158
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
158
+				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args[ 'show_option_none' ] ) . '</option>';
159 159
 			}
160 160
 
161
-			foreach( $args['options'] as $key => $option ) {
161
+			foreach ( $args[ 'options' ] as $key => $option ) {
162 162
 
163
-				if( $args['multiple'] && is_array( $args['selected'] ) ) {
164
-					$selected = selected( true, in_array( $key, $args['selected'], true ), false );
163
+				if ( $args[ 'multiple' ] && is_array( $args[ 'selected' ] ) ) {
164
+					$selected = selected( true, in_array( $key, $args[ 'selected' ], true ), false );
165 165
 				} else {
166
-					$selected = selected( $args['selected'], $key, false );
166
+					$selected = selected( $args[ 'selected' ], $key, false );
167 167
 				}
168 168
 
169 169
 				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-ultimate-member.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 	function parse_um_profile_post_content( $args = array() ) {
44 44
 		global $ultimatemember;
45 45
 
46
-		if( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) {
46
+		if ( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) {
47 47
 			return;
48 48
 		}
49 49
 
50 50
 		// @todo Support Ultimate Member 2.0 - for now, prevent fatal error
51
-		if( ! isset( $ultimatemember->profile ) ) {
51
+		if ( ! isset( $ultimatemember->profile ) ) {
52 52
 			return;
53 53
 		}
54 54
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			return;
65 65
 		}
66 66
 
67
-		GravityView_View_Data::getInstance()->parse_post_content( $active_tab[0]->post_content );
67
+		GravityView_View_Data::getInstance()->parse_post_content( $active_tab[ 0 ]->post_content );
68 68
 
69 69
 		wp_reset_postdata();
70 70
 	}
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravity-forms-dropbox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	 */
46 46
 	function filter_file_path( $file_path = '', $file_path_info = array(), $field_settings = array() ) {
47 47
 
48
-		$file_path = str_replace('www.dropbox.com', 'dl.dropboxusercontent.com', $file_path );
48
+		$file_path = str_replace( 'www.dropbox.com', 'dl.dropboxusercontent.com', $file_path );
49 49
 		$file_path = str_replace( '?dl=0', '', $file_path );
50 50
 
51 51
 		return $file_path;
Please login to merge, or discard this patch.
includes/extensions/edit-entry/partials/form-buttons.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 	$labels = array(
31 31
 		'cancel' => __( 'Cancel', 'gravityview' ),
32
-		'submit' => __( 'Update', 'gravityview')
32
+		'submit' => __( 'Update', 'gravityview' )
33 33
 	);
34 34
 
35 35
 	/**
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	$update_tabindex  = GFCommon::get_tabindex();
46 46
 	$cancel_tabindex  = GFCommon::get_tabindex();
47 47
 	?>
48
-	<input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $labels['submit'] ); ?>" name="save" />
48
+	<input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $labels[ 'submit' ] ); ?>" name="save" />
49 49
 
50
-	<a class="btn btn-sm button button-small gv-button-cancel" <?php echo $cancel_tabindex; ?> href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels['cancel'] ); ?></a>
50
+	<a class="btn btn-sm button button-small gv-button-cancel" <?php echo $cancel_tabindex; ?> href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels[ 'cancel' ] ); ?></a>
51 51
 	<?php
52 52
 
53 53
 	/**
@@ -61,5 +61,5 @@  discard block
 block discarded – undo
61 61
 
62 62
 	?>
63 63
 	<input type="hidden" name="action" value="update" />
64
-	<input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" />
64
+	<input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" />
65 65
 </div>
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 <div id="publishing-action">
8 8
 	<?php
9 9
 
10
-    /**
11
-     * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL
12
-     * @since 1.11.1
13
-     * @param string $back_link Existing URL of the Cancel link
14
-     * @param array $form The Gravity Forms form
15
-     * @param array $entry The Gravity Forms entry
16
-     * @param int $view_id The current View ID
17
-     */
18
-    $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id );
10
+	/**
11
+	 * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL
12
+	 * @since 1.11.1
13
+	 * @param string $back_link Existing URL of the Cancel link
14
+	 * @param array $form The Gravity Forms form
15
+	 * @param array $entry The Gravity Forms entry
16
+	 * @param int $view_id The current View ID
17
+	 */
18
+	$back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id );
19 19
 
20 20
 	/**
21 21
 	 * @action `gravityview/edit-entry/publishing-action/before` Triggered before the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container.
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * @action `gravityview/edit-entry/publishing-action/after` Triggered after the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container.
55 55
 	 * @since 1.5.1
56
-     * @since 2.0.13 Added $post_id
56
+	 * @since 2.0.13 Added $post_id
57 57
 	 * @param array $form The Gravity Forms form
58 58
 	 * @param array $entry The Gravity Forms entry
59 59
 	 * @param int $view_id The current View ID
60
-     * @param int $post_id The current Post ID
60
+	 * @param int $post_id The current Post ID
61 61
 	 */
62 62
 	do_action( 'gravityview/edit-entry/publishing-action/after', $object->form, $object->entry, $object->view_id, $object->post_id );
63 63
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-notes.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
 		global $wpdb;
142 142
 
143 143
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' )
144
-		     && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
144
+			 && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
145 145
 			$notes_table = GFFormsModel::get_entry_notes_table_name();
146 146
 		} else {
147 147
 			$notes_table = GFFormsModel::get_lead_notes_table_name();
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		// Make sure the keys are all set
68 68
 		$note = wp_parse_args( $note, $default_note );
69 69
 
70
-		GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) );
70
+		GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) );
71 71
 
72 72
 		// If last_error is empty string, there was no error.
73
-		if( empty( $wpdb->last_error ) ) {
73
+		if ( empty( $wpdb->last_error ) ) {
74 74
 			$return = $wpdb->insert_id;
75 75
 		} else {
76 76
 			$return = new WP_Error( 'gravityview-add-note', $wpdb->last_error );
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public static function delete_notes( $note_ids = array() ) {
98 98
 
99
-		if( !is_array( $note_ids ) ) {
99
+		if ( ! is_array( $note_ids ) ) {
100 100
 
101 101
 			gravityview()->log->error( 'Note IDs not an array. Not processing delete request.', array( 'data' => $note_ids ) );
102 102
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			)
157 157
 		);
158 158
 
159
-		return $results ? $results[0] : false;
159
+		return $results ? $results[ 0 ] : false;
160 160
 	}
161 161
 
162 162
 	/**
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public static function filter_avatar( $avatar = '', $note ) {
171 171
 
172
-		if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
173
-			$avatar =  sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
172
+		if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
173
+			$avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
174 174
 		}
175 175
 
176 176
 		return $avatar;
Please login to merge, or discard this patch.