Completed
Push — master ( 7ba298...2ce894 )
by Zack
38:21 queued 18:44
created
includes/fields/class-gravityview-field-post-excerpt.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@
 block discarded – undo
22 22
 
23 23
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
24 24
 
25
-		unset( $field_options['show_as_link'] );
25
+		unset( $field_options[ 'show_as_link' ] );
26 26
 
27
-		if( 'edit' === $context ) {
27
+		if ( 'edit' === $context ) {
28 28
 			return $field_options;
29 29
 		}
30 30
 
31
-		$this->add_field_support('dynamic_data', $field_options );
31
+		$this->add_field_support( 'dynamic_data', $field_options );
32 32
 
33 33
 		return $field_options;
34 34
 	}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 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   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 	public function prevent_maybe_process_form() {
161 161
 
162 162
 		if( ! empty( $_POST ) ) {
163
-	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
163
+			gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
164 164
 		}
165 165
 
166 166
 		if( $this->is_edit_entry_submission() ) {
167 167
 			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
168
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
168
+			remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
169 169
 		}
170 170
 	}
171 171
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 		$entries = $gravityview_view->getEntries();
200
-	    self::$original_entry = $entries[0];
201
-	    $this->entry = $entries[0];
200
+		self::$original_entry = $entries[0];
201
+		$this->entry = $entries[0];
202 202
 
203 203
 		self::$original_form = $gravityview_view->getForm();
204 204
 		$this->form = $gravityview_view->getForm();
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 
320 320
 			GFFormsModel::save_lead( $form, $this->entry );
321 321
 
322
-	        // Delete the values for hidden inputs
323
-	        $this->unset_hidden_field_values();
322
+			// Delete the values for hidden inputs
323
+			$this->unset_hidden_field_values();
324 324
 			
325 325
 			$this->entry['date_created'] = $date_created;
326 326
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 			// Perform actions normally performed after updating a lead
331 331
 			$this->after_update();
332 332
 
333
-	        /**
333
+			/**
334 334
 			 * Must be AFTER after_update()!
335 335
 			 * @see https://github.com/gravityview/GravityView/issues/764
336 336
 			 */
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 * @return void
361 361
 	 */
362 362
 	private function unset_hidden_field_values() {
363
-	    global $wpdb;
363
+		global $wpdb;
364 364
 
365 365
 		/**
366 366
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -382,27 +382,27 @@  discard block
 block discarded – undo
382 382
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
383 383
 		}
384 384
 
385
-	    foreach ( $this->entry as $input_id => $field_value ) {
385
+		foreach ( $this->entry as $input_id => $field_value ) {
386 386
 
387
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
387
+			$field = RGFormsModel::get_field( $this->form, $input_id );
388 388
 
389
-		    // Reset fields that are hidden
390
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
391
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
389
+			// Reset fields that are hidden
390
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
391
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
392 392
 
393
-		        // List fields are stored as empty arrays when empty
394
-			    $empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
393
+				// List fields are stored as empty arrays when empty
394
+				$empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
395 395
 
396
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
396
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
397 397
 
398
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
398
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
399 399
 
400
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
400
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
401 401
 				// after submission
402
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
403
-			    $_POST[ $post_input_id ] = '';
404
-		    }
405
-	    }
402
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
403
+				$_POST[ $post_input_id ] = '';
404
+			}
405
+		}
406 406
 	}
407 407
 
408 408
 	/**
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
 		$form = $this->form;
498 498
 
499
-	    /** @var GF_Field $field */
499
+		/** @var GF_Field $field */
500 500
 		foreach( $form['fields'] as $k => &$field ) {
501 501
 
502 502
 			/**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
514 514
 				foreach( $field->inputs as $key => $input ) {
515
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
515
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
516 516
 				}
517 517
 			}
518 518
 		}
@@ -533,13 +533,13 @@  discard block
 block discarded – undo
533 533
 			foreach ( $this->fields_with_calculation as $calc_field ) {
534 534
 				$inputs = $calc_field->get_entry_inputs();
535 535
 				if ( is_array( $inputs ) ) {
536
-				    foreach ( $inputs as $input ) {
537
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
538
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
539
-				    }
536
+					foreach ( $inputs as $input ) {
537
+						$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
538
+						$entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
539
+					}
540 540
 				} else {
541
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
542
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
541
+					$input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
542
+					$entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
543 543
 				}
544 544
 			}
545 545
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
588 588
 
589 589
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
590
-	        $ary = stripslashes_deep( $ary );
590
+			$ary = stripslashes_deep( $ary );
591 591
 			$img_url = \GV\Utils::get( $ary, 0 );
592 592
 
593 593
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	private function maybe_update_post_fields( $form ) {
661 661
 
662 662
 		if( empty( $this->entry['post_id'] ) ) {
663
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
663
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
664 664
 			return;
665 665
 		}
666 666
 
@@ -695,51 +695,51 @@  discard block
 block discarded – undo
695 695
 
696 696
 				switch( $field->type ) {
697 697
 
698
-				    case 'post_title':
699
-				        $post_title = $value;
700
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
701
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
702
-				        }
703
-				        $updated_post->post_title = $post_title;
704
-				        $updated_post->post_name  = $post_title;
705
-				        unset( $post_title );
706
-				        break;
707
-
708
-				    case 'post_content':
709
-				        $post_content = $value;
710
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
711
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
712
-				        }
713
-				        $updated_post->post_content = $post_content;
714
-				        unset( $post_content );
715
-				        break;
716
-				    case 'post_excerpt':
717
-				        $updated_post->post_excerpt = $value;
718
-				        break;
719
-				    case 'post_tags':
720
-				        wp_set_post_tags( $post_id, $value, false );
721
-				        break;
722
-				    case 'post_category':
723
-				        break;
724
-				    case 'post_custom_field':
698
+					case 'post_title':
699
+						$post_title = $value;
700
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
701
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
702
+						}
703
+						$updated_post->post_title = $post_title;
704
+						$updated_post->post_name  = $post_title;
705
+						unset( $post_title );
706
+						break;
707
+
708
+					case 'post_content':
709
+						$post_content = $value;
710
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
711
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
712
+						}
713
+						$updated_post->post_content = $post_content;
714
+						unset( $post_content );
715
+						break;
716
+					case 'post_excerpt':
717
+						$updated_post->post_excerpt = $value;
718
+						break;
719
+					case 'post_tags':
720
+						wp_set_post_tags( $post_id, $value, false );
721
+						break;
722
+					case 'post_category':
723
+						break;
724
+					case 'post_custom_field':
725 725
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
726 726
 							$value = $value[ $field_id ];
727 727
 						}
728 728
 
729
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
730
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
731
-				        }
729
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
730
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
731
+						}
732 732
 
733
-	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
734
-		                    $value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
735
-	                    }
733
+						if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
734
+							$value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
735
+						}
736 736
 
737
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
738
-				        break;
737
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
738
+						break;
739 739
 
740
-				    case 'post_image':
741
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
742
-				        break;
740
+					case 'post_image':
741
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
742
+						break;
743 743
 
744 744
 				}
745 745
 
@@ -784,20 +784,20 @@  discard block
 block discarded – undo
784 784
 	 */
785 785
 	private function is_field_json_encoded( $field ) {
786 786
 
787
-	    $json_encoded = false;
787
+		$json_encoded = false;
788 788
 
789 789
 		$input_type = RGFormsModel::get_input_type( $field );
790 790
 
791
-	    // Only certain custom field types are supported
792
-	    switch( $input_type ) {
793
-		    case 'fileupload':
794
-		    case 'list':
795
-		    case 'multiselect':
796
-			    $json_encoded = true;
797
-			    break;
798
-	    }
791
+		// Only certain custom field types are supported
792
+		switch( $input_type ) {
793
+			case 'fileupload':
794
+			case 'list':
795
+			case 'multiselect':
796
+				$json_encoded = true;
797
+				break;
798
+		}
799 799
 
800
-	    return $json_encoded;
800
+		return $json_encoded;
801 801
 	}
802 802
 
803 803
 	/**
@@ -887,14 +887,14 @@  discard block
 block discarded – undo
887 887
 			?><h2 class="gv-edit-entry-title">
888 888
 				<span><?php
889 889
 
890
-				    /**
891
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
892
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
893
-				     * @param GravityView_Edit_Entry_Render $this This object
894
-				     */
895
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
890
+					/**
891
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
892
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
893
+					 * @param GravityView_Edit_Entry_Render $this This object
894
+					 */
895
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
896 896
 
897
-				    echo esc_attr( $edit_entry_title );
897
+					echo esc_attr( $edit_entry_title );
898 898
 			?></span>
899 899
 			</h2>
900 900
 
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 
1004 1004
 		ob_get_clean();
1005 1005
 
1006
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1006
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1007 1007
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1008 1008
 		remove_filter( 'gform_disable_view_counter', '__return_true' );
1009 1009
 		remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 );
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 		// for now we don't support Save and Continue feature.
1059 1059
 		if( ! self::$supports_save_and_continue ) {
1060
-	        unset( $form['save'] );
1060
+			unset( $form['save'] );
1061 1061
 		}
1062 1062
 
1063 1063
 		return $form;
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
 			|| ! empty( $field_content )
1133 1133
 			|| in_array( $field->type, array( 'honeypot' ) )
1134 1134
 		) {
1135
-	        return $field_content;
1135
+			return $field_content;
1136 1136
 		}
1137 1137
 
1138 1138
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1140,24 +1140,24 @@  discard block
 block discarded – undo
1140 1140
 
1141 1141
 		$field_value = $this->get_field_value( $field );
1142 1142
 
1143
-	    // Prevent any PHP warnings, like undefined index
1144
-	    ob_start();
1143
+		// Prevent any PHP warnings, like undefined index
1144
+		ob_start();
1145 1145
 
1146
-	    $return = null;
1146
+		$return = null;
1147 1147
 
1148 1148
 		/** @var GravityView_Field $gv_field */
1149 1149
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1150 1150
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1151 1151
 		} else {
1152
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1153
-	    }
1152
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1153
+		}
1154 1154
 
1155
-	    // If there was output, it's an error
1156
-	    $warnings = ob_get_clean();
1155
+		// If there was output, it's an error
1156
+		$warnings = ob_get_clean();
1157 1157
 
1158
-	    if( !empty( $warnings ) ) {
1159
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1160
-	    }
1158
+		if( !empty( $warnings ) ) {
1159
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1160
+		}
1161 1161
 
1162 1162
 		return $return;
1163 1163
 	}
@@ -1192,8 +1192,8 @@  discard block
 block discarded – undo
1192 1192
 				$input_id = strval( $input['id'] );
1193 1193
 				
1194 1194
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1195
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1196
-				    $allow_pre_populated = false;
1195
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1196
+					$allow_pre_populated = false;
1197 1197
 				}
1198 1198
 
1199 1199
 			}
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1218 1218
 				$categories = array();
1219 1219
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1220
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1220
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1221 1221
 				}
1222 1222
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1223 1223
 			}
@@ -1227,25 +1227,25 @@  discard block
 block discarded – undo
1227 1227
 		// if value is empty get the default value if defined
1228 1228
 		$field_value = $field->get_value_default_if_empty( $field_value );
1229 1229
 
1230
-	    /**
1231
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1232
-	     * @since 1.11
1233
-	     * @since 1.20 Added third param
1234
-	     * @param mixed $field_value field value used to populate the input
1235
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1236
-	     * @param GravityView_Edit_Entry_Render $this Current object
1237
-	     */
1238
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1239
-
1240
-	    /**
1241
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1242
-	     * @since 1.17
1243
-	     * @since 1.20 Added third param
1244
-	     * @param mixed $field_value field value used to populate the input
1245
-	     * @param GF_Field $field Gravity Forms field object
1246
-	     * @param GravityView_Edit_Entry_Render $this Current object
1247
-	     */
1248
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1230
+		/**
1231
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1232
+		 * @since 1.11
1233
+		 * @since 1.20 Added third param
1234
+		 * @param mixed $field_value field value used to populate the input
1235
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1236
+		 * @param GravityView_Edit_Entry_Render $this Current object
1237
+		 */
1238
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1239
+
1240
+		/**
1241
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1242
+		 * @since 1.17
1243
+		 * @since 1.20 Added third param
1244
+		 * @param mixed $field_value field value used to populate the input
1245
+		 * @param GF_Field $field Gravity Forms field object
1246
+		 * @param GravityView_Edit_Entry_Render $this Current object
1247
+		 */
1248
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1249 1249
 
1250 1250
 		return $field_value;
1251 1251
 	}
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1273 1273
 			// expects certain field array items to be set.
1274 1274
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1275
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1275
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1276 1276
 			}
1277 1277
 
1278 1278
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1286,61 +1286,61 @@  discard block
 block discarded – undo
1286 1286
 				 */
1287 1287
 				case 'fileupload':
1288 1288
 
1289
-				    // Set the previous value
1290
-				    $entry = $this->get_entry();
1289
+					// Set the previous value
1290
+					$entry = $this->get_entry();
1291 1291
 
1292
-				    $input_name = 'input_'.$field->id;
1293
-				    $form_id = $form['id'];
1292
+					$input_name = 'input_'.$field->id;
1293
+					$form_id = $form['id'];
1294 1294
 
1295
-				    $value = NULL;
1295
+					$value = NULL;
1296 1296
 
1297
-				    // Use the previous entry value as the default.
1298
-				    if( isset( $entry[ $field->id ] ) ) {
1299
-				        $value = $entry[ $field->id ];
1300
-				    }
1297
+					// Use the previous entry value as the default.
1298
+					if( isset( $entry[ $field->id ] ) ) {
1299
+						$value = $entry[ $field->id ];
1300
+					}
1301 1301
 
1302
-				    // If this is a single upload file
1303
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1304
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1305
-				        $value = $file_path['url'];
1302
+					// If this is a single upload file
1303
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1304
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1305
+						$value = $file_path['url'];
1306 1306
 
1307
-				    } else {
1307
+					} else {
1308 1308
 
1309
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1310
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1311
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1309
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1310
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1311
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1312 1312
 
1313
-				    }
1313
+					}
1314 1314
 
1315
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1315
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1316 1316
 
1317
-				        // If there are fresh uploads, process and merge them.
1318
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1319
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1320
-				            $value = empty( $value ) ? '[]' : $value;
1321
-				            $value = stripslashes_deep( $value );
1322
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1323
-				        }
1317
+						// If there are fresh uploads, process and merge them.
1318
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1319
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1320
+							$value = empty( $value ) ? '[]' : $value;
1321
+							$value = stripslashes_deep( $value );
1322
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1323
+						}
1324 1324
 
1325
-				    } else {
1325
+					} else {
1326 1326
 
1327
-				        // A file already exists when editing an entry
1328
-				        // We set this to solve issue when file upload fields are required.
1329
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1327
+						// A file already exists when editing an entry
1328
+						// We set this to solve issue when file upload fields are required.
1329
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1330 1330
 
1331
-				    }
1331
+					}
1332 1332
 
1333
-				    $this->entry[ $input_name ] = $value;
1334
-				    $_POST[ $input_name ] = $value;
1333
+					$this->entry[ $input_name ] = $value;
1334
+					$_POST[ $input_name ] = $value;
1335 1335
 
1336
-				    break;
1336
+					break;
1337 1337
 
1338 1338
 				case 'number':
1339
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1340
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1341
-				        $_POST['input_'.$field->id ] = NULL;
1342
-				    }
1343
-				    break;
1339
+					// Fix "undefined index" issue at line 1286 in form_display.php
1340
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1341
+						$_POST['input_'.$field->id ] = NULL;
1342
+					}
1343
+					break;
1344 1344
 			}
1345 1345
 
1346 1346
 		}
@@ -1425,42 +1425,42 @@  discard block
 block discarded – undo
1425 1425
 				case 'fileupload' :
1426 1426
 				case 'post_image':
1427 1427
 
1428
-				    // in case nothing is uploaded but there are already files saved
1429
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1430
-				        $field->failed_validation = false;
1431
-				        unset( $field->validation_message );
1432
-				    }
1428
+					// in case nothing is uploaded but there are already files saved
1429
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1430
+						$field->failed_validation = false;
1431
+						unset( $field->validation_message );
1432
+					}
1433 1433
 
1434
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1435
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1434
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1435
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1436 1436
 
1437
-				        $input_name = 'input_' . $field->id;
1438
-				        //uploaded
1439
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1437
+						$input_name = 'input_' . $field->id;
1438
+						//uploaded
1439
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1440 1440
 
1441
-				        //existent
1442
-				        $entry = $this->get_entry();
1443
-				        $value = NULL;
1444
-				        if( isset( $entry[ $field->id ] ) ) {
1445
-				            $value = json_decode( $entry[ $field->id ], true );
1446
-				        }
1441
+						//existent
1442
+						$entry = $this->get_entry();
1443
+						$value = NULL;
1444
+						if( isset( $entry[ $field->id ] ) ) {
1445
+							$value = json_decode( $entry[ $field->id ], true );
1446
+						}
1447 1447
 
1448
-				        // count uploaded files and existent entry files
1449
-				        $count_files = count( $file_names ) + count( $value );
1448
+						// count uploaded files and existent entry files
1449
+						$count_files = count( $file_names ) + count( $value );
1450 1450
 
1451
-				        if( $count_files > $field->maxFiles ) {
1452
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1453
-				            $field->failed_validation = 1;
1454
-				            $gv_valid = false;
1451
+						if( $count_files > $field->maxFiles ) {
1452
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1453
+							$field->failed_validation = 1;
1454
+							$gv_valid = false;
1455 1455
 
1456
-				            // in case of error make sure the newest upload files are removed from the upload input
1457
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1458
-				        }
1456
+							// in case of error make sure the newest upload files are removed from the upload input
1457
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1458
+						}
1459 1459
 
1460
-				    }
1460
+					}
1461 1461
 
1462 1462
 
1463
-				    break;
1463
+					break;
1464 1464
 
1465 1465
 			}
1466 1466
 
@@ -1471,47 +1471,47 @@  discard block
 block discarded – undo
1471 1471
 
1472 1472
 				switch ( $field_type ) {
1473 1473
 
1474
-				    // Captchas don't need to be re-entered.
1475
-				    case 'captcha':
1474
+					// Captchas don't need to be re-entered.
1475
+					case 'captcha':
1476 1476
 
1477
-				        // Post Image fields aren't editable, so we un-fail them.
1478
-				    case 'post_image':
1479
-				        $field->failed_validation = false;
1480
-				        unset( $field->validation_message );
1481
-				        break;
1477
+						// Post Image fields aren't editable, so we un-fail them.
1478
+					case 'post_image':
1479
+						$field->failed_validation = false;
1480
+						unset( $field->validation_message );
1481
+						break;
1482 1482
 
1483 1483
 				}
1484 1484
 
1485 1485
 				// You can't continue inside a switch, so we do it after.
1486 1486
 				if( empty( $field->failed_validation ) ) {
1487
-				    continue;
1487
+					continue;
1488 1488
 				}
1489 1489
 
1490 1490
 				// checks if the No Duplicates option is not validating entry against itself, since
1491 1491
 				// we're editing a stored entry, it would also assume it's a duplicate.
1492 1492
 				if( !empty( $field->noDuplicates ) ) {
1493 1493
 
1494
-				    $entry = $this->get_entry();
1494
+					$entry = $this->get_entry();
1495 1495
 
1496
-				    // If the value of the entry is the same as the stored value
1497
-				    // Then we can assume it's not a duplicate, it's the same.
1498
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1499
-				        //if value submitted was not changed, then don't validate
1500
-				        $field->failed_validation = false;
1496
+					// If the value of the entry is the same as the stored value
1497
+					// Then we can assume it's not a duplicate, it's the same.
1498
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1499
+						//if value submitted was not changed, then don't validate
1500
+						$field->failed_validation = false;
1501 1501
 
1502
-				        unset( $field->validation_message );
1502
+						unset( $field->validation_message );
1503 1503
 
1504
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1504
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1505 1505
 
1506
-				        continue;
1507
-				    }
1506
+						continue;
1507
+					}
1508 1508
 				}
1509 1509
 
1510 1510
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1511 1511
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1512
-				    unset( $field->validation_message );
1513
-	                $field->validation_message = false;
1514
-				    continue;
1512
+					unset( $field->validation_message );
1513
+					$field->validation_message = false;
1514
+					continue;
1515 1515
 				}
1516 1516
 
1517 1517
 				$gv_valid = false;
@@ -1575,8 +1575,8 @@  discard block
 block discarded – undo
1575 1575
 		// Hide fields depending on admin settings
1576 1576
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1577 1577
 
1578
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1579
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1578
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1579
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1580 1580
 
1581 1581
 		/**
1582 1582
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1636,11 +1636,11 @@  discard block
 block discarded – undo
1636 1636
 		// The edit tab has been configured, so we loop through to configured settings
1637 1637
 		foreach ( $configured_fields as $configured_field ) {
1638 1638
 
1639
-	        /** @var GF_Field $field */
1640
-	        foreach ( $fields as $field ) {
1639
+			/** @var GF_Field $field */
1640
+			foreach ( $fields as $field ) {
1641 1641
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1642
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1643
-				    break;
1642
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1643
+					break;
1644 1644
 				}
1645 1645
 
1646 1646
 			}
@@ -1696,28 +1696,28 @@  discard block
 block discarded – undo
1696 1696
 	 */
1697 1697
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1698 1698
 
1699
-	    /**
1699
+		/**
1700 1700
 		 * @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
1701
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1702
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1703
-	     * @since 1.9.1
1704
-	     * @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.
1705
-	     * @param array $form GF Form array
1706
-	     * @param int $view_id View ID
1707
-	     */
1708
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1709
-
1710
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1701
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1702
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1703
+		 * @since 1.9.1
1704
+		 * @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.
1705
+		 * @param array $form GF Form array
1706
+		 * @param int $view_id View ID
1707
+		 */
1708
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1709
+
1710
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1711 1711
 			foreach( $fields as $k => $field ) {
1712 1712
 				if( $field->adminOnly ) {
1713
-				    unset( $fields[ $k ] );
1713
+					unset( $fields[ $k ] );
1714 1714
 				}
1715 1715
 			}
1716 1716
 			return $fields;
1717 1717
 		}
1718 1718
 
1719
-	    foreach( $fields as &$field ) {
1720
-		    $field->adminOnly = false;
1719
+		foreach( $fields as &$field ) {
1720
+			$field->adminOnly = false;
1721 1721
 		}
1722 1722
 
1723 1723
 		return $fields;
@@ -1750,36 +1750,36 @@  discard block
 block discarded – undo
1750 1750
 
1751 1751
 			if( 'checkbox' === $field->type ) {
1752 1752
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1753
-				    $input_id = $input['id'];
1754
-				    $choice = $field->choices[ $key ];
1755
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1756
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1757
-				    if( $match ) {
1758
-				        $field->choices[ $key ]['isSelected'] = true;
1759
-				    }
1753
+					$input_id = $input['id'];
1754
+					$choice = $field->choices[ $key ];
1755
+					$value = \GV\Utils::get( $this->entry, $input_id );
1756
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1757
+					if( $match ) {
1758
+						$field->choices[ $key ]['isSelected'] = true;
1759
+					}
1760 1760
 				}
1761 1761
 			} else {
1762 1762
 
1763 1763
 				// We need to run through each field to set the default values
1764 1764
 				foreach ( $this->entry as $field_id => $field_value ) {
1765 1765
 
1766
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1766
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1767 1767
 
1768
-				        if( 'list' === $field->type ) {
1769
-				            $list_rows = maybe_unserialize( $field_value );
1768
+						if( 'list' === $field->type ) {
1769
+							$list_rows = maybe_unserialize( $field_value );
1770 1770
 
1771
-				            $list_field_value = array();
1772
-				            foreach ( (array) $list_rows as $row ) {
1773
-				                foreach ( (array) $row as $column ) {
1774
-				                    $list_field_value[] = $column;
1775
-				                }
1776
-				            }
1771
+							$list_field_value = array();
1772
+							foreach ( (array) $list_rows as $row ) {
1773
+								foreach ( (array) $row as $column ) {
1774
+									$list_field_value[] = $column;
1775
+								}
1776
+							}
1777 1777
 
1778
-				            $field->defaultValue = serialize( $list_field_value );
1779
-				        } else {
1780
-				            $field->defaultValue = $field_value;
1781
-				        }
1782
-				    }
1778
+							$field->defaultValue = serialize( $list_field_value );
1779
+						} else {
1780
+							$field->defaultValue = $field_value;
1781
+						}
1782
+					}
1783 1783
 				}
1784 1784
 			}
1785 1785
 		}
@@ -1836,7 +1836,7 @@  discard block
 block discarded – undo
1836 1836
 			return $has_conditional_logic;
1837 1837
 		}
1838 1838
 
1839
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1839
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1840 1840
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
1841 1841
 	}
1842 1842
 
@@ -1903,14 +1903,14 @@  discard block
 block discarded – undo
1903 1903
 
1904 1904
 		if( $echo && $error !== true ) {
1905 1905
 
1906
-	        $error = esc_html( $error );
1906
+			$error = esc_html( $error );
1907 1907
 
1908
-	        /**
1909
-	         * @since 1.9
1910
-	         */
1911
-	        if ( ! empty( $this->entry ) ) {
1912
-		        $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;" ) );
1913
-	        }
1908
+			/**
1909
+			 * @since 1.9
1910
+			 */
1911
+			if ( ! empty( $this->entry ) ) {
1912
+				$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;" ) );
1913
+			}
1914 1914
 
1915 1915
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1916 1916
 		}
Please login to merge, or discard this patch.
Spacing   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 	function load() {
107 107
 
108 108
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
109
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
109
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
110 110
 
111 111
 		// Don't display an embedded form when editing an entry
112 112
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
113 113
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
114 114
 
115 115
 		// Stop Gravity Forms processing what is ours!
116
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
116
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
117 117
 
118
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
118
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
119 119
 
120 120
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
121 121
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
127 127
 
128 128
 		// Add fields expected by GFFormDisplay::validate()
129
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
129
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
130 130
 
131 131
 		// Fix multiselect value for GF 2.2
132 132
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 * @return void
144 144
 	 */
145 145
 	public function prevent_render_form() {
146
-		if( $this->is_edit_entry() ) {
147
-			if( 'wp_head' === current_filter() ) {
146
+		if ( $this->is_edit_entry() ) {
147
+			if ( 'wp_head' === current_filter() ) {
148 148
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
149 149
 			} else {
150 150
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function prevent_maybe_process_form() {
161 161
 
162
-		if( ! empty( $_POST ) ) {
162
+		if ( ! empty( $_POST ) ) {
163 163
 	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
164 164
 		}
165 165
 
166
-		if( $this->is_edit_entry_submission() ) {
167
-			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
168
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
166
+		if ( $this->is_edit_entry_submission() ) {
167
+			remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
168
+	        remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
169 169
 		}
170 170
 	}
171 171
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function is_edit_entry() {
177 177
 
178
-		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
178
+		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
179 179
 
180 180
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
181 181
 	}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @return boolean
187 187
 	 */
188 188
 	public function is_edit_entry_submission() {
189
-		return !empty( $_POST[ self::$nonce_field ] );
189
+		return ! empty( $_POST[ self::$nonce_field ] );
190 190
 	}
191 191
 
192 192
 	/**
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 		$entries = $gravityview_view->getEntries();
200
-	    self::$original_entry = $entries[0];
201
-	    $this->entry = $entries[0];
200
+	    self::$original_entry = $entries[ 0 ];
201
+	    $this->entry = $entries[ 0 ];
202 202
 
203 203
 		self::$original_form = $gravityview_view->getForm();
204 204
 		$this->form = $gravityview_view->getForm();
205 205
 		$this->form_id = $gravityview_view->getFormId();
206 206
 		$this->view_id = $gravityview_view->getViewId();
207 207
 
208
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
208
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
209 209
 	}
210 210
 
211 211
 
@@ -229,13 +229,13 @@  discard block
 block discarded – undo
229 229
 		}
230 230
 
231 231
 		// Multiple Views embedded, don't proceed if nonce fails
232
-		if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) {
232
+		if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) {
233 233
 			gravityview()->log->error( 'Nonce validation failed for the Edit Entry request; returning' );
234 234
 			return;
235 235
 		}
236 236
 
237 237
 		// Sorry, you're not allowed here.
238
-		if( false === $this->user_can_edit_entry( true ) ) {
238
+		if ( false === $this->user_can_edit_entry( true ) ) {
239 239
 			gravityview()->log->error( 'User is not allowed to edit this entry; returning', array( 'data' => $this->entry ) );
240 240
 			return;
241 241
 		}
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	private function print_scripts() {
257 257
 		$gravityview_view = GravityView_View::getInstance();
258 258
 
259
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
259
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
260 260
 
261
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
261
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
262 262
 
263 263
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
264 264
 
@@ -272,19 +272,19 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	private function process_save() {
274 274
 
275
-		if( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
275
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
276 276
 			return;
277 277
 		}
278 278
 
279 279
 		// Make sure the entry, view, and form IDs are all correct
280 280
 		$valid = $this->verify_nonce();
281 281
 
282
-		if( !$valid ) {
282
+		if ( ! $valid ) {
283 283
 			gravityview()->log->error( 'Nonce validation failed.' );
284 284
 			return;
285 285
 		}
286 286
 
287
-		if( $this->entry['id'] !== $_POST['lid'] ) {
287
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
288 288
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
289 289
 			return;
290 290
 		}
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 		$this->validate();
297 297
 
298
-		if( $this->is_valid ) {
298
+		if ( $this->is_valid ) {
299 299
 
300 300
 			gravityview()->log->debug( 'Submission is valid.' );
301 301
 
@@ -307,22 +307,22 @@  discard block
 block discarded – undo
307 307
 			/**
308 308
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
309 309
 			 */
310
-			unset( $_GET['page'] );
310
+			unset( $_GET[ 'page' ] );
311 311
 
312
-			$date_created = $this->entry['date_created'];
312
+			$date_created = $this->entry[ 'date_created' ];
313 313
 
314 314
 			/**
315 315
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
316 316
 			 * @since 1.17.2
317 317
 			 */
318
-			unset( $this->entry['date_created'] );
318
+			unset( $this->entry[ 'date_created' ] );
319 319
 
320 320
 			GFFormsModel::save_lead( $form, $this->entry );
321 321
 
322 322
 	        // Delete the values for hidden inputs
323 323
 	        $this->unset_hidden_field_values();
324 324
 			
325
-			$this->entry['date_created'] = $date_created;
325
+			$this->entry[ 'date_created' ] = $date_created;
326 326
 
327 327
 			// Process calculation fields
328 328
 			$this->update_calculation_fields();
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			 * @param string $entry_id Numeric ID of the entry that was updated
343 343
 			 * @param GravityView_Edit_Entry_Render $this This object
344 344
 			 */
345
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this );
345
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this );
346 346
 
347 347
 		} else {
348 348
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -370,16 +370,16 @@  discard block
 block discarded – undo
370 370
 		 */
371 371
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
372 372
 
373
-		if( ! $unset_hidden_field_values ) {
373
+		if ( ! $unset_hidden_field_values ) {
374 374
 			return;
375 375
 		}
376 376
 
377 377
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
378 378
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
379
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
379
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
380 380
 		} else {
381 381
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
382
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
382
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
383 383
 		}
384 384
 
385 385
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		}
461 461
 
462 462
 		/** No file is being uploaded. */
463
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
463
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
464 464
 			/** So return the original upload */
465 465
 			return $entry[ $input_id ];
466 466
 		}
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 	 * @return mixed
479 479
 	 */
480 480
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
481
-		if( ! $this->is_edit_entry() ) {
481
+		if ( ! $this->is_edit_entry() ) {
482 482
 			return $plupload_init;
483 483
 		}
484 484
 
485
-		$plupload_init['gf_vars']['max_files'] = 0;
485
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
486 486
 
487 487
 		return $plupload_init;
488 488
 	}
@@ -497,22 +497,22 @@  discard block
 block discarded – undo
497 497
 		$form = $this->form;
498 498
 
499 499
 	    /** @var GF_Field $field */
500
-		foreach( $form['fields'] as $k => &$field ) {
500
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
501 501
 
502 502
 			/**
503 503
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
504 504
 			 * @since 1.16.3
505 505
 			 * @var GF_Field $field
506 506
 			 */
507
-			if( $field->has_calculation() ) {
508
-				unset( $form['fields'][ $k ] );
507
+			if ( $field->has_calculation() ) {
508
+				unset( $form[ 'fields' ][ $k ] );
509 509
 			}
510 510
 
511 511
 			$field->adminOnly = false;
512 512
 
513
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
514
-				foreach( $field->inputs as $key => $input ) {
515
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
513
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
514
+				foreach ( $field->inputs as $key => $input ) {
515
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
516 516
 				}
517 517
 			}
518 518
 		}
@@ -526,30 +526,30 @@  discard block
 block discarded – undo
526 526
 		$update = false;
527 527
 
528 528
 		// get the most up to date entry values
529
-		$entry = GFAPI::get_entry( $this->entry['id'] );
529
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
530 530
 
531
-		if( !empty( $this->fields_with_calculation ) ) {
531
+		if ( ! empty( $this->fields_with_calculation ) ) {
532 532
 			$update = true;
533 533
 			foreach ( $this->fields_with_calculation as $calc_field ) {
534 534
 				$inputs = $calc_field->get_entry_inputs();
535 535
 				if ( is_array( $inputs ) ) {
536 536
 				    foreach ( $inputs as $input ) {
537
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
538
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
537
+				        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
538
+				        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
539 539
 				    }
540 540
 				} else {
541
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
542
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
541
+				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
542
+				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
543 543
 				}
544 544
 			}
545 545
 
546 546
 		}
547 547
 
548
-		if( $update ) {
548
+		if ( $update ) {
549 549
 
550 550
 			$return_entry = GFAPI::update_entry( $entry );
551 551
 
552
-			if( is_wp_error( $return_entry ) ) {
552
+			if ( is_wp_error( $return_entry ) ) {
553 553
 				gravityview()->log->error( 'Updating the entry calculation fields failed', array( 'data' => $return_entry ) );
554 554
 			} else {
555 555
 				gravityview()->log->debug( 'Updating the entry calculation fields succeeded' );
@@ -580,19 +580,19 @@  discard block
 block discarded – undo
580 580
 
581 581
 		$input_name = 'input_' . $field_id;
582 582
 
583
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
583
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
584 584
 
585 585
 			// We have a new image
586 586
 
587
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
587
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
588 588
 
589 589
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
590 590
 	        $ary = stripslashes_deep( $ary );
591 591
 			$img_url = \GV\Utils::get( $ary, 0 );
592 592
 
593
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
594
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
595
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
593
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
594
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
595
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
596 596
 
597 597
 			$image_meta = array(
598 598
 				'post_excerpt' => $img_caption,
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 
602 602
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
603 603
 			if ( ! empty( $img_title ) ) {
604
-				$image_meta['post_title'] = $img_title;
604
+				$image_meta[ 'post_title' ] = $img_title;
605 605
 			}
606 606
 
607 607
 			/**
@@ -659,15 +659,15 @@  discard block
 block discarded – undo
659 659
 	 */
660 660
 	private function maybe_update_post_fields( $form ) {
661 661
 
662
-		if( empty( $this->entry['post_id'] ) ) {
662
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
663 663
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
664 664
 			return;
665 665
 		}
666 666
 
667
-		$post_id = $this->entry['post_id'];
667
+		$post_id = $this->entry[ 'post_id' ];
668 668
 
669 669
 		// Security check
670
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
670
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
671 671
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
672 672
 			return;
673 673
 		}
@@ -680,25 +680,25 @@  discard block
 block discarded – undo
680 680
 
681 681
 			$field = RGFormsModel::get_field( $form, $field_id );
682 682
 
683
-			if( ! $field ) {
683
+			if ( ! $field ) {
684 684
 				continue;
685 685
 			}
686 686
 
687
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
687
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
688 688
 
689 689
 				// Get the value of the field, including $_POSTed value
690 690
 				$value = RGFormsModel::get_field_value( $field );
691 691
 
692 692
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
693 693
 				$entry_tmp = $this->entry;
694
-				$entry_tmp["{$field_id}"] = $value;
694
+				$entry_tmp[ "{$field_id}" ] = $value;
695 695
 
696
-				switch( $field->type ) {
696
+				switch ( $field->type ) {
697 697
 
698 698
 				    case 'post_title':
699 699
 				        $post_title = $value;
700 700
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
701
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
701
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
702 702
 				        }
703 703
 				        $updated_post->post_title = $post_title;
704 704
 				        $updated_post->post_name  = $post_title;
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 				    case 'post_content':
709 709
 				        $post_content = $value;
710 710
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
711
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
711
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
712 712
 				        }
713 713
 				        $updated_post->post_content = $post_content;
714 714
 				        unset( $post_content );
@@ -726,12 +726,12 @@  discard block
 block discarded – undo
726 726
 							$value = $value[ $field_id ];
727 727
 						}
728 728
 
729
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
729
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
730 730
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
731 731
 				        }
732 732
 
733 733
 	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
734
-		                    $value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
734
+		                    $value = function_exists( 'wp_json_encode' ) ? wp_json_encode( $value ) : json_encode( $value );
735 735
 	                    }
736 736
 
737 737
 				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 				}
745 745
 
746 746
 				// update entry after
747
-				$this->entry["{$field_id}"] = $value;
747
+				$this->entry[ "{$field_id}" ] = $value;
748 748
 
749 749
 				$update_entry = true;
750 750
 
@@ -753,11 +753,11 @@  discard block
 block discarded – undo
753 753
 
754 754
 		}
755 755
 
756
-		if( $update_entry ) {
756
+		if ( $update_entry ) {
757 757
 
758 758
 			$return_entry = GFAPI::update_entry( $this->entry );
759 759
 
760
-			if( is_wp_error( $return_entry ) ) {
760
+			if ( is_wp_error( $return_entry ) ) {
761 761
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
762 762
 			} else {
763 763
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 
768 768
 		$return_post = wp_update_post( $updated_post, true );
769 769
 
770
-		if( is_wp_error( $return_post ) ) {
770
+		if ( is_wp_error( $return_post ) ) {
771 771
 			$return_post->add_data( $updated_post, '$updated_post' );
772 772
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
773 773
 		} else {
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 		$input_type = RGFormsModel::get_input_type( $field );
790 790
 
791 791
 	    // Only certain custom field types are supported
792
-	    switch( $input_type ) {
792
+	    switch ( $input_type ) {
793 793
 		    case 'fileupload':
794 794
 		    case 'list':
795 795
 		    case 'multiselect':
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
827 827
 
828 828
 		// replace conditional shortcodes
829
-		if( $do_shortcode ) {
829
+		if ( $do_shortcode ) {
830 830
 			$output = do_shortcode( $output );
831 831
 		}
832 832
 
@@ -845,19 +845,19 @@  discard block
 block discarded – undo
845 845
 	 */
846 846
 	private function after_update() {
847 847
 
848
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
849
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
848
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
849
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
850 850
 
851 851
 		// Re-define the entry now that we've updated it.
852
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
852
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
853 853
 
854 854
 		$entry = GFFormsModel::set_entry_meta( $entry, $this->form );
855 855
 
856 856
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
857 857
 			// We need to clear the cache because Gravity Forms caches the field values, which
858 858
 			// we have just updated.
859
-			foreach ($this->form['fields'] as $key => $field) {
860
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
859
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
860
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
861 861
 			}
862 862
 		}
863 863
 
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 
877 877
 		<div class="gv-edit-entry-wrapper"><?php
878 878
 
879
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
879
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
880 880
 
881 881
 			/**
882 882
 			 * Fixes weird wpautop() issue
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
893 893
 				     * @param GravityView_Edit_Entry_Render $this This object
894 894
 				     */
895
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
895
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
896 896
 
897 897
 				    echo esc_attr( $edit_entry_title );
898 898
 			?></span>
@@ -942,16 +942,16 @@  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
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
949
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
948
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
949
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
950 950
 
951
-				echo GVCommon::generate_notice( $message , 'gv-error' );
951
+				echo GVCommon::generate_notice( $message, 'gv-error' );
952 952
 
953 953
 			} else {
954
-				$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
954
+				$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
955 955
 
956 956
 				/**
957 957
 				 * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 				 * @param array $entry Gravity Forms entry array
962 962
 				 * @param string $back_link URL to return to the original entry. @since 1.6
963 963
 				 */
964
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
964
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
965 965
 
966 966
 				echo GVCommon::generate_notice( $message );
967 967
 			}
@@ -985,21 +985,21 @@  discard block
 block discarded – undo
985 985
 		 */
986 986
 		do_action( 'gravityview/edit-entry/render/before', $this );
987 987
 
988
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
989
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
988
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
989
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
990 990
 		add_filter( 'gform_disable_view_counter', '__return_true' );
991 991
 
992 992
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
993 993
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
994 994
 
995 995
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
996
-		unset( $_GET['page'] );
996
+		unset( $_GET[ 'page' ] );
997 997
 
998 998
 		// TODO: Verify multiple-page forms
999 999
 
1000 1000
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1001 1001
 
1002
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1002
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1003 1003
 
1004 1004
 		ob_get_clean();
1005 1005
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 	 * @return string
1026 1026
 	 */
1027 1027
 	public function render_form_buttons() {
1028
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1028
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1045,10 +1045,10 @@  discard block
 block discarded – undo
1045 1045
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1046 1046
 
1047 1047
 		// In case we have validated the form, use it to inject the validation results into the form render
1048
-		if( isset( $this->form_after_validation ) ) {
1048
+		if ( isset( $this->form_after_validation ) ) {
1049 1049
 			$form = $this->form_after_validation;
1050 1050
 		} else {
1051
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1051
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1052 1052
 		}
1053 1053
 
1054 1054
 		$form = $this->filter_conditional_logic( $form );
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
 		$form = $this->prefill_conditional_logic( $form );
1057 1057
 
1058 1058
 		// for now we don't support Save and Continue feature.
1059
-		if( ! self::$supports_save_and_continue ) {
1060
-	        unset( $form['save'] );
1059
+		if ( ! self::$supports_save_and_continue ) {
1060
+	        unset( $form[ 'save' ] );
1061 1061
 		}
1062 1062
 
1063 1063
 		return $form;
@@ -1078,29 +1078,29 @@  discard block
 block discarded – undo
1078 1078
 	 */
1079 1079
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1080 1080
 
1081
-		if( GFCommon::is_post_field( $field ) ) {
1081
+		if ( GFCommon::is_post_field( $field ) ) {
1082 1082
 
1083 1083
 			$message = null;
1084 1084
 
1085 1085
 			// First, make sure they have the capability to edit the post.
1086
-			if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1086
+			if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1087 1087
 
1088 1088
 				/**
1089 1089
 				 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1090 1090
 				 * @param string $message The existing "You don't have permission..." text
1091 1091
 				 */
1092
-				$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1092
+				$message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1093 1093
 
1094
-			} elseif( null === get_post( $this->entry['post_id'] ) ) {
1094
+			} elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1095 1095
 				/**
1096 1096
 				 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1097 1097
 				 * @param string $message The existing "This field is not editable; the post no longer exists." text
1098 1098
 				 */
1099
-				$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1099
+				$message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1100 1100
 			}
1101 1101
 
1102
-			if( $message ) {
1103
-				$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1102
+			if ( $message ) {
1103
+				$field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1104 1104
 			}
1105 1105
 		}
1106 1106
 
@@ -1125,8 +1125,8 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 		// If the form has been submitted, then we don't need to pre-fill the values,
1127 1127
 		// Except for fileupload type and when a field input is overridden- run always!!
1128
-		if(
1129
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1128
+		if (
1129
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1130 1130
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1131 1131
 			&& ! GFCommon::is_product_field( $field->type )
1132 1132
 			|| ! empty( $field_content )
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 	    $return = null;
1147 1147
 
1148 1148
 		/** @var GravityView_Field $gv_field */
1149
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1149
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1150 1150
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1151 1151
 		} else {
1152 1152
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 	    // If there was output, it's an error
1156 1156
 	    $warnings = ob_get_clean();
1157 1157
 
1158
-	    if( !empty( $warnings ) ) {
1158
+	    if ( ! empty( $warnings ) ) {
1159 1159
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1160 1160
 	    }
1161 1161
 
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1181 1181
 
1182 1182
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1183
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1183
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1184 1184
 
1185 1185
 			$field_value = array();
1186 1186
 
@@ -1189,10 +1189,10 @@  discard block
 block discarded – undo
1189 1189
 
1190 1190
 			foreach ( (array)$field->inputs as $input ) {
1191 1191
 
1192
-				$input_id = strval( $input['id'] );
1192
+				$input_id = strval( $input[ 'id' ] );
1193 1193
 				
1194 1194
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1195
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1195
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1196 1196
 				    $allow_pre_populated = false;
1197 1197
 				}
1198 1198
 
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 
1201 1201
 			$pre_value = $field->get_value_submission( array(), false );
1202 1202
 
1203
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1203
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1204 1204
 
1205 1205
 		} else {
1206 1206
 
@@ -1211,13 +1211,13 @@  discard block
 block discarded – undo
1211 1211
 
1212 1212
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1213 1213
 			// or pre-populated value if not empty and set to override saved value
1214
-			$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;
1214
+			$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;
1215 1215
 
1216 1216
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1217
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1217
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1218 1218
 				$categories = array();
1219 1219
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1220
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1220
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1221 1221
 				}
1222 1222
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1223 1223
 			}
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 	     * @param GF_Field $field Gravity Forms field object
1246 1246
 	     * @param GravityView_Edit_Entry_Render $this Current object
1247 1247
 	     */
1248
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1248
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1249 1249
 
1250 1250
 		return $field_value;
1251 1251
 	}
@@ -1262,12 +1262,12 @@  discard block
 block discarded – undo
1262 1262
 	 */
1263 1263
 	public function gform_pre_validation( $form ) {
1264 1264
 
1265
-		if( ! $this->verify_nonce() ) {
1265
+		if ( ! $this->verify_nonce() ) {
1266 1266
 			return $form;
1267 1267
 		}
1268 1268
 
1269 1269
 		// Fix PHP warning regarding undefined index.
1270
-		foreach ( $form['fields'] as &$field) {
1270
+		foreach ( $form[ 'fields' ] as &$field ) {
1271 1271
 
1272 1272
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1273 1273
 			// expects certain field array items to be set.
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1276 1276
 			}
1277 1277
 
1278
-			switch( RGFormsModel::get_input_type( $field ) ) {
1278
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1279 1279
 
1280 1280
 				/**
1281 1281
 				 * 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.
@@ -1289,26 +1289,26 @@  discard block
 block discarded – undo
1289 1289
 				    // Set the previous value
1290 1290
 				    $entry = $this->get_entry();
1291 1291
 
1292
-				    $input_name = 'input_'.$field->id;
1293
-				    $form_id = $form['id'];
1292
+				    $input_name = 'input_' . $field->id;
1293
+				    $form_id = $form[ 'id' ];
1294 1294
 
1295 1295
 				    $value = NULL;
1296 1296
 
1297 1297
 				    // Use the previous entry value as the default.
1298
-				    if( isset( $entry[ $field->id ] ) ) {
1298
+				    if ( isset( $entry[ $field->id ] ) ) {
1299 1299
 				        $value = $entry[ $field->id ];
1300 1300
 				    }
1301 1301
 
1302 1302
 				    // If this is a single upload file
1303
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1304
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1305
-				        $value = $file_path['url'];
1303
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1304
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1305
+				        $value = $file_path[ 'url' ];
1306 1306
 
1307 1307
 				    } else {
1308 1308
 
1309 1309
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1310 1310
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1311
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1311
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1312 1312
 
1313 1313
 				    }
1314 1314
 
@@ -1316,10 +1316,10 @@  discard block
 block discarded – undo
1316 1316
 
1317 1317
 				        // If there are fresh uploads, process and merge them.
1318 1318
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1319
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1319
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1320 1320
 				            $value = empty( $value ) ? '[]' : $value;
1321 1321
 				            $value = stripslashes_deep( $value );
1322
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1322
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1323 1323
 				        }
1324 1324
 
1325 1325
 				    } else {
@@ -1337,8 +1337,8 @@  discard block
 block discarded – undo
1337 1337
 
1338 1338
 				case 'number':
1339 1339
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1340
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1341
-				        $_POST['input_'.$field->id ] = NULL;
1340
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1341
+				        $_POST[ 'input_' . $field->id ] = NULL;
1342 1342
 				    }
1343 1343
 				    break;
1344 1344
 			}
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 		 * You can enter whatever you want!
1376 1376
 		 * We try validating, and customize the results using `self::custom_validation()`
1377 1377
 		 */
1378
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1378
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1379 1379
 
1380 1380
 		// Needed by the validate funtion
1381 1381
 		$failed_validation_page = NULL;
@@ -1383,14 +1383,14 @@  discard block
 block discarded – undo
1383 1383
 
1384 1384
 		// Prevent entry limit from running when editing an entry, also
1385 1385
 		// prevent form scheduling from preventing editing
1386
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1386
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1387 1387
 
1388 1388
 		// Hide fields depending on Edit Entry settings
1389
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1389
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1390 1390
 
1391 1391
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1392 1392
 
1393
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1393
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1394 1394
 	}
1395 1395
 
1396 1396
 
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 
1414 1414
 		$gv_valid = true;
1415 1415
 
1416
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1416
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1417 1417
 
1418 1418
 			$value = RGFormsModel::get_field_value( $field );
1419 1419
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1426,35 +1426,35 @@  discard block
 block discarded – undo
1426 1426
 				case 'post_image':
1427 1427
 
1428 1428
 				    // in case nothing is uploaded but there are already files saved
1429
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1429
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1430 1430
 				        $field->failed_validation = false;
1431 1431
 				        unset( $field->validation_message );
1432 1432
 				    }
1433 1433
 
1434 1434
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1435
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1435
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1436 1436
 
1437 1437
 				        $input_name = 'input_' . $field->id;
1438 1438
 				        //uploaded
1439
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1439
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1440 1440
 
1441 1441
 				        //existent
1442 1442
 				        $entry = $this->get_entry();
1443 1443
 				        $value = NULL;
1444
-				        if( isset( $entry[ $field->id ] ) ) {
1444
+				        if ( isset( $entry[ $field->id ] ) ) {
1445 1445
 				            $value = json_decode( $entry[ $field->id ], true );
1446 1446
 				        }
1447 1447
 
1448 1448
 				        // count uploaded files and existent entry files
1449 1449
 				        $count_files = count( $file_names ) + count( $value );
1450 1450
 
1451
-				        if( $count_files > $field->maxFiles ) {
1451
+				        if ( $count_files > $field->maxFiles ) {
1452 1452
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1453 1453
 				            $field->failed_validation = 1;
1454 1454
 				            $gv_valid = false;
1455 1455
 
1456 1456
 				            // in case of error make sure the newest upload files are removed from the upload input
1457
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1457
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1458 1458
 				        }
1459 1459
 
1460 1460
 				    }
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 			}
1466 1466
 
1467 1467
 			// This field has failed validation.
1468
-			if( !empty( $field->failed_validation ) ) {
1468
+			if ( ! empty( $field->failed_validation ) ) {
1469 1469
 
1470 1470
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1471 1471
 
@@ -1483,19 +1483,19 @@  discard block
 block discarded – undo
1483 1483
 				}
1484 1484
 
1485 1485
 				// You can't continue inside a switch, so we do it after.
1486
-				if( empty( $field->failed_validation ) ) {
1486
+				if ( empty( $field->failed_validation ) ) {
1487 1487
 				    continue;
1488 1488
 				}
1489 1489
 
1490 1490
 				// checks if the No Duplicates option is not validating entry against itself, since
1491 1491
 				// we're editing a stored entry, it would also assume it's a duplicate.
1492
-				if( !empty( $field->noDuplicates ) ) {
1492
+				if ( ! empty( $field->noDuplicates ) ) {
1493 1493
 
1494 1494
 				    $entry = $this->get_entry();
1495 1495
 
1496 1496
 				    // If the value of the entry is the same as the stored value
1497 1497
 				    // Then we can assume it's not a duplicate, it's the same.
1498
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1498
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1499 1499
 				        //if value submitted was not changed, then don't validate
1500 1500
 				        $field->failed_validation = false;
1501 1501
 
@@ -1508,7 +1508,7 @@  discard block
 block discarded – undo
1508 1508
 				}
1509 1509
 
1510 1510
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1511
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1511
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1512 1512
 				    unset( $field->validation_message );
1513 1513
 	                $field->validation_message = false;
1514 1514
 				    continue;
@@ -1520,12 +1520,12 @@  discard block
 block discarded – undo
1520 1520
 
1521 1521
 		}
1522 1522
 
1523
-		$validation_results['is_valid'] = $gv_valid;
1523
+		$validation_results[ 'is_valid' ] = $gv_valid;
1524 1524
 
1525 1525
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1526 1526
 
1527 1527
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1528
-		$this->form_after_validation = $validation_results['form'];
1528
+		$this->form_after_validation = $validation_results[ 'form' ];
1529 1529
 
1530 1530
 		return $validation_results;
1531 1531
 	}
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
 	 */
1539 1539
 	public function get_entry() {
1540 1540
 
1541
-		if( empty( $this->entry ) ) {
1541
+		if ( empty( $this->entry ) ) {
1542 1542
 			// Get the database value of the entry that's being edited
1543 1543
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1544 1544
 		}
@@ -1570,10 +1570,10 @@  discard block
 block discarded – undo
1570 1570
 		}
1571 1571
 
1572 1572
 		// If edit tab not yet configured, show all fields
1573
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1573
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1574 1574
 
1575 1575
 		// Hide fields depending on admin settings
1576
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1576
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1577 1577
 
1578 1578
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1579 1579
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 	 */
1606 1606
 	private function filter_fields( $fields, $configured_fields ) {
1607 1607
 
1608
-		if( empty( $fields ) || !is_array( $fields ) ) {
1608
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1609 1609
 			return $fields;
1610 1610
 		}
1611 1611
 
@@ -1618,18 +1618,18 @@  discard block
 block discarded – undo
1618 1618
 
1619 1619
 			// Remove the fields that have calculation properties and keep them to be used later
1620 1620
 			// @since 1.16.2
1621
-			if( $field->has_calculation() ) {
1622
-				$this->fields_with_calculation[] = $field;
1621
+			if ( $field->has_calculation() ) {
1622
+				$this->fields_with_calculation[ ] = $field;
1623 1623
 				// don't remove the calculation fields on form render.
1624 1624
 			}
1625 1625
 
1626
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1626
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1627 1627
 				unset( $fields[ $key ] );
1628 1628
 			}
1629 1629
 		}
1630 1630
 
1631 1631
 		// The Edit tab has not been configured, so we return all fields by default.
1632
-		if( empty( $configured_fields ) ) {
1632
+		if ( empty( $configured_fields ) ) {
1633 1633
 			return $fields;
1634 1634
 		}
1635 1635
 
@@ -1638,8 +1638,8 @@  discard block
 block discarded – undo
1638 1638
 
1639 1639
 	        /** @var GF_Field $field */
1640 1640
 	        foreach ( $fields as $field ) {
1641
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1642
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1641
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1642
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1643 1643
 				    break;
1644 1644
 				}
1645 1645
 
@@ -1662,14 +1662,14 @@  discard block
 block discarded – undo
1662 1662
 
1663 1663
 		$return_field = $field;
1664 1664
 
1665
-		if( empty( $field_setting['show_label'] ) ) {
1665
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1666 1666
 			$return_field->label = '';
1667
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1668
-			$return_field->label = $field_setting['custom_label'];
1667
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1668
+			$return_field->label = $field_setting[ 'custom_label' ];
1669 1669
 		}
1670 1670
 
1671
-		if( !empty( $field_setting['custom_class'] ) ) {
1672
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1671
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1672
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1673 1673
 		}
1674 1674
 
1675 1675
 		/**
@@ -1707,16 +1707,16 @@  discard block
 block discarded – undo
1707 1707
 	     */
1708 1708
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1709 1709
 
1710
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1711
-			foreach( $fields as $k => $field ) {
1712
-				if( $field->adminOnly ) {
1710
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1711
+			foreach ( $fields as $k => $field ) {
1712
+				if ( $field->adminOnly ) {
1713 1713
 				    unset( $fields[ $k ] );
1714 1714
 				}
1715 1715
 			}
1716 1716
 			return $fields;
1717 1717
 		}
1718 1718
 
1719
-	    foreach( $fields as &$field ) {
1719
+	    foreach ( $fields as &$field ) {
1720 1720
 		    $field->adminOnly = false;
1721 1721
 		}
1722 1722
 
@@ -1740,22 +1740,22 @@  discard block
 block discarded – undo
1740 1740
 	 */
1741 1741
 	function prefill_conditional_logic( $form ) {
1742 1742
 
1743
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1743
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1744 1744
 			return $form;
1745 1745
 		}
1746 1746
 
1747 1747
 		// Have Conditional Logic pre-fill fields as if the data were default values
1748 1748
 		/** @var GF_Field $field */
1749
-		foreach ( $form['fields'] as &$field ) {
1749
+		foreach ( $form[ 'fields' ] as &$field ) {
1750 1750
 
1751
-			if( 'checkbox' === $field->type ) {
1751
+			if ( 'checkbox' === $field->type ) {
1752 1752
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1753
-				    $input_id = $input['id'];
1753
+				    $input_id = $input[ 'id' ];
1754 1754
 				    $choice = $field->choices[ $key ];
1755 1755
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1756 1756
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1757
-				    if( $match ) {
1758
-				        $field->choices[ $key ]['isSelected'] = true;
1757
+				    if ( $match ) {
1758
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1759 1759
 				    }
1760 1760
 				}
1761 1761
 			} else {
@@ -1763,15 +1763,15 @@  discard block
 block discarded – undo
1763 1763
 				// We need to run through each field to set the default values
1764 1764
 				foreach ( $this->entry as $field_id => $field_value ) {
1765 1765
 
1766
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1766
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1767 1767
 
1768
-				        if( 'list' === $field->type ) {
1768
+				        if ( 'list' === $field->type ) {
1769 1769
 				            $list_rows = maybe_unserialize( $field_value );
1770 1770
 
1771 1771
 				            $list_field_value = array();
1772
-				            foreach ( (array) $list_rows as $row ) {
1773
-				                foreach ( (array) $row as $column ) {
1774
-				                    $list_field_value[] = $column;
1772
+				            foreach ( (array)$list_rows as $row ) {
1773
+				                foreach ( (array)$row as $column ) {
1774
+				                    $list_field_value[ ] = $column;
1775 1775
 				                }
1776 1776
 				            }
1777 1777
 
@@ -1806,16 +1806,16 @@  discard block
 block discarded – undo
1806 1806
 		 */
1807 1807
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1808 1808
 
1809
-		if( $use_conditional_logic ) {
1809
+		if ( $use_conditional_logic ) {
1810 1810
 			return $form;
1811 1811
 		}
1812 1812
 
1813
-		foreach( $form['fields'] as &$field ) {
1813
+		foreach ( $form[ 'fields' ] as &$field ) {
1814 1814
 			/* @var GF_Field $field */
1815 1815
 			$field->conditionalLogic = null;
1816 1816
 		}
1817 1817
 
1818
-		unset( $form['button']['conditionalLogic'] );
1818
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1819 1819
 
1820 1820
 		return $form;
1821 1821
 
@@ -1832,7 +1832,7 @@  discard block
 block discarded – undo
1832 1832
 	 */
1833 1833
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1834 1834
 
1835
-		if( ! $this->is_edit_entry() ) {
1835
+		if ( ! $this->is_edit_entry() ) {
1836 1836
 			return $has_conditional_logic;
1837 1837
 		}
1838 1838
 
@@ -1864,44 +1864,44 @@  discard block
 block discarded – undo
1864 1864
 		 *  2. There are two entries embedded using oEmbed
1865 1865
 		 *  3. One of the entries has just been saved
1866 1866
 		 */
1867
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1867
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1868 1868
 
1869 1869
 			$error = true;
1870 1870
 
1871 1871
 		}
1872 1872
 
1873
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1873
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1874 1874
 
1875 1875
 			$error = true;
1876 1876
 
1877
-		} elseif( ! $this->verify_nonce() ) {
1877
+		} elseif ( ! $this->verify_nonce() ) {
1878 1878
 
1879 1879
 			/**
1880 1880
 			 * If the Entry is embedded, there may be two entries on the same page.
1881 1881
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1882 1882
 			 */
1883
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1883
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1884 1884
 				$error = true;
1885 1885
 			} else {
1886
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1886
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1887 1887
 			}
1888 1888
 
1889 1889
 		}
1890 1890
 
1891
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1892
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1891
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1892
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1893 1893
 		}
1894 1894
 
1895
-		if( $this->entry['status'] === 'trash' ) {
1896
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1895
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1896
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1897 1897
 		}
1898 1898
 
1899 1899
 		// No errors; everything's fine here!
1900
-		if( empty( $error ) ) {
1900
+		if ( empty( $error ) ) {
1901 1901
 			return true;
1902 1902
 		}
1903 1903
 
1904
-		if( $echo && $error !== true ) {
1904
+		if ( $echo && $error !== true ) {
1905 1905
 
1906 1906
 	        $error = esc_html( $error );
1907 1907
 
@@ -1909,10 +1909,10 @@  discard block
 block discarded – undo
1909 1909
 	         * @since 1.9
1910 1910
 	         */
1911 1911
 	        if ( ! empty( $this->entry ) ) {
1912
-		        $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;" ) );
1912
+		        $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;" ) );
1913 1913
 	        }
1914 1914
 
1915
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1915
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1916 1916
 		}
1917 1917
 
1918 1918
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1932,17 +1932,17 @@  discard block
 block discarded – undo
1932 1932
 
1933 1933
 		$error = NULL;
1934 1934
 
1935
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
1936
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
1935
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
1936
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
1937 1937
 		}
1938 1938
 
1939 1939
 		// No errors; everything's fine here!
1940
-		if( empty( $error ) ) {
1940
+		if ( empty( $error ) ) {
1941 1941
 			return true;
1942 1942
 		}
1943 1943
 
1944
-		if( $echo ) {
1945
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1944
+		if ( $echo ) {
1945
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1946 1946
 		}
1947 1947
 
1948 1948
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1963,14 +1963,14 @@  discard block
 block discarded – undo
1963 1963
 	private function check_user_cap_edit_field( $field ) {
1964 1964
 
1965 1965
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
1966
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1966
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1967 1967
 			return true;
1968 1968
 		}
1969 1969
 
1970
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
1970
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
1971 1971
 
1972
-		if( $field_cap ) {
1973
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
1972
+		if ( $field_cap ) {
1973
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
1974 1974
 		}
1975 1975
 
1976 1976
 		return false;
@@ -1984,17 +1984,17 @@  discard block
 block discarded – undo
1984 1984
 	public function verify_nonce() {
1985 1985
 
1986 1986
 		// Verify form submitted for editing single
1987
-		if( $this->is_edit_entry_submission() ) {
1987
+		if ( $this->is_edit_entry_submission() ) {
1988 1988
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
1989 1989
 		}
1990 1990
 
1991 1991
 		// Verify
1992
-		else if( ! $this->is_edit_entry() ) {
1992
+		else if ( ! $this->is_edit_entry() ) {
1993 1993
 			$valid = false;
1994 1994
 		}
1995 1995
 
1996 1996
 		else {
1997
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
1997
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
1998 1998
 		}
1999 1999
 
2000 2000
 		/**
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/class-gravityview-entry-notes.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
 		global $wpdb;
142 142
 
143 143
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' )
144
-		     && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
144
+			 && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
145 145
 			$notes_table = GFFormsModel::get_entry_notes_table_name();
146 146
 		} else {
147 147
 			$notes_table = GFFormsModel::get_lead_notes_table_name();
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		// Make sure the keys are all set
68 68
 		$note = wp_parse_args( $note, $default_note );
69 69
 
70
-		GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) );
70
+		GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) );
71 71
 
72 72
 		// If last_error is empty string, there was no error.
73
-		if( empty( $wpdb->last_error ) ) {
73
+		if ( empty( $wpdb->last_error ) ) {
74 74
 			$return = $wpdb->insert_id;
75 75
 		} else {
76 76
 			$return = new WP_Error( 'gravityview-add-note', $wpdb->last_error );
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public static function delete_notes( $note_ids = array() ) {
98 98
 
99
-		if( !is_array( $note_ids ) ) {
99
+		if ( ! is_array( $note_ids ) ) {
100 100
 
101 101
 			gravityview()->log->error( 'Note IDs not an array. Not processing delete request.', array( 'data' => $note_ids ) );
102 102
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			)
157 157
 		);
158 158
 
159
-		return $results ? $results[0] : false;
159
+		return $results ? $results[ 0 ] : false;
160 160
 	}
161 161
 
162 162
 	/**
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public static function filter_avatar( $avatar = '', $note ) {
171 171
 
172
-		if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
173
-			$avatar =  sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
172
+		if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
173
+			$avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
174 174
 		}
175 175
 
176 176
 		return $avatar;
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-wpml.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 		add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) );
66 66
 
67
-		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') );
67
+		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) );
68 68
 	}
69 69
 
70 70
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	function filter_gravityview_back_link( $link ) {
85 85
 		global $wpml_url_filters;
86 86
 
87
-		if( $wpml_url_filters ) {
87
+		if ( $wpml_url_filters ) {
88 88
 			$link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() );
89 89
 		}
90 90
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	private function remove_url_hooks() {
102 102
 		global $wpml_url_filters;
103 103
 
104
-		if( ! $wpml_url_filters ) {
104
+		if ( ! $wpml_url_filters ) {
105 105
 			return;
106 106
 		}
107 107
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	private function add_url_hooks() {
130 130
 		global $wpml_url_filters;
131 131
 
132
-		if( ! $wpml_url_filters ) {
132
+		if ( ! $wpml_url_filters ) {
133 133
 			return;
134 134
 		}
135 135
 
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 
179 179
 			$this->remove_url_hooks();
180 180
 
181
-			if( $translations ) {
181
+			if ( $translations ) {
182 182
 				foreach ( $languages as $lang_code => $language ) {
183 183
 
184
-					if( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) {
184
+					if ( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) {
185 185
 						continue;
186 186
 					}
187 187
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 							break;
216 216
 					}
217 217
 
218
-					$languages[ $lang_code ]['url'] = $entry_link;
218
+					$languages[ $lang_code ][ 'url' ] = $entry_link;
219 219
 				}
220 220
 			}
221 221
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-hidden.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	function edit_entry_fix_hidden_fields( $fields ) {
50 50
 
51 51
 		/** @var GF_Field $field */
52
-		foreach( $fields as &$field ) {
52
+		foreach ( $fields as &$field ) {
53 53
 			if ( 'hidden' === $field->type ) {
54 54
 
55 55
 				/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 				 */
61 61
 				$reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', true, $field );
62 62
 
63
-				if( ! $reveal_hidden_field ) {
63
+				if ( ! $reveal_hidden_field ) {
64 64
 					continue;
65 65
 				}
66 66
 
Please login to merge, or discard this patch.
future/_mocks.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -10,6 +10,7 @@  discard block
 block discarded – undo
10 10
  * @internal
11 11
  * @since 2.0
12 12
  *
13
+ * @param \GravityView_View_Data $_this
13 14
  * @return array|false The old array data, or false on error.
14 15
  */
15 16
 function GravityView_View_Data_add_view( $view_id, $atts, $_this ) {
@@ -62,6 +63,8 @@  discard block
 block discarded – undo
62 63
  * @internal
63 64
  * @since 2.0
64 65
  *
66
+ * @param integer $form_id
67
+ * @param integer $count
65 68
  * @return array The old associative array data as returned by
66 69
  *  \GravityView_frontend::get_view_entries(), the paging parameters
67 70
  *  and a total count of all entries.
@@ -155,6 +158,7 @@  discard block
 block discarded – undo
155 158
  * @internal
156 159
  * @since 2.0
157 160
  *
161
+ * @param string $format
158 162
  * @return null|string The value of a field in an entry.
159 163
  */
160 164
 function GravityView_API_field_value( $entry, $field_settings, $format ) {
Please login to merge, or discard this patch.
Spacing   +43 added lines, -46 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@  discard block
 block discarded – undo
101 101
 			$entries = $view->get_entries( gravityview()->request );
102 102
 		}
103 103
 
104
-		$page = \GV\Utils::get( $parameters['paging'], 'current_page' ) ?
105
-			: ( ( ( $parameters['paging']['offset'] - $view->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );
104
+		$page = \GV\Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $view->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
106 105
 
107 106
 		/** Set paging, count and unwrap the entries. */
108 107
 		$paging = array(
@@ -141,16 +140,16 @@  discard block
 block discarded – undo
141 140
  * @return null|string The value of a field in an entry.
142 141
  */
143 142
 function GravityView_API_field_value( $entry, $field_settings, $format ) {
144
-	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
143
+	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
145 144
 		gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
146 145
 		return null;
147 146
 	}
148 147
 
149
-	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) {
150
-		$entry = $entry['_multi'][ $field_settings['form_id'] ];
148
+	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) {
149
+		$entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];
151 150
 	}
152 151
 
153
-	if ( empty( $entry['id'] ) || ! $entry = \GV\GF_Entry::by_id( $entry['id'] ) ) {
152
+	if ( empty( $entry[ 'id' ] ) || ! $entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) {
154 153
 		gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );
155 154
 		return null;
156 155
 	}
@@ -160,18 +159,18 @@  discard block
 block discarded – undo
160 159
 	 *
161 160
 	 * Fields with a numeric ID are Gravity Forms ones.
162 161
 	 */
163
-	$source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;;
162
+	$source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; ;
164 163
 
165 164
 	/** Initialize the future field. */
166 165
 	switch ( $source ):
167 166
 		/** The Gravity Forms backend. */
168 167
 		case \GV\Source::BACKEND_GRAVITYFORMS:
169
-			if ( ! $form = \GV\GF_Form::by_id( $entry['form_id'] ) ) {
168
+			if ( ! $form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) {
170 169
 				gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );
171 170
 				return null;
172 171
 			}
173 172
 
174
-			if ( ! $field = $form::get_field( $form, $field_settings['id'] ) ) {
173
+			if ( ! $field = $form::get_field( $form, $field_settings[ 'id' ] ) ) {
175 174
 				return null;
176 175
 			}
177 176
 
@@ -179,7 +178,7 @@  discard block
 block discarded – undo
179 178
 
180 179
 		/** Our internal backend. */
181 180
 		case \GV\Source::BACKEND_INTERNAL:
182
-			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) {
181
+			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) {
183 182
 				return null;
184 183
 			}
185 184
 
@@ -213,13 +212,13 @@  discard block
 block discarded – undo
213 212
 
214 213
 	/** A bail condition. */
215 214
 	$bail = function( $label, $field_settings, $entry, $force_show_label, $form ) {
216
-		if ( ! empty( $field_settings['show_label'] ) || $force_show_label ) {
215
+		if ( ! empty( $field_settings[ 'show_label' ] ) || $force_show_label ) {
217 216
 
218
-			$label = isset( $field_settings['label'] ) ? $field_settings['label'] : '';
217
+			$label = isset( $field_settings[ 'label' ] ) ? $field_settings[ 'label' ] : '';
219 218
 
220 219
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
221
-			if ( ! empty( $field_settings['custom_label'] ) ) {
222
-				$label = \GravityView_API::replace_variables( $field_settings['custom_label'], $form, $entry );
220
+			if ( ! empty( $field_settings[ 'custom_label' ] ) ) {
221
+				$label = \GravityView_API::replace_variables( $field_settings[ 'custom_label' ], $form, $entry );
223 222
 			}
224 223
 
225 224
 			/**
@@ -245,19 +244,19 @@  discard block
 block discarded – undo
245 244
 
246 245
 	$label = '';
247 246
 
248
-	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) {
249
-		$entry = $entry['_multi'][ $field_settings['form_id'] ];
250
-		if ( $_form = \GV\GF_Form::by_id( $field_settings['form_id'] ) ) {
247
+	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) {
248
+		$entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];
249
+		if ( $_form = \GV\GF_Form::by_id( $field_settings[ 'form_id' ] ) ) {
251 250
 			$form = $_form->form;
252 251
 		}
253 252
 	}
254 253
 
255
-	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
254
+	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
256 255
 		gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
257 256
 		return $bail( $label, $field_settings, $entry, $force_show_label, $form );
258 257
 	}
259 258
 
260
-	if ( empty( $entry['id'] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry['id'] ) ) {
259
+	if ( empty( $entry[ 'id' ] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) {
261 260
 		gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );
262 261
 		return $bail( $label, $field_settings, $entry, $force_show_label, $form );
263 262
 	}
@@ -269,31 +268,31 @@  discard block
 block discarded – undo
269 268
 	 *
270 269
 	 * Fields with a numeric ID are Gravity Forms ones.
271 270
 	 */
272
-	$source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;
271
+	$source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;
273 272
 
274 273
 	/** Initialize the future field. */
275 274
 	switch ( $source ):
276 275
 		/** The Gravity Forms backend. */
277 276
 		case \GV\Source::BACKEND_GRAVITYFORMS:
278
-			if ( ! $gf_form = \GV\GF_Form::by_id( $entry['form_id'] ) ) {
277
+			if ( ! $gf_form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) {
279 278
 				gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );
280 279
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );
281 280
 			}
282 281
 
283
-			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings['id'] ) ) {
284
-				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings['id'], 'data' => $form ) );
282
+			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings[ 'id' ] ) ) {
283
+				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings[ 'id' ], 'data' => $form ) );
285 284
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $gf_form->form );
286 285
 			}
287
-			if ( empty( $field_settings['show_label'] ) ) {
286
+			if ( empty( $field_settings[ 'show_label' ] ) ) {
288 287
 				/** The label never wins... */
289
-				$field_settings['label'] = '';
288
+				$field_settings[ 'label' ] = '';
290 289
 			}
291 290
 
292 291
 			break;
293 292
 
294 293
 		/** Our internal backend. */
295 294
 		case \GV\Source::BACKEND_INTERNAL:
296
-			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) {
295
+			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) {
297 296
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );
298 297
 			}
299 298
 			break;
@@ -305,8 +304,8 @@  discard block
 block discarded – undo
305 304
 			break;
306 305
 	endswitch;
307 306
 
308
-	if( $force_show_label ) {
309
-		$field_settings['show_label'] = '1';
307
+	if ( $force_show_label ) {
308
+		$field_settings[ 'show_label' ] = '1';
310 309
 	}
311 310
 
312 311
 	/** Add the field settings. */
@@ -440,7 +439,7 @@  discard block
 block discarded – undo
440 439
 			'\GravityView_frontend::entry' => \GravityView_frontend::getInstance()->getEntry(),
441 440
 			'\GravityView_View::_current_entry' => \GravityView_View::getInstance()->getCurrentEntry(),
442 441
 			'\GravityView_View::fields' => \GravityView_View::getInstance()->getFields(),
443
-			'wp_actions[loop_start]' => empty( $wp_actions['loop_start'] ) ? 0 : $wp_actions['loop_start'],
442
+			'wp_actions[loop_start]' => empty( $wp_actions[ 'loop_start' ] ) ? 0 : $wp_actions[ 'loop_start' ],
444 443
 			'wp_query::in_the_loop' => $wp_query->in_the_loop,
445 444
 		);
446 445
 	}
@@ -522,7 +521,7 @@  discard block
 block discarded – undo
522 521
 					break;
523 522
 				case 'wp_actions[loop_start]':
524 523
 					global $wp_actions;
525
-					$wp_actions['loop_start'] = $value;
524
+					$wp_actions[ 'loop_start' ] = $value;
526 525
 					break;
527 526
 				case 'wp_query::in_the_loop':
528 527
 					global $wp_query;
@@ -600,9 +599,7 @@  discard block
 block discarded – undo
600 599
 				case 'request':
601 600
 					self::thaw( array(
602 601
 						'\GravityView_View::context' => (
603
-							$value->is_entry() ? 'single' :
604
-								( $value->is_edit_entry() ? 'edit' :
605
-									( $value->is_view() ? 'directory': null )
602
+							$value->is_entry() ? 'single' : ( $value->is_edit_entry() ? 'edit' : ( $value->is_view() ? 'directory' : null )
606 603
 								)
607 604
 						),
608 605
 						'\GravityView_frontend::is_search' => $value->is_search(),
@@ -656,14 +653,14 @@  discard block
 block discarded – undo
656 653
 		global $wp_query, $wp_actions;
657 654
 
658 655
 		$wp_query->in_the_loop = false;
659
-		$wp_actions['loop_start'] = 0;
656
+		$wp_actions[ 'loop_start' ] = 0;
660 657
 	}
661 658
 }
662 659
 
663 660
 
664 661
 /** Add some global fix for field capability discrepancies. */
665 662
 add_filter( 'gravityview/configuration/fields', function( $fields ) {
666
-	if ( empty( $fields  ) ) {
663
+	if ( empty( $fields ) ) {
667 664
 		return $fields;
668 665
 	}
669 666
 
@@ -690,11 +687,11 @@  discard block
 block discarded – undo
690 687
 		}
691 688
 
692 689
 		foreach ( $_fields as $uid => &$_field ) {
693
-			if ( ! isset( $_field['only_loggedin'] ) ) {
690
+			if ( ! isset( $_field[ 'only_loggedin' ] ) ) {
694 691
 				continue;
695 692
 			}
696 693
 			/** If we do not require login, we don't require a cap. */
697
-			$_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' );
694
+			$_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' );
698 695
 		}
699 696
 	}
700 697
 	return $fields;
@@ -725,8 +722,8 @@  discard block
 block discarded – undo
725 722
 		}
726 723
 
727 724
 		foreach ( $_fields as $uid => &$_field ) {
728
-			if ( ! empty( $_field['id'] ) && is_numeric( $_field['id'] ) && empty( $_field['form_id'] ) ) {
729
-				$_field['form_id'] = $view->form->ID;
725
+			if ( ! empty( $_field[ 'id' ] ) && is_numeric( $_field[ 'id' ] ) && empty( $_field[ 'form_id' ] ) ) {
726
+				$_field[ 'form_id' ] = $view->form->ID;
730 727
 			}
731 728
 		}
732 729
 	}
@@ -740,25 +737,25 @@  discard block
 block discarded – undo
740 737
 	if ( class_exists( '\GravityView_frontend' ) ) {
741 738
 		global $wp_filter;
742 739
 
743
-		if ( empty( $wp_filter['gravityview_after'] ) ) {
740
+		if ( empty( $wp_filter[ 'gravityview_after' ] ) ) {
744 741
 			return;
745 742
 		}
746 743
 
747 744
 		/** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */
748
-		if ( is_array( $wp_filter['gravityview_after'] ) ) {
749
-			if ( ! empty( $wp_filter['gravityview_after'][10] ) ) {
750
-				foreach ( $wp_filter['gravityview_after'][10] as $function_key => $callback ) {
745
+		if ( is_array( $wp_filter[ 'gravityview_after' ] ) ) {
746
+			if ( ! empty( $wp_filter[ 'gravityview_after' ][ 10 ] ) ) {
747
+				foreach ( $wp_filter[ 'gravityview_after' ][ 10 ] as $function_key => $callback ) {
751 748
 					if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
752
-						unset( $wp_filter['gravityview_after'][10][ $function_key ] );
749
+						unset( $wp_filter[ 'gravityview_after' ][ 10 ][ $function_key ] );
753 750
 					}
754 751
 				}
755 752
 			}
756 753
 			return;
757 754
 		}
758 755
 
759
-		foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) {
756
+		foreach ( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ] as $function_key => $callback ) {
760 757
 			if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
761
-				unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] );
758
+				unset( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ][ $function_key ] );
762 759
 			}
763 760
 		}
764 761
 	}
Please login to merge, or discard this patch.