Completed
Push — develop ( 12097b...045e9f )
by Zack
20:04
created
includes/extensions/edit-entry/class-edit-entry-render.php 3 patches
Indentation   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 
103 103
 	/**
104 104
 	 * ID of the current post. May also be ID of the current View.
105
-     *
106
-     * @since 2.0.13
107 105
 	 *
108
-     * @var int
106
+	 * @since 2.0.13
107
+	 *
108
+	 * @var int
109 109
 	 */
110 110
 	public $post_id;
111 111
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function prevent_maybe_process_form() {
191 191
 
192
-	    if( ! $this->is_edit_entry_submission() ) {
192
+		if( ! $this->is_edit_entry_submission() ) {
193 193
 			return;
194 194
 		}
195 195
 
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 	 * When Edit entry view is requested setup the vars
229 229
 	 */
230 230
 	private function setup_vars() {
231
-        global $post;
231
+		global $post;
232 232
 
233 233
 		$gravityview_view = GravityView_View::getInstance();
234 234
 
235 235
 
236 236
 		$entries = $gravityview_view->getEntries();
237
-	    self::$original_entry = $entries[0];
238
-	    $this->entry = $entries[0];
237
+		self::$original_entry = $entries[0];
238
+		$this->entry = $entries[0];
239 239
 
240 240
 		self::$original_form = GFAPI::get_form( $this->entry['form_id'] );
241 241
 		$this->form = self::$original_form;
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 
381 381
 			GFFormsModel::save_lead( $form, $this->entry );
382 382
 
383
-	        // Delete the values for hidden inputs
384
-	        $this->unset_hidden_field_values();
383
+			// Delete the values for hidden inputs
384
+			$this->unset_hidden_field_values();
385 385
 
386 386
 			$this->entry['date_created'] = $date_created;
387 387
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			// Perform actions normally performed after updating a lead
395 395
 			$this->after_update();
396 396
 
397
-	        /**
397
+			/**
398 398
 			 * Must be AFTER after_update()!
399 399
 			 * @see https://github.com/gravityview/GravityView/issues/764
400 400
 			 */
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 
403 403
 			/**
404 404
 			 * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry
405
-             * @since 2.1 Added $gv_data parameter
405
+			 * @since 2.1 Added $gv_data parameter
406 406
 			 * @param array $form Gravity Forms form array
407 407
 			 * @param string $entry_id Numeric ID of the entry that was updated
408 408
 			 * @param GravityView_Edit_Entry_Render $this This object
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 * @return void
427 427
 	 */
428 428
 	private function unset_hidden_field_values() {
429
-	    global $wpdb;
429
+		global $wpdb;
430 430
 
431 431
 		/**
432 432
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
451 451
 		}
452 452
 
453
-	    foreach ( $this->entry as $input_id => $field_value ) {
453
+		foreach ( $this->entry as $input_id => $field_value ) {
454 454
 
455 455
 			if ( ! is_numeric( $input_id ) ) {
456 456
 				continue;
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 				continue;
461 461
 			}
462 462
 
463
-		    // Reset fields that are or would be hidden
464
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), $this->entry ) ) {
463
+			// Reset fields that are or would be hidden
464
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), $this->entry ) ) {
465 465
 
466 466
 				$empty_value = $field->get_value_save_entry(
467 467
 					is_array( $field->get_entry_inputs() ) ? array() : '',
@@ -473,16 +473,16 @@  discard block
 block discarded – undo
473 473
 					$empty_value = '';
474 474
 				}
475 475
 
476
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
476
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
477 477
 
478
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
478
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
479 479
 
480
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
480
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
481 481
 				// after submission
482
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
483
-			    $_POST[ $post_input_id ] = '';
484
-		    }
485
-	    }
482
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
483
+				$_POST[ $post_input_id ] = '';
484
+			}
485
+		}
486 486
 	}
487 487
 
488 488
 	/**
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 
638 638
 		$form = $this->filter_conditional_logic( $this->form );
639 639
 
640
-	    /** @type GF_Field $field */
640
+		/** @type GF_Field $field */
641 641
 		foreach( $form['fields'] as $k => &$field ) {
642 642
 
643 643
 			/**
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 
653 653
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
654 654
 				foreach( $field->inputs as $key => $input ) {
655
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
655
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
656 656
 				}
657 657
 			}
658 658
 		}
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 
693 693
 				$inputs = $field->get_entry_inputs();
694 694
 				if ( is_array( $inputs ) ) {
695
-				    foreach ( $inputs as $input ) {
695
+					foreach ( $inputs as $input ) {
696 696
 						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
697 697
 
698 698
 						if ( 'product' === $field->type ) {
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 						}
712 712
 
713 713
 						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
714
-				    }
714
+					}
715 715
 				} else {
716 716
 					// Set to what it previously was if it's not editable
717 717
 					if ( ! in_array( $field->id, $allowed_fields ) ) {
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
758 758
 
759 759
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
760
-	        $ary = stripslashes_deep( $ary );
760
+			$ary = stripslashes_deep( $ary );
761 761
 			$img_url = \GV\Utils::get( $ary, 0 );
762 762
 
763 763
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	private function maybe_update_post_fields( $form ) {
831 831
 
832 832
 		if( empty( $this->entry['post_id'] ) ) {
833
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
833
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
834 834
 			return;
835 835
 		}
836 836
 
@@ -865,49 +865,49 @@  discard block
 block discarded – undo
865 865
 
866 866
 				switch( $field->type ) {
867 867
 
868
-				    case 'post_title':
869
-				        $post_title = $value;
870
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
871
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
872
-				        }
873
-				        $updated_post->post_title = $post_title;
874
-				        $updated_post->post_name  = $post_title;
875
-				        unset( $post_title );
876
-				        break;
877
-
878
-				    case 'post_content':
879
-				        $post_content = $value;
880
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
881
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
882
-				        }
883
-				        $updated_post->post_content = $post_content;
884
-				        unset( $post_content );
885
-				        break;
886
-				    case 'post_excerpt':
887
-				        $updated_post->post_excerpt = $value;
888
-				        break;
889
-				    case 'post_tags':
890
-				        wp_set_post_tags( $post_id, $value, false );
891
-				        break;
892
-				    case 'post_category':
893
-				        break;
894
-				    case 'post_custom_field':
868
+					case 'post_title':
869
+						$post_title = $value;
870
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
871
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
872
+						}
873
+						$updated_post->post_title = $post_title;
874
+						$updated_post->post_name  = $post_title;
875
+						unset( $post_title );
876
+						break;
877
+
878
+					case 'post_content':
879
+						$post_content = $value;
880
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
881
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
882
+						}
883
+						$updated_post->post_content = $post_content;
884
+						unset( $post_content );
885
+						break;
886
+					case 'post_excerpt':
887
+						$updated_post->post_excerpt = $value;
888
+						break;
889
+					case 'post_tags':
890
+						wp_set_post_tags( $post_id, $value, false );
891
+						break;
892
+					case 'post_category':
893
+						break;
894
+					case 'post_custom_field':
895 895
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
896 896
 							$value = $value[ $field_id ];
897 897
 						}
898 898
 
899
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
900
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
901
-				        }
899
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
900
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
901
+						}
902 902
 
903 903
 						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
904 904
 
905
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
906
-				        break;
905
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
906
+						break;
907 907
 
908
-				    case 'post_image':
909
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
910
-				        break;
908
+					case 'post_image':
909
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
910
+						break;
911 911
 
912 912
 				}
913 913
 
@@ -1077,14 +1077,14 @@  discard block
 block discarded – undo
1077 1077
 			?><h2 class="gv-edit-entry-title">
1078 1078
 				<span><?php
1079 1079
 
1080
-				    /**
1081
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
1082
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
1083
-				     * @param GravityView_Edit_Entry_Render $this This object
1084
-				     */
1085
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
1080
+					/**
1081
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
1082
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
1083
+					 * @param GravityView_Edit_Entry_Render $this This object
1084
+					 */
1085
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
1086 1086
 
1087
-				    echo esc_attr( $edit_entry_title );
1087
+					echo esc_attr( $edit_entry_title );
1088 1088
 			?></span>
1089 1089
 			</h2>
1090 1090
 
@@ -1150,13 +1150,13 @@  discard block
 block discarded – undo
1150 1150
 			);
1151 1151
 
1152 1152
 			/**
1153
-			* @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1154
-			* @since 1.16.3
1155
-			* @param array $labels Default button labels associative array
1156
-			* @param array $form The Gravity Forms form
1157
-			* @param array $entry The Gravity Forms entry
1158
-			* @param int $view_id The current View ID
1159
-			*/
1153
+			 * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1154
+			 * @since 1.16.3
1155
+			 * @param array $labels Default button labels associative array
1156
+			 * @param array $form The Gravity Forms form
1157
+			 * @param array $entry The Gravity Forms entry
1158
+			 * @param int $view_id The current View ID
1159
+			 */
1160 1160
 			$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1161 1161
 
1162 1162
 			$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit'];
@@ -1276,13 +1276,13 @@  discard block
 block discarded – undo
1276 1276
 				);
1277 1277
 
1278 1278
 				/**
1279
-				* @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1280
-				* @since 1.16.3
1281
-				* @param array $labels Default button labels associative array
1282
-				* @param array $form The Gravity Forms form
1283
-				* @param array $entry The Gravity Forms entry
1284
-				* @param int $view_id The current View ID
1285
-				*/
1279
+				 * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1280
+				 * @since 1.16.3
1281
+				 * @param array $labels Default button labels associative array
1282
+				 * @param array $form The Gravity Forms form
1283
+				 * @param array $entry The Gravity Forms entry
1284
+				 * @param int $view_id The current View ID
1285
+				 */
1286 1286
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1287 1287
 
1288 1288
 				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
 
1329 1329
 		ob_get_clean();
1330 1330
 
1331
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1331
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1332 1332
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1333 1333
 		remove_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1334 1334
 		remove_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 
1389 1389
 		// for now we don't support Save and Continue feature.
1390 1390
 		if( ! self::$supports_save_and_continue ) {
1391
-	        unset( $form['save'] );
1391
+			unset( $form['save'] );
1392 1392
 		}
1393 1393
 
1394 1394
 		$form = $this->unselect_default_values( $form );
@@ -1415,30 +1415,30 @@  discard block
 block discarded – undo
1415 1415
 			return $field_content;
1416 1416
 		}
1417 1417
 
1418
-        $message = null;
1418
+		$message = null;
1419 1419
 
1420
-        // First, make sure they have the capability to edit the post.
1421
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1420
+		// First, make sure they have the capability to edit the post.
1421
+		if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1422 1422
 
1423
-            /**
1424
-             * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1425
-             * @param string $message The existing "You don't have permission..." text
1426
-             */
1427
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1423
+			/**
1424
+			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1425
+			 * @param string $message The existing "You don't have permission..." text
1426
+			 */
1427
+			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1428 1428
 
1429
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1430
-            /**
1431
-             * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1432
-             * @param string $message The existing "This field is not editable; the post no longer exists." text
1433
-             */
1434
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1435
-        }
1429
+		} elseif( null === get_post( $this->entry['post_id'] ) ) {
1430
+			/**
1431
+			 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1432
+			 * @param string $message The existing "This field is not editable; the post no longer exists." text
1433
+			 */
1434
+			$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1435
+		}
1436 1436
 
1437
-        if( $message ) {
1438
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1439
-        }
1437
+		if( $message ) {
1438
+			$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1439
+		}
1440 1440
 
1441
-        return $field_content;
1441
+		return $field_content;
1442 1442
 	}
1443 1443
 
1444 1444
 	/**
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
 			|| ! empty( $field_content )
1467 1467
 			|| in_array( $field->type, array( 'honeypot' ) )
1468 1468
 		) {
1469
-	        return $field_content;
1469
+			return $field_content;
1470 1470
 		}
1471 1471
 
1472 1472
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1474,24 +1474,24 @@  discard block
 block discarded – undo
1474 1474
 
1475 1475
 		$field_value = $this->get_field_value( $field );
1476 1476
 
1477
-	    // Prevent any PHP warnings, like undefined index
1478
-	    ob_start();
1477
+		// Prevent any PHP warnings, like undefined index
1478
+		ob_start();
1479 1479
 
1480
-	    $return = null;
1480
+		$return = null;
1481 1481
 
1482 1482
 		/** @var GravityView_Field $gv_field */
1483 1483
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1484 1484
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1485 1485
 		} else {
1486
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1487
-	    }
1486
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1487
+		}
1488 1488
 
1489
-	    // If there was output, it's an error
1490
-	    $warnings = ob_get_clean();
1489
+		// If there was output, it's an error
1490
+		$warnings = ob_get_clean();
1491 1491
 
1492
-	    if( !empty( $warnings ) ) {
1493
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1494
-	    }
1492
+		if( !empty( $warnings ) ) {
1493
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1494
+		}
1495 1495
 
1496 1496
 		return $return;
1497 1497
 	}
@@ -1526,8 +1526,8 @@  discard block
 block discarded – undo
1526 1526
 				$input_id = strval( $input['id'] );
1527 1527
 
1528 1528
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1529
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1530
-				    $allow_pre_populated = false;
1529
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1530
+					$allow_pre_populated = false;
1531 1531
 				}
1532 1532
 
1533 1533
 			}
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1552 1552
 				$categories = array();
1553 1553
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1554
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1554
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1555 1555
 				}
1556 1556
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1557 1557
 			}
@@ -1561,25 +1561,25 @@  discard block
 block discarded – undo
1561 1561
 		// if value is empty get the default value if defined
1562 1562
 		$field_value = $field->get_value_default_if_empty( $field_value );
1563 1563
 
1564
-	    /**
1565
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1566
-	     * @since 1.11
1567
-	     * @since 1.20 Added third param
1568
-	     * @param mixed $field_value field value used to populate the input
1569
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1570
-	     * @param GravityView_Edit_Entry_Render $this Current object
1571
-	     */
1572
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1573
-
1574
-	    /**
1575
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1576
-	     * @since 1.17
1577
-	     * @since 1.20 Added third param
1578
-	     * @param mixed $field_value field value used to populate the input
1579
-	     * @param GF_Field $field Gravity Forms field object
1580
-	     * @param GravityView_Edit_Entry_Render $this Current object
1581
-	     */
1582
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1564
+		/**
1565
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1566
+		 * @since 1.11
1567
+		 * @since 1.20 Added third param
1568
+		 * @param mixed $field_value field value used to populate the input
1569
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1570
+		 * @param GravityView_Edit_Entry_Render $this Current object
1571
+		 */
1572
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1573
+
1574
+		/**
1575
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1576
+		 * @since 1.17
1577
+		 * @since 1.20 Added third param
1578
+		 * @param mixed $field_value field value used to populate the input
1579
+		 * @param GF_Field $field Gravity Forms field object
1580
+		 * @param GravityView_Edit_Entry_Render $this Current object
1581
+		 */
1582
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1583 1583
 
1584 1584
 		return $field_value;
1585 1585
 	}
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1607 1607
 			// expects certain field array items to be set.
1608 1608
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1609
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1609
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1610 1610
 			}
1611 1611
 
1612 1612
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1620,31 +1620,31 @@  discard block
 block discarded – undo
1620 1620
 				 */
1621 1621
 				case 'fileupload':
1622 1622
 
1623
-				    // Set the previous value
1624
-				    $entry = $this->get_entry();
1623
+					// Set the previous value
1624
+					$entry = $this->get_entry();
1625 1625
 
1626
-				    $input_name = 'input_'.$field->id;
1627
-				    $form_id = $form['id'];
1626
+					$input_name = 'input_'.$field->id;
1627
+					$form_id = $form['id'];
1628 1628
 
1629
-				    $value = NULL;
1629
+					$value = NULL;
1630 1630
 
1631
-				    // Use the previous entry value as the default.
1632
-				    if( isset( $entry[ $field->id ] ) ) {
1633
-				        $value = $entry[ $field->id ];
1634
-				    }
1631
+					// Use the previous entry value as the default.
1632
+					if( isset( $entry[ $field->id ] ) ) {
1633
+						$value = $entry[ $field->id ];
1634
+					}
1635 1635
 
1636
-				    // If this is a single upload file
1637
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1638
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1639
-				        $value = $file_path['url'];
1636
+					// If this is a single upload file
1637
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1638
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1639
+						$value = $file_path['url'];
1640 1640
 
1641
-				    } else {
1641
+					} else {
1642 1642
 
1643
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1644
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1645
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1643
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1644
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1645
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1646 1646
 
1647
-				    }
1647
+					}
1648 1648
 
1649 1649
 					if ( \GV\Utils::get( $field, 'multipleFiles' ) ) {
1650 1650
 						// If there are fresh uploads, process and merge them.
@@ -1665,17 +1665,17 @@  discard block
 block discarded – undo
1665 1665
 						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1666 1666
 					}
1667 1667
 
1668
-				    $this->entry[ $input_name ] = $value;
1669
-				    $_POST[ $input_name ] = $value;
1668
+					$this->entry[ $input_name ] = $value;
1669
+					$_POST[ $input_name ] = $value;
1670 1670
 
1671
-				    break;
1671
+					break;
1672 1672
 
1673 1673
 				case 'number':
1674
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1675
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1676
-				        $_POST['input_'.$field->id ] = NULL;
1677
-				    }
1678
-				    break;
1674
+					// Fix "undefined index" issue at line 1286 in form_display.php
1675
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1676
+						$_POST['input_'.$field->id ] = NULL;
1677
+					}
1678
+					break;
1679 1679
 			}
1680 1680
 
1681 1681
 		}
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
 
1797 1797
 						// count uploaded files and existent entry files
1798 1798
 						$count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1799
-						               ( is_array( $value ) ? count( $value ) : 0 );
1799
+									   ( is_array( $value ) ? count( $value ) : 0 );
1800 1800
 
1801 1801
 						if ( $count_files > $field->maxFiles ) {
1802 1802
 							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
@@ -1818,47 +1818,47 @@  discard block
 block discarded – undo
1818 1818
 
1819 1819
 				switch ( $field_type ) {
1820 1820
 
1821
-				    // Captchas don't need to be re-entered.
1822
-				    case 'captcha':
1821
+					// Captchas don't need to be re-entered.
1822
+					case 'captcha':
1823 1823
 
1824
-				        // Post Image fields aren't editable, so we un-fail them.
1825
-				    case 'post_image':
1826
-				        $field->failed_validation = false;
1827
-				        unset( $field->validation_message );
1828
-				        break;
1824
+						// Post Image fields aren't editable, so we un-fail them.
1825
+					case 'post_image':
1826
+						$field->failed_validation = false;
1827
+						unset( $field->validation_message );
1828
+						break;
1829 1829
 
1830 1830
 				}
1831 1831
 
1832 1832
 				// You can't continue inside a switch, so we do it after.
1833 1833
 				if( empty( $field->failed_validation ) ) {
1834
-				    continue;
1834
+					continue;
1835 1835
 				}
1836 1836
 
1837 1837
 				// checks if the No Duplicates option is not validating entry against itself, since
1838 1838
 				// we're editing a stored entry, it would also assume it's a duplicate.
1839 1839
 				if( !empty( $field->noDuplicates ) ) {
1840 1840
 
1841
-				    $entry = $this->get_entry();
1841
+					$entry = $this->get_entry();
1842 1842
 
1843
-				    // If the value of the entry is the same as the stored value
1844
-				    // Then we can assume it's not a duplicate, it's the same.
1845
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1846
-				        //if value submitted was not changed, then don't validate
1847
-				        $field->failed_validation = false;
1843
+					// If the value of the entry is the same as the stored value
1844
+					// Then we can assume it's not a duplicate, it's the same.
1845
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1846
+						//if value submitted was not changed, then don't validate
1847
+						$field->failed_validation = false;
1848 1848
 
1849
-				        unset( $field->validation_message );
1849
+						unset( $field->validation_message );
1850 1850
 
1851
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1851
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1852 1852
 
1853
-				        continue;
1854
-				    }
1853
+						continue;
1854
+					}
1855 1855
 				}
1856 1856
 
1857 1857
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1858 1858
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1859
-				    unset( $field->validation_message );
1859
+					unset( $field->validation_message );
1860 1860
 					$field->failed_validation = false;
1861
-				    continue;
1861
+					continue;
1862 1862
 				}
1863 1863
 
1864 1864
 				$gv_valid = false;
@@ -1922,8 +1922,8 @@  discard block
 block discarded – undo
1922 1922
 		// Hide fields depending on admin settings
1923 1923
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1924 1924
 
1925
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1926
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1925
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1926
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1927 1927
 
1928 1928
 		/**
1929 1929
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -2014,11 +2014,11 @@  discard block
 block discarded – undo
2014 2014
 		// The edit tab has been configured, so we loop through to configured settings
2015 2015
 		foreach ( $configured_fields as $configured_field ) {
2016 2016
 
2017
-	        /** @var GF_Field $field */
2018
-	        foreach ( $fields as $field ) {
2017
+			/** @var GF_Field $field */
2018
+			foreach ( $fields as $field ) {
2019 2019
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2020
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2021
-				    break;
2020
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2021
+					break;
2022 2022
 				}
2023 2023
 
2024 2024
 			}
@@ -2074,28 +2074,28 @@  discard block
 block discarded – undo
2074 2074
 	 */
2075 2075
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
2076 2076
 
2077
-	    /**
2077
+		/**
2078 2078
 		 * @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
2079
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
2080
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
2081
-	     * @since 1.9.1
2082
-	     * @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.
2083
-	     * @param array $form GF Form array
2084
-	     * @param int $view_id View ID
2085
-	     */
2086
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2087
-
2088
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2079
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
2080
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
2081
+		 * @since 1.9.1
2082
+		 * @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.
2083
+		 * @param array $form GF Form array
2084
+		 * @param int $view_id View ID
2085
+		 */
2086
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2087
+
2088
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2089 2089
 			foreach( $fields as $k => $field ) {
2090 2090
 				if( $field->adminOnly ) {
2091
-				    unset( $fields[ $k ] );
2091
+					unset( $fields[ $k ] );
2092 2092
 				}
2093 2093
 			}
2094 2094
 			return array_values( $fields );
2095 2095
 		}
2096 2096
 
2097
-	    foreach( $fields as &$field ) {
2098
-		    $field->adminOnly = false;
2097
+		foreach( $fields as &$field ) {
2098
+			$field->adminOnly = false;
2099 2099
 		}
2100 2100
 
2101 2101
 		return $fields;
@@ -2115,13 +2115,13 @@  discard block
 block discarded – undo
2115 2115
 	 */
2116 2116
 	private function unselect_default_values( $form ) {
2117 2117
 
2118
-	    foreach ( $form['fields'] as &$field ) {
2118
+		foreach ( $form['fields'] as &$field ) {
2119 2119
 
2120 2120
 			if ( empty( $field->choices ) ) {
2121
-                continue;
2121
+				continue;
2122 2122
 			}
2123 2123
 
2124
-            foreach ( $field->choices as &$choice ) {
2124
+			foreach ( $field->choices as &$choice ) {
2125 2125
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2126 2126
 					$choice['isSelected'] = false;
2127 2127
 				}
@@ -2158,36 +2158,36 @@  discard block
 block discarded – undo
2158 2158
 
2159 2159
 			if( 'checkbox' === $field->type ) {
2160 2160
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2161
-				    $input_id = $input['id'];
2162
-				    $choice = $field->choices[ $key ];
2163
-				    $value = \GV\Utils::get( $this->entry, $input_id );
2164
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2165
-				    if( $match ) {
2166
-				        $field->choices[ $key ]['isSelected'] = true;
2167
-				    }
2161
+					$input_id = $input['id'];
2162
+					$choice = $field->choices[ $key ];
2163
+					$value = \GV\Utils::get( $this->entry, $input_id );
2164
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
2165
+					if( $match ) {
2166
+						$field->choices[ $key ]['isSelected'] = true;
2167
+					}
2168 2168
 				}
2169 2169
 			} else {
2170 2170
 
2171 2171
 				// We need to run through each field to set the default values
2172 2172
 				foreach ( $this->entry as $field_id => $field_value ) {
2173 2173
 
2174
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2174
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
2175 2175
 
2176
-				        if( 'list' === $field->type ) {
2177
-				            $list_rows = maybe_unserialize( $field_value );
2176
+						if( 'list' === $field->type ) {
2177
+							$list_rows = maybe_unserialize( $field_value );
2178 2178
 
2179
-				            $list_field_value = array();
2180
-				            foreach ( (array) $list_rows as $row ) {
2181
-				                foreach ( (array) $row as $column ) {
2182
-				                    $list_field_value[] = $column;
2183
-				                }
2184
-				            }
2179
+							$list_field_value = array();
2180
+							foreach ( (array) $list_rows as $row ) {
2181
+								foreach ( (array) $row as $column ) {
2182
+									$list_field_value[] = $column;
2183
+								}
2184
+							}
2185 2185
 
2186
-				            $field->defaultValue = serialize( $list_field_value );
2187
-				        } else {
2188
-				            $field->defaultValue = $field_value;
2189
-				        }
2190
-				    }
2186
+							$field->defaultValue = serialize( $list_field_value );
2187
+						} else {
2188
+							$field->defaultValue = $field_value;
2189
+						}
2190
+					}
2191 2191
 				}
2192 2192
 			}
2193 2193
 		}
@@ -2248,7 +2248,7 @@  discard block
 block discarded – undo
2248 2248
 			foreach ( $form['fields'] as &$field ) {
2249 2249
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2250 2250
 
2251
-				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2251
+					list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2252 2252
 
2253 2253
 					if ( $field['id'] == $rule_field_id ) {
2254 2254
 						unset( $field->conditionalLogic['rules'][ $rule_i ] );
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
 			return $has_conditional_logic;
2300 2300
 		}
2301 2301
 
2302
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2302
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2303 2303
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
2304 2304
 	}
2305 2305
 
@@ -2366,14 +2366,14 @@  discard block
 block discarded – undo
2366 2366
 
2367 2367
 		if( $echo && $error !== true ) {
2368 2368
 
2369
-	        $error = esc_html( $error );
2369
+			$error = esc_html( $error );
2370 2370
 
2371
-	        /**
2372
-	         * @since 1.9
2373
-	         */
2374
-	        if ( ! empty( $this->entry ) ) {
2375
-		        $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;" ) );
2376
-	        }
2371
+			/**
2372
+			 * @since 1.9
2373
+			 */
2374
+			if ( ! empty( $this->entry ) ) {
2375
+				$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;" ) );
2376
+			}
2377 2377
 
2378 2378
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2379 2379
 		}
Please login to merge, or discard this patch.
Spacing   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	function load() {
136 136
 
137 137
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
138
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
138
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
139 139
 
140 140
 		// Don't display an embedded form when editing an entry
141 141
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		add_action( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
146 146
 		add_action( 'admin_init', array( $this, 'prevent_maybe_process_form' ), 8 );
147 147
 
148
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
148
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
149 149
 
150 150
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ), 10, 4 );
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
157 157
 
158 158
 		// Add fields expected by GFFormDisplay::validate()
159
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
159
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
160 160
 
161 161
 		// Fix multiselect value for GF 2.2
162 162
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @return void
174 174
 	 */
175 175
 	public function prevent_render_form() {
176
-		if( $this->is_edit_entry() ) {
177
-			if( 'wp_head' === current_filter() ) {
176
+		if ( $this->is_edit_entry() ) {
177
+			if ( 'wp_head' === current_filter() ) {
178 178
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
179 179
 			} else {
180 180
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -189,17 +189,17 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function prevent_maybe_process_form() {
191 191
 
192
-	    if( ! $this->is_edit_entry_submission() ) {
192
+	    if ( ! $this->is_edit_entry_submission() ) {
193 193
 			return;
194 194
 		}
195 195
 
196 196
 		gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] Removing GFForms::maybe_process_form() action.' );
197 197
 
198
-		remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
199
-		remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
198
+		remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
199
+		remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
200 200
 
201
-		remove_action( 'admin_init',  array( 'GFForms', 'maybe_process_form'), 9 );
202
-		remove_action( 'admin_init',  array( 'RGForms', 'maybe_process_form'), 9 );
201
+		remove_action( 'admin_init', array( 'GFForms', 'maybe_process_form' ), 9 );
202
+		remove_action( 'admin_init', array( 'RGForms', 'maybe_process_form' ), 9 );
203 203
 	}
204 204
 
205 205
 	/**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$is_edit_entry =
212 212
 			( GravityView_frontend::is_single_entry() || gravityview()->request->is_entry() )
213
-			&& ( ! empty( $_GET['edit'] ) );
213
+			&& ( ! empty( $_GET[ 'edit' ] ) );
214 214
 
215 215
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
216 216
 	}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @return boolean
222 222
 	 */
223 223
 	public function is_edit_entry_submission() {
224
-		return !empty( $_POST[ self::$nonce_field ] );
224
+		return ! empty( $_POST[ self::$nonce_field ] );
225 225
 	}
226 226
 
227 227
 	/**
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 
235 235
 
236 236
 		$entries = $gravityview_view->getEntries();
237
-	    self::$original_entry = $entries[0];
238
-	    $this->entry = $entries[0];
237
+	    self::$original_entry = $entries[ 0 ];
238
+	    $this->entry = $entries[ 0 ];
239 239
 
240
-		self::$original_form = GFAPI::get_form( $this->entry['form_id'] );
240
+		self::$original_form = GFAPI::get_form( $this->entry[ 'form_id' ] );
241 241
 		$this->form = self::$original_form;
242
-		$this->form_id = $this->entry['form_id'];
242
+		$this->form_id = $this->entry[ 'form_id' ];
243 243
 		$this->view_id = $gravityview_view->getViewId();
244 244
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
245 245
 
246
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
246
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
247 247
 	}
248 248
 
249 249
 
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 	private function print_scripts() {
303 303
 		$gravityview_view = GravityView_View::getInstance();
304 304
 
305
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
305
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
306 306
 
307
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
307
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
308 308
 
309 309
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
310 310
 
@@ -323,19 +323,19 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	private function process_save( $gv_data ) {
325 325
 
326
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
326
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
327 327
 			return;
328 328
 		}
329 329
 
330 330
 		// Make sure the entry, view, and form IDs are all correct
331 331
 		$valid = $this->verify_nonce();
332 332
 
333
-		if ( !$valid ) {
333
+		if ( ! $valid ) {
334 334
 			gravityview()->log->error( 'Nonce validation failed.' );
335 335
 			return;
336 336
 		}
337 337
 
338
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
338
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
339 339
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
340 340
 			return;
341 341
 		}
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
 		$this->validate();
348 348
 
349
-		if( $this->is_valid ) {
349
+		if ( $this->is_valid ) {
350 350
 
351 351
 			gravityview()->log->debug( 'Submission is valid.' );
352 352
 
@@ -358,15 +358,15 @@  discard block
 block discarded – undo
358 358
 			/**
359 359
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
360 360
 			 */
361
-			unset( $_GET['page'] );
361
+			unset( $_GET[ 'page' ] );
362 362
 
363
-			$date_created = $this->entry['date_created'];
363
+			$date_created = $this->entry[ 'date_created' ];
364 364
 
365 365
 			/**
366 366
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
367 367
 			 * @since 1.17.2
368 368
 			 */
369
-			unset( $this->entry['date_created'] );
369
+			unset( $this->entry[ 'date_created' ] );
370 370
 
371 371
 			/**
372 372
 			 * @action `gravityview/edit_entry/before_update` Perform an action before the entry has been updated using Edit Entry
@@ -376,14 +376,14 @@  discard block
 block discarded – undo
376 376
 			 * @param GravityView_Edit_Entry_Render $this This object
377 377
 			 * @param GravityView_View_Data $gv_data The View data
378 378
 			 */
379
-			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry['id'], $this, $gv_data );
379
+			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry[ 'id' ], $this, $gv_data );
380 380
 
381 381
 			GFFormsModel::save_lead( $form, $this->entry );
382 382
 
383 383
 	        // Delete the values for hidden inputs
384 384
 	        $this->unset_hidden_field_values();
385 385
 
386
-			$this->entry['date_created'] = $date_created;
386
+			$this->entry[ 'date_created' ] = $date_created;
387 387
 
388 388
 			// Process calculation fields
389 389
 			$this->update_calculation_fields();
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 			 * @param GravityView_Edit_Entry_Render $this This object
409 409
 			 * @param GravityView_View_Data $gv_data The View data
410 410
 			 */
411
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
411
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
412 412
 
413 413
 		} else {
414 414
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -444,10 +444,10 @@  discard block
 block discarded – undo
444 444
 
445 445
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
446 446
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
447
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
447
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
448 448
 		} else {
449 449
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
450
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
450
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
451 451
 		}
452 452
 
453 453
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 
466 466
 				$empty_value = $field->get_value_save_entry(
467 467
 					is_array( $field->get_entry_inputs() ) ? array() : '',
468
-					$this->form, '', $this->entry['id'], $this->entry
468
+					$this->form, '', $this->entry[ 'id' ], $this->entry
469 469
 				);
470 470
 
471 471
 				if ( $field->has_calculation() ) {
472
-					$this->unset_hidden_calculations[] = $field->id; // Unset
472
+					$this->unset_hidden_calculations[ ] = $field->id; // Unset
473 473
 					$empty_value = '';
474 474
 				}
475 475
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	private function preset_approval_fields() {
499 499
 		$has_approved_field = false;
500 500
 
501
-		foreach ( self::$original_form['fields'] as $field ) {
501
+		foreach ( self::$original_form[ 'fields' ] as $field ) {
502 502
 			if ( $field->gravityview_approved ) {
503 503
 				$has_approved_field = true;
504 504
 				break;
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 
512 512
 		$is_field_hidden = true;
513 513
 
514
-		foreach ( $this->form['fields'] as $field ) {
514
+		foreach ( $this->form[ 'fields' ] as $field ) {
515 515
 			if ( $field->gravityview_approved ) {
516 516
 				$is_field_hidden = false;
517 517
 				break;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 
537 537
 		remove_filter( 'gravityview/approve_entries/update_unapproved_meta', array( $this, 'prevent_update_unapproved_meta' ), 9 );
538 538
 
539
-		if ( ! $value = gform_get_meta( $entry['id'], 'is_approved' ) ) {
539
+		if ( ! $value = gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
540 540
 
541 541
 			$value = GravityView_Entry_Approval_Status::UNAPPROVED;
542 542
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		}
602 602
 
603 603
 		/** No file is being uploaded. */
604
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
604
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
605 605
 			/** So return the original upload, with $value as backup (it can be empty during edit form rendering) */
606 606
 			return rgar( $entry, $input_id, $value );
607 607
 		}
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
 	 * @return mixed
620 620
 	 */
621 621
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
622
-		if( ! $this->is_edit_entry() ) {
622
+		if ( ! $this->is_edit_entry() ) {
623 623
 			return $plupload_init;
624 624
 		}
625 625
 
626
-		$plupload_init['gf_vars']['max_files'] = 0;
626
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
627 627
 
628 628
 		return $plupload_init;
629 629
 	}
@@ -638,26 +638,26 @@  discard block
 block discarded – undo
638 638
 		$form = $this->filter_conditional_logic( $this->form );
639 639
 
640 640
 	    /** @type GF_Field $field */
641
-		foreach( $form['fields'] as $k => &$field ) {
641
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
642 642
 
643 643
 			/**
644 644
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
645 645
 			 * @since 1.16.3
646 646
 			 */
647
-			if( $field->has_calculation() ) {
648
-				unset( $form['fields'][ $k ] );
647
+			if ( $field->has_calculation() ) {
648
+				unset( $form[ 'fields' ][ $k ] );
649 649
 			}
650 650
 
651 651
 			$field->adminOnly = false;
652 652
 
653
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
654
-				foreach( $field->inputs as $key => $input ) {
655
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
653
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
654
+				foreach ( $field->inputs as $key => $input ) {
655
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
656 656
 				}
657 657
 			}
658 658
 		}
659 659
 
660
-		$form['fields'] = array_values( $form['fields'] );
660
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
661 661
 
662 662
 		return $form;
663 663
 	}
@@ -669,14 +669,14 @@  discard block
 block discarded – undo
669 669
 		$update = false;
670 670
 
671 671
 		// get the most up to date entry values
672
-		$entry = GFAPI::get_entry( $this->entry['id'] );
672
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
673 673
 
674 674
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
675 675
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
676
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) );
676
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) );
677 677
 		} else {
678 678
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
679
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) );
679
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) );
680 680
 		}
681 681
 
682 682
 
@@ -693,24 +693,24 @@  discard block
 block discarded – undo
693 693
 				$inputs = $field->get_entry_inputs();
694 694
 				if ( is_array( $inputs ) ) {
695 695
 				    foreach ( $inputs as $input ) {
696
-						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
696
+						list( $field_id, $input_id ) = rgexplode( '.', $input[ 'id' ], 2 );
697 697
 
698 698
 						if ( 'product' === $field->type ) {
699
-							$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
699
+							$input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
700 700
 
701 701
 							// Only allow quantity to be set if it's allowed to be edited
702 702
 							if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) {
703 703
 							} else { // otherwise set to what it previously was
704
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
704
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
705 705
 							}
706 706
 						} else {
707 707
 							// Set to what it previously was if it's not editable
708 708
 							if ( ! in_array( $field_id, $allowed_fields ) ) {
709
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
709
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
710 710
 							}
711 711
 						}
712 712
 
713
-						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
713
+						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] );
714 714
 				    }
715 715
 				} else {
716 716
 					// Set to what it previously was if it's not editable
@@ -750,19 +750,19 @@  discard block
 block discarded – undo
750 750
 
751 751
 		$input_name = 'input_' . $field_id;
752 752
 
753
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
753
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
754 754
 
755 755
 			// We have a new image
756 756
 
757
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
757
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
758 758
 
759 759
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
760 760
 	        $ary = stripslashes_deep( $ary );
761 761
 			$img_url = \GV\Utils::get( $ary, 0 );
762 762
 
763
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
764
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
765
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
763
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
764
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
765
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
766 766
 
767 767
 			$image_meta = array(
768 768
 				'post_excerpt' => $img_caption,
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 
772 772
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
773 773
 			if ( ! empty( $img_title ) ) {
774
-				$image_meta['post_title'] = $img_title;
774
+				$image_meta[ 'post_title' ] = $img_title;
775 775
 			}
776 776
 
777 777
 			/**
@@ -829,15 +829,15 @@  discard block
 block discarded – undo
829 829
 	 */
830 830
 	private function maybe_update_post_fields( $form ) {
831 831
 
832
-		if( empty( $this->entry['post_id'] ) ) {
832
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
833 833
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
834 834
 			return;
835 835
 		}
836 836
 
837
-		$post_id = $this->entry['post_id'];
837
+		$post_id = $this->entry[ 'post_id' ];
838 838
 
839 839
 		// Security check
840
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
840
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
841 841
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
842 842
 			return;
843 843
 		}
@@ -850,25 +850,25 @@  discard block
 block discarded – undo
850 850
 
851 851
 			$field = RGFormsModel::get_field( $form, $field_id );
852 852
 
853
-			if( ! $field ) {
853
+			if ( ! $field ) {
854 854
 				continue;
855 855
 			}
856 856
 
857
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
857
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
858 858
 
859 859
 				// Get the value of the field, including $_POSTed value
860 860
 				$value = RGFormsModel::get_field_value( $field );
861 861
 
862 862
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
863 863
 				$entry_tmp = $this->entry;
864
-				$entry_tmp["{$field_id}"] = $value;
864
+				$entry_tmp[ "{$field_id}" ] = $value;
865 865
 
866
-				switch( $field->type ) {
866
+				switch ( $field->type ) {
867 867
 
868 868
 				    case 'post_title':
869 869
 				        $post_title = $value;
870 870
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
871
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
871
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
872 872
 				        }
873 873
 				        $updated_post->post_title = $post_title;
874 874
 				        $updated_post->post_name  = $post_title;
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 				    case 'post_content':
879 879
 				        $post_content = $value;
880 880
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
881
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
881
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
882 882
 				        }
883 883
 				        $updated_post->post_content = $post_content;
884 884
 				        unset( $post_content );
@@ -896,11 +896,11 @@  discard block
 block discarded – undo
896 896
 							$value = $value[ $field_id ];
897 897
 						}
898 898
 
899
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
899
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
900 900
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
901 901
 				        }
902 902
 
903
-						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
903
+						$value = $field->get_value_save_entry( $value, $form, '', $this->entry[ 'id' ], $this->entry );
904 904
 
905 905
 				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
906 906
 				        break;
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 				}
913 913
 
914 914
 				// update entry after
915
-				$this->entry["{$field_id}"] = $value;
915
+				$this->entry[ "{$field_id}" ] = $value;
916 916
 
917 917
 				$update_entry = true;
918 918
 
@@ -921,11 +921,11 @@  discard block
 block discarded – undo
921 921
 
922 922
 		}
923 923
 
924
-		if( $update_entry ) {
924
+		if ( $update_entry ) {
925 925
 
926 926
 			$return_entry = GFAPI::update_entry( $this->entry );
927 927
 
928
-			if( is_wp_error( $return_entry ) ) {
928
+			if ( is_wp_error( $return_entry ) ) {
929 929
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
930 930
 			} else {
931 931
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 
936 936
 		$return_post = wp_update_post( $updated_post, true );
937 937
 
938
-		if( is_wp_error( $return_post ) ) {
938
+		if ( is_wp_error( $return_post ) ) {
939 939
 			$return_post->add_data( $updated_post, '$updated_post' );
940 940
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
941 941
 		} else {
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
970 970
 
971 971
 		// replace conditional shortcodes
972
-		if( $do_shortcode ) {
972
+		if ( $do_shortcode ) {
973 973
 			$output = do_shortcode( $output );
974 974
 		}
975 975
 
@@ -988,19 +988,19 @@  discard block
 block discarded – undo
988 988
 	 */
989 989
 	private function after_update() {
990 990
 
991
-		do_action( 'gform_after_update_entry', self::$original_form, $this->entry['id'], self::$original_entry );
992
-		do_action( "gform_after_update_entry_{$this->form['id']}", self::$original_form, $this->entry['id'], self::$original_entry );
991
+		do_action( 'gform_after_update_entry', self::$original_form, $this->entry[ 'id' ], self::$original_entry );
992
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", self::$original_form, $this->entry[ 'id' ], self::$original_entry );
993 993
 
994 994
 		// Re-define the entry now that we've updated it.
995
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
995
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
996 996
 
997 997
 		$entry = GFFormsModel::set_entry_meta( $entry, self::$original_form );
998 998
 
999 999
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
1000 1000
 			// We need to clear the cache because Gravity Forms caches the field values, which
1001 1001
 			// we have just updated.
1002
-			foreach ($this->form['fields'] as $key => $field) {
1003
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
1002
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
1003
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
1004 1004
 			}
1005 1005
 		}
1006 1006
 
@@ -1010,11 +1010,11 @@  discard block
 block discarded – undo
1010 1010
 		 * @since develop
1011 1011
 		 */
1012 1012
 		if ( $allowed_feeds = $this->view->settings->get( 'edit_feeds', array() ) ) {
1013
-			$feeds = GFAPI::get_feeds( null, $entry['form_id'] );
1013
+			$feeds = GFAPI::get_feeds( null, $entry[ 'form_id' ] );
1014 1014
 			if ( ! is_wp_error( $feeds ) ) {
1015 1015
 				$registered_feeds = array();
1016 1016
 				foreach ( GFAddOn::get_registered_addons() as $registered_feed ) {
1017
-					if ( is_subclass_of( $registered_feed,  'GFFeedAddOn' ) ) {
1017
+					if ( is_subclass_of( $registered_feed, 'GFFeedAddOn' ) ) {
1018 1018
 						if ( method_exists( $registered_feed, 'get_instance' ) ) {
1019 1019
 							$registered_feed = call_user_func( array( $registered_feed, 'get_instance' ) );
1020 1020
 							$registered_feeds[ $registered_feed->get_slug() ] = $registered_feed;
@@ -1022,8 +1022,8 @@  discard block
 block discarded – undo
1022 1022
 					}
1023 1023
 				}
1024 1024
 				foreach ( $feeds as $feed ) {
1025
-					if ( in_array( $feed['id'], $allowed_feeds ) ) {
1026
-						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed['addon_slug'] ) ) {
1025
+					if ( in_array( $feed[ 'id' ], $allowed_feeds ) ) {
1026
+						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed[ 'addon_slug' ] ) ) {
1027 1027
 							$returned_entry = $feed_object->process_feed( $feed, $entry, self::$original_form );
1028 1028
 							if ( is_array( $returned_entry ) && rgar( $returned_entry, 'id' ) ) {
1029 1029
 								$entry = $returned_entry;
@@ -1051,9 +1051,9 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
 		$view = \GV\View::by_id( $this->view_id );
1053 1053
 
1054
-		if( $view->settings->get( 'edit_locking' ) ) {
1054
+		if ( $view->settings->get( 'edit_locking' ) ) {
1055 1055
 			$locking = new GravityView_Edit_Entry_Locking();
1056
-			$locking->maybe_lock_object( $this->entry['id'] );
1056
+			$locking->maybe_lock_object( $this->entry[ 'id' ] );
1057 1057
 		}
1058 1058
 
1059 1059
 		?>
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 
1067 1067
 		<div class="gv-edit-entry-wrapper"><?php
1068 1068
 
1069
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
1069
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
1070 1070
 
1071 1071
 			/**
1072 1072
 			 * Fixes weird wpautop() issue
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
1083 1083
 				     * @param GravityView_Edit_Entry_Render $this This object
1084 1084
 				     */
1085
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
1085
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
1086 1086
 
1087 1087
 				    echo esc_attr( $edit_entry_title );
1088 1088
 			?></span>
@@ -1159,18 +1159,18 @@  discard block
 block discarded – undo
1159 1159
 			*/
1160 1160
 			$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1161 1161
 
1162
-			$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit'];
1162
+			$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels[ 'submit' ];
1163 1163
 		}
1164 1164
 
1165 1165
 		$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
1166 1166
 
1167
-		if( ! $this->is_valid ){
1167
+		if ( ! $this->is_valid ) {
1168 1168
 
1169 1169
 			// Keeping this compatible with Gravity Forms.
1170
-			$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
1171
-			$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
1170
+			$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
1171
+			$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
1172 1172
 
1173
-			echo GVCommon::generate_notice( $message , 'gv-error' );
1173
+			echo GVCommon::generate_notice( $message, 'gv-error' );
1174 1174
 
1175 1175
 		} elseif ( false === $this->is_paged_submitted ) {
1176 1176
 			// Paged form that hasn't been submitted on the last page yet
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 			 * @param int $view_id View ID
1184 1184
 			 * @param array $entry Gravity Forms entry array
1185 1185
 			 */
1186
-			$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message , $this->view_id, $this->entry );
1186
+			$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message, $this->view_id, $this->entry );
1187 1187
 
1188 1188
 			echo GVCommon::generate_notice( $message );
1189 1189
 		} else {
@@ -1195,23 +1195,23 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
 				case '0':
1197 1197
 					$redirect_url = $back_link;
1198
-					$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1198
+					$entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' );
1199 1199
 					break;
1200 1200
 
1201 1201
 				case '1':
1202 1202
 					$redirect_url = $directory_link = GravityView_API::directory_link();
1203
-					$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1203
+					$entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1204 1204
 					break;
1205 1205
 
1206 1206
 				case '2':
1207 1207
 					$redirect_url = $edit_redirect_url;
1208 1208
 					$redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1209
-					$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1209
+					$entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1210 1210
 					break;
1211 1211
 
1212 1212
 				case '':
1213 1213
 				default:
1214
-					$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1214
+					$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' );
1215 1215
 					break;
1216 1216
 			}
1217 1217
 
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			 * @param array $entry Gravity Forms entry array
1228 1228
 			 * @param string $back_link URL to return to the original entry. @since 1.6
1229 1229
 			 */
1230
-			$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
1230
+			$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
1231 1231
 
1232 1232
 			echo GVCommon::generate_notice( $message );
1233 1233
 		}
@@ -1249,8 +1249,8 @@  discard block
 block discarded – undo
1249 1249
 		 */
1250 1250
 		do_action( 'gravityview/edit-entry/render/before', $this );
1251 1251
 
1252
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1253
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1252
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1253
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1254 1254
 		add_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1255 1255
 		add_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
1256 1256
 		add_filter( 'gform_disable_view_counter', '__return_true' );
@@ -1259,14 +1259,14 @@  discard block
 block discarded – undo
1259 1259
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1260 1260
 
1261 1261
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1262
-		unset( $_GET['page'] );
1262
+		unset( $_GET[ 'page' ] );
1263 1263
 
1264 1264
 		$this->show_next_button = false;
1265 1265
 		$this->show_previous_button = false;
1266 1266
 
1267 1267
 		// TODO: Verify multiple-page forms
1268 1268
 		if ( GFCommon::has_pages( $this->form ) && apply_filters( 'gravityview/features/paged-edit', false ) ) {
1269
-			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form['id'], 0 ) ) ) {
1269
+			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form[ 'id' ], 0 ) ) ) {
1270 1270
 
1271 1271
 				$labels = array(
1272 1272
 					'cancel'   => __( 'Cancel', 'gravityview' ),
@@ -1285,20 +1285,20 @@  discard block
 block discarded – undo
1285 1285
 				*/
1286 1286
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1287 1287
 
1288
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
1289
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'is_valid' ] = true;
1288
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'form' ] = $this->form;
1289
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'is_valid' ] = true;
1290 1290
 
1291
-				if ( \GV\Utils::_POST( 'save' ) === $labels['next'] ) {
1291
+				if ( \GV\Utils::_POST( 'save' ) === $labels[ 'next' ] ) {
1292 1292
 					$last_page = \GFFormDisplay::get_max_page_number( $this->form );
1293 1293
 
1294 1294
 					while ( ++$page_number < $last_page && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1295 1295
 					} // Advance to next visible page
1296
-				} elseif ( \GV\Utils::_POST( 'save' ) === $labels['previous'] ) {
1296
+				} elseif ( \GV\Utils::_POST( 'save' ) === $labels[ 'previous' ] ) {
1297 1297
 					while ( --$page_number > 1 && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1298 1298
 					} // Advance to next visible page
1299 1299
 				}
1300 1300
 
1301
-				GFFormDisplay::$submission[ $this->form['id'] ]['page_number'] = $page_number;
1301
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'page_number' ] = $page_number;
1302 1302
 			}
1303 1303
 
1304 1304
 			if ( ( $page_number = intval( $page_number ) ) < 2 ) {
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
 
1325 1325
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1326 1326
 
1327
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1327
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1328 1328
 
1329 1329
 		ob_get_clean();
1330 1330
 
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 	 * @return string
1353 1353
 	 */
1354 1354
 	public function render_form_buttons() {
1355
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1355
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1356 1356
 	}
1357 1357
 
1358 1358
 
@@ -1371,15 +1371,15 @@  discard block
 block discarded – undo
1371 1371
 	 */
1372 1372
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1373 1373
 
1374
-		if( $form['id'] != $this->form_id ) {
1374
+		if ( $form[ 'id' ] != $this->form_id ) {
1375 1375
 			return $form;
1376 1376
 		}
1377 1377
 
1378 1378
 		// In case we have validated the form, use it to inject the validation results into the form render
1379
-		if( isset( $this->form_after_validation ) && $this->form_after_validation['id'] === $form['id'] ) {
1379
+		if ( isset( $this->form_after_validation ) && $this->form_after_validation[ 'id' ] === $form[ 'id' ] ) {
1380 1380
 			$form = $this->form_after_validation;
1381 1381
 		} else {
1382
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1382
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1383 1383
 		}
1384 1384
 
1385 1385
 		$form = $this->filter_conditional_logic( $form );
@@ -1387,8 +1387,8 @@  discard block
 block discarded – undo
1387 1387
 		$form = $this->prefill_conditional_logic( $form );
1388 1388
 
1389 1389
 		// for now we don't support Save and Continue feature.
1390
-		if( ! self::$supports_save_and_continue ) {
1391
-	        unset( $form['save'] );
1390
+		if ( ! self::$supports_save_and_continue ) {
1391
+	        unset( $form[ 'save' ] );
1392 1392
 		}
1393 1393
 
1394 1394
 		$form = $this->unselect_default_values( $form );
@@ -1411,31 +1411,31 @@  discard block
 block discarded – undo
1411 1411
 	 */
1412 1412
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1413 1413
 
1414
-		if( ! GFCommon::is_post_field( $field ) ) {
1414
+		if ( ! GFCommon::is_post_field( $field ) ) {
1415 1415
 			return $field_content;
1416 1416
 		}
1417 1417
 
1418 1418
         $message = null;
1419 1419
 
1420 1420
         // First, make sure they have the capability to edit the post.
1421
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1421
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1422 1422
 
1423 1423
             /**
1424 1424
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1425 1425
              * @param string $message The existing "You don't have permission..." text
1426 1426
              */
1427
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1427
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1428 1428
 
1429
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1429
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1430 1430
             /**
1431 1431
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1432 1432
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1433 1433
              */
1434
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1434
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1435 1435
         }
1436 1436
 
1437
-        if( $message ) {
1438
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1437
+        if ( $message ) {
1438
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1439 1439
         }
1440 1440
 
1441 1441
         return $field_content;
@@ -1459,8 +1459,8 @@  discard block
 block discarded – undo
1459 1459
 
1460 1460
 		// If the form has been submitted, then we don't need to pre-fill the values,
1461 1461
 		// Except for fileupload type and when a field input is overridden- run always!!
1462
-		if(
1463
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1462
+		if (
1463
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1464 1464
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1465 1465
 			&& ! GFCommon::is_product_field( $field->type )
1466 1466
 			|| ! empty( $field_content )
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 	    $return = null;
1481 1481
 
1482 1482
 		/** @var GravityView_Field $gv_field */
1483
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1483
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1484 1484
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1485 1485
 		} else {
1486 1486
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 	    // If there was output, it's an error
1490 1490
 	    $warnings = ob_get_clean();
1491 1491
 
1492
-	    if( !empty( $warnings ) ) {
1492
+	    if ( ! empty( $warnings ) ) {
1493 1493
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1494 1494
 	    }
1495 1495
 
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1515 1515
 
1516 1516
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1517
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1517
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1518 1518
 
1519 1519
 			$field_value = array();
1520 1520
 
@@ -1523,10 +1523,10 @@  discard block
 block discarded – undo
1523 1523
 
1524 1524
 			foreach ( (array)$field->inputs as $input ) {
1525 1525
 
1526
-				$input_id = strval( $input['id'] );
1526
+				$input_id = strval( $input[ 'id' ] );
1527 1527
 
1528 1528
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1529
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1529
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1530 1530
 				    $allow_pre_populated = false;
1531 1531
 				}
1532 1532
 
@@ -1534,7 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 
1535 1535
 			$pre_value = $field->get_value_submission( array(), false );
1536 1536
 
1537
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1537
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1538 1538
 
1539 1539
 		} else {
1540 1540
 
@@ -1545,13 +1545,13 @@  discard block
 block discarded – undo
1545 1545
 
1546 1546
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1547 1547
 			// or pre-populated value if not empty and set to override saved value
1548
-			$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;
1548
+			$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;
1549 1549
 
1550 1550
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1551
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1551
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1552 1552
 				$categories = array();
1553 1553
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1554
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1554
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1555 1555
 				}
1556 1556
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1557 1557
 			}
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
 	     * @param GF_Field $field Gravity Forms field object
1580 1580
 	     * @param GravityView_Edit_Entry_Render $this Current object
1581 1581
 	     */
1582
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1582
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1583 1583
 
1584 1584
 		return $field_value;
1585 1585
 	}
@@ -1596,12 +1596,12 @@  discard block
 block discarded – undo
1596 1596
 	 */
1597 1597
 	public function gform_pre_validation( $form ) {
1598 1598
 
1599
-		if( ! $this->verify_nonce() ) {
1599
+		if ( ! $this->verify_nonce() ) {
1600 1600
 			return $form;
1601 1601
 		}
1602 1602
 
1603 1603
 		// Fix PHP warning regarding undefined index.
1604
-		foreach ( $form['fields'] as &$field) {
1604
+		foreach ( $form[ 'fields' ] as &$field ) {
1605 1605
 
1606 1606
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1607 1607
 			// expects certain field array items to be set.
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1610 1610
 			}
1611 1611
 
1612
-			switch( RGFormsModel::get_input_type( $field ) ) {
1612
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1613 1613
 
1614 1614
 				/**
1615 1615
 				 * 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.
@@ -1623,26 +1623,26 @@  discard block
 block discarded – undo
1623 1623
 				    // Set the previous value
1624 1624
 				    $entry = $this->get_entry();
1625 1625
 
1626
-				    $input_name = 'input_'.$field->id;
1627
-				    $form_id = $form['id'];
1626
+				    $input_name = 'input_' . $field->id;
1627
+				    $form_id = $form[ 'id' ];
1628 1628
 
1629 1629
 				    $value = NULL;
1630 1630
 
1631 1631
 				    // Use the previous entry value as the default.
1632
-				    if( isset( $entry[ $field->id ] ) ) {
1632
+				    if ( isset( $entry[ $field->id ] ) ) {
1633 1633
 				        $value = $entry[ $field->id ];
1634 1634
 				    }
1635 1635
 
1636 1636
 				    // If this is a single upload file
1637
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1638
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1639
-				        $value = $file_path['url'];
1637
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1638
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1639
+				        $value = $file_path[ 'url' ];
1640 1640
 
1641 1641
 				    } else {
1642 1642
 
1643 1643
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1644 1644
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1645
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1645
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1646 1646
 
1647 1647
 				    }
1648 1648
 
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 						if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1653 1653
 							$value = empty( $value ) ? '[]' : $value;
1654 1654
 							$value = stripslashes_deep( $value );
1655
-							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array() );
1655
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1656 1656
 						} else if ( GFCommon::is_json( $value ) ) {
1657 1657
 							// Existing file; let GF derive the value from the `$_gf_uploaded_files` object (see `\GF_Field_FileUpload::get_multifile_value()`)
1658 1658
 							global $_gf_uploaded_files;
@@ -1672,8 +1672,8 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
 				case 'number':
1674 1674
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1675
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1676
-				        $_POST['input_'.$field->id ] = NULL;
1675
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1676
+				        $_POST[ 'input_' . $field->id ] = NULL;
1677 1677
 				    }
1678 1678
 				    break;
1679 1679
 			}
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 		 * You can enter whatever you want!
1711 1711
 		 * We try validating, and customize the results using `self::custom_validation()`
1712 1712
 		 */
1713
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1713
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1714 1714
 
1715 1715
 		// Needed by the validate funtion
1716 1716
 		$failed_validation_page = NULL;
@@ -1718,14 +1718,14 @@  discard block
 block discarded – undo
1718 1718
 
1719 1719
 		// Prevent entry limit from running when editing an entry, also
1720 1720
 		// prevent form scheduling from preventing editing
1721
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1721
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1722 1722
 
1723 1723
 		// Hide fields depending on Edit Entry settings
1724
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1724
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1725 1725
 
1726 1726
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1727 1727
 
1728
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1728
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1729 1729
 	}
1730 1730
 
1731 1731
 
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
 
1754 1754
 		$gv_valid = true;
1755 1755
 
1756
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1756
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1757 1757
 			$value             = RGFormsModel::get_field_value( $field );
1758 1758
 			$field_type        = RGFormsModel::get_input_type( $field );
1759 1759
 			$is_required       = ! empty( $field->isRequired );
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
 
1762 1762
 			// Manually validate required fields as they can be skipped be skipped by GF's validation
1763 1763
 			// This can happen when the field is considered "hidden" (see `GFFormDisplay::validate`) due to unmet conditional logic
1764
-			if ( $is_required && !$failed_validation && rgblank( $value ) ) {
1764
+			if ( $is_required && ! $failed_validation && rgblank( $value ) ) {
1765 1765
 				$field->failed_validation  = true;
1766 1766
 				$field->validation_message = esc_html__( 'This field is required.', 'gravityview' );
1767 1767
 
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
 					if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1786 1786
 						$input_name = 'input_' . $field->id;
1787 1787
 						//uploaded
1788
-						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1788
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1789 1789
 
1790 1790
 						//existent
1791 1791
 						$entry = $this->get_entry();
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 							$gv_valid                  = false;
1805 1805
 
1806 1806
 							// in case of error make sure the newest upload files are removed from the upload input
1807
-							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1807
+							GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1808 1808
 						}
1809 1809
 					}
1810 1810
 
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
 			}
1813 1813
 
1814 1814
 			// This field has failed validation.
1815
-			if( !empty( $field->failed_validation ) ) {
1815
+			if ( ! empty( $field->failed_validation ) ) {
1816 1816
 
1817 1817
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1818 1818
 
@@ -1830,19 +1830,19 @@  discard block
 block discarded – undo
1830 1830
 				}
1831 1831
 
1832 1832
 				// You can't continue inside a switch, so we do it after.
1833
-				if( empty( $field->failed_validation ) ) {
1833
+				if ( empty( $field->failed_validation ) ) {
1834 1834
 				    continue;
1835 1835
 				}
1836 1836
 
1837 1837
 				// checks if the No Duplicates option is not validating entry against itself, since
1838 1838
 				// we're editing a stored entry, it would also assume it's a duplicate.
1839
-				if( !empty( $field->noDuplicates ) ) {
1839
+				if ( ! empty( $field->noDuplicates ) ) {
1840 1840
 
1841 1841
 				    $entry = $this->get_entry();
1842 1842
 
1843 1843
 				    // If the value of the entry is the same as the stored value
1844 1844
 				    // Then we can assume it's not a duplicate, it's the same.
1845
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1845
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1846 1846
 				        //if value submitted was not changed, then don't validate
1847 1847
 				        $field->failed_validation = false;
1848 1848
 
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
 				}
1856 1856
 
1857 1857
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1858
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1858
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1859 1859
 				    unset( $field->validation_message );
1860 1860
 					$field->failed_validation = false;
1861 1861
 				    continue;
@@ -1867,12 +1867,12 @@  discard block
 block discarded – undo
1867 1867
 
1868 1868
 		}
1869 1869
 
1870
-		$validation_results['is_valid'] = $gv_valid;
1870
+		$validation_results[ 'is_valid' ] = $gv_valid;
1871 1871
 
1872 1872
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1873 1873
 
1874 1874
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1875
-		$this->form_after_validation = $validation_results['form'];
1875
+		$this->form_after_validation = $validation_results[ 'form' ];
1876 1876
 
1877 1877
 		return $validation_results;
1878 1878
 	}
@@ -1885,7 +1885,7 @@  discard block
 block discarded – undo
1885 1885
 	 */
1886 1886
 	public function get_entry() {
1887 1887
 
1888
-		if( empty( $this->entry ) ) {
1888
+		if ( empty( $this->entry ) ) {
1889 1889
 			// Get the database value of the entry that's being edited
1890 1890
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1891 1891
 		}
@@ -1917,10 +1917,10 @@  discard block
 block discarded – undo
1917 1917
 		}
1918 1918
 
1919 1919
 		// If edit tab not yet configured, show all fields
1920
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1920
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1921 1921
 
1922 1922
 		// Hide fields depending on admin settings
1923
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1923
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1924 1924
 
1925 1925
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1926 1926
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 	 */
1954 1954
 	private function filter_fields( $fields, $configured_fields ) {
1955 1955
 
1956
-		if( empty( $fields ) || !is_array( $fields ) ) {
1956
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1957 1957
 			return $fields;
1958 1958
 		}
1959 1959
 
@@ -1970,12 +1970,12 @@  discard block
 block discarded – undo
1970 1970
 
1971 1971
 			// Remove the fields that have calculation properties and keep them to be used later
1972 1972
 			// @since 1.16.2
1973
-			if( $field->has_calculation() ) {
1974
-				$this->fields_with_calculation[] = $field;
1973
+			if ( $field->has_calculation() ) {
1974
+				$this->fields_with_calculation[ ] = $field;
1975 1975
 				// don't remove the calculation fields on form render.
1976 1976
 			}
1977 1977
 
1978
-			if( in_array( $field->type, $field_type_blocklist ) ) {
1978
+			if ( in_array( $field->type, $field_type_blocklist ) ) {
1979 1979
 				unset( $fields[ $key ] );
1980 1980
 			}
1981 1981
 		}
@@ -2005,7 +2005,7 @@  discard block
 block discarded – undo
2005 2005
 					continue; // Never include when no fields are configured
2006 2006
 				}
2007 2007
 
2008
-				$out_fields[] = $field;
2008
+				$out_fields[ ] = $field;
2009 2009
 			}
2010 2010
 
2011 2011
 			return array_values( $out_fields );
@@ -2016,8 +2016,8 @@  discard block
 block discarded – undo
2016 2016
 
2017 2017
 	        /** @var GF_Field $field */
2018 2018
 	        foreach ( $fields as $field ) {
2019
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2020
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2019
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2020
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
2021 2021
 				    break;
2022 2022
 				}
2023 2023
 
@@ -2040,14 +2040,14 @@  discard block
 block discarded – undo
2040 2040
 
2041 2041
 		$return_field = $field;
2042 2042
 
2043
-		if( empty( $field_setting['show_label'] ) ) {
2043
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
2044 2044
 			$return_field->label = '';
2045
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
2046
-			$return_field->label = $field_setting['custom_label'];
2045
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
2046
+			$return_field->label = $field_setting[ 'custom_label' ];
2047 2047
 		}
2048 2048
 
2049
-		if( !empty( $field_setting['custom_class'] ) ) {
2050
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
2049
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
2050
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
2051 2051
 		}
2052 2052
 
2053 2053
 		/**
@@ -2085,16 +2085,16 @@  discard block
 block discarded – undo
2085 2085
 	     */
2086 2086
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2087 2087
 
2088
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2089
-			foreach( $fields as $k => $field ) {
2090
-				if( $field->adminOnly ) {
2088
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
2089
+			foreach ( $fields as $k => $field ) {
2090
+				if ( $field->adminOnly ) {
2091 2091
 				    unset( $fields[ $k ] );
2092 2092
 				}
2093 2093
 			}
2094 2094
 			return array_values( $fields );
2095 2095
 		}
2096 2096
 
2097
-	    foreach( $fields as &$field ) {
2097
+	    foreach ( $fields as &$field ) {
2098 2098
 		    $field->adminOnly = false;
2099 2099
 		}
2100 2100
 
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
 	 */
2116 2116
 	private function unselect_default_values( $form ) {
2117 2117
 
2118
-	    foreach ( $form['fields'] as &$field ) {
2118
+	    foreach ( $form[ 'fields' ] as &$field ) {
2119 2119
 
2120 2120
 			if ( empty( $field->choices ) ) {
2121 2121
                 continue;
@@ -2123,7 +2123,7 @@  discard block
 block discarded – undo
2123 2123
 
2124 2124
             foreach ( $field->choices as &$choice ) {
2125 2125
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2126
-					$choice['isSelected'] = false;
2126
+					$choice[ 'isSelected' ] = false;
2127 2127
 				}
2128 2128
 			}
2129 2129
 		}
@@ -2148,22 +2148,22 @@  discard block
 block discarded – undo
2148 2148
 	 */
2149 2149
 	function prefill_conditional_logic( $form ) {
2150 2150
 
2151
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2151
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2152 2152
 			return $form;
2153 2153
 		}
2154 2154
 
2155 2155
 		// Have Conditional Logic pre-fill fields as if the data were default values
2156 2156
 		/** @var GF_Field $field */
2157
-		foreach ( $form['fields'] as &$field ) {
2157
+		foreach ( $form[ 'fields' ] as &$field ) {
2158 2158
 
2159
-			if( 'checkbox' === $field->type ) {
2159
+			if ( 'checkbox' === $field->type ) {
2160 2160
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2161
-				    $input_id = $input['id'];
2161
+				    $input_id = $input[ 'id' ];
2162 2162
 				    $choice = $field->choices[ $key ];
2163 2163
 				    $value = \GV\Utils::get( $this->entry, $input_id );
2164 2164
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2165
-				    if( $match ) {
2166
-				        $field->choices[ $key ]['isSelected'] = true;
2165
+				    if ( $match ) {
2166
+				        $field->choices[ $key ][ 'isSelected' ] = true;
2167 2167
 				    }
2168 2168
 				}
2169 2169
 			} else {
@@ -2171,15 +2171,15 @@  discard block
 block discarded – undo
2171 2171
 				// We need to run through each field to set the default values
2172 2172
 				foreach ( $this->entry as $field_id => $field_value ) {
2173 2173
 
2174
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2174
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
2175 2175
 
2176
-				        if( 'list' === $field->type ) {
2176
+				        if ( 'list' === $field->type ) {
2177 2177
 				            $list_rows = maybe_unserialize( $field_value );
2178 2178
 
2179 2179
 				            $list_field_value = array();
2180
-				            foreach ( (array) $list_rows as $row ) {
2181
-				                foreach ( (array) $row as $column ) {
2182
-				                    $list_field_value[] = $column;
2180
+				            foreach ( (array)$list_rows as $row ) {
2181
+				                foreach ( (array)$row as $column ) {
2182
+				                    $list_field_value[ ] = $column;
2183 2183
 				                }
2184 2184
 				            }
2185 2185
 
@@ -2212,32 +2212,32 @@  discard block
 block discarded – undo
2212 2212
 		 * @see https://github.com/gravityview/GravityView/issues/840
2213 2213
 		 * @since develop
2214 2214
 		 */
2215
-		$the_form = GFAPI::get_form( $form['id'] );
2215
+		$the_form = GFAPI::get_form( $form[ 'id' ] );
2216 2216
 		$editable_ids = array();
2217
-		foreach ( $form['fields'] as $field ) {
2218
-			$editable_ids[] = $field['id']; // wp_list_pluck is destructive in this context
2217
+		foreach ( $form[ 'fields' ] as $field ) {
2218
+			$editable_ids[ ] = $field[ 'id' ]; // wp_list_pluck is destructive in this context
2219 2219
 		}
2220 2220
 		$remove_conditions_rule = array();
2221
-		foreach ( $the_form['fields'] as $field ) {
2222
-			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic['rules'] ) ) {
2223
-				foreach ( $field->conditionalLogic['rules'] as $i => $rule ) {
2224
-					if ( ! in_array( $rule['fieldId'], $editable_ids ) ) {
2221
+		foreach ( $the_form[ 'fields' ] as $field ) {
2222
+			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic[ 'rules' ] ) ) {
2223
+				foreach ( $field->conditionalLogic[ 'rules' ] as $i => $rule ) {
2224
+					if ( ! in_array( $rule[ 'fieldId' ], $editable_ids ) ) {
2225 2225
 						/**
2226 2226
 						 * This conditional field is not editable in this View.
2227 2227
 						 * We need to remove the rule, but only if it matches.
2228 2228
 						 */
2229
-						if ( $_field = GFAPI::get_field( $the_form, $rule['fieldId'] ) ) {
2229
+						if ( $_field = GFAPI::get_field( $the_form, $rule[ 'fieldId' ] ) ) {
2230 2230
 							$value = $_field->get_value_export( $this->entry );
2231
-						} elseif ( isset( $this->entry[ $rule['fieldId'] ] ) ) {
2232
-							$value = $this->entry[ $rule['fieldId'] ];
2231
+						} elseif ( isset( $this->entry[ $rule[ 'fieldId' ] ] ) ) {
2232
+							$value = $this->entry[ $rule[ 'fieldId' ] ];
2233 2233
 						} else {
2234
-							$value = gform_get_meta( $this->entry['id'], $rule['fieldId'] );
2234
+							$value = gform_get_meta( $this->entry[ 'id' ], $rule[ 'fieldId' ] );
2235 2235
 						}
2236 2236
 
2237
-						$match = GFFormsModel::matches_operation( $value, $rule['value'], $rule['operator'] );
2237
+						$match = GFFormsModel::matches_operation( $value, $rule[ 'value' ], $rule[ 'operator' ] );
2238 2238
 
2239 2239
 						if ( $match ) {
2240
-							$remove_conditions_rule[] = array( $field['id'], $i );
2240
+							$remove_conditions_rule[ ] = array( $field[ 'id' ], $i );
2241 2241
 						}
2242 2242
 					}
2243 2243
 				}
@@ -2245,21 +2245,21 @@  discard block
 block discarded – undo
2245 2245
 		}
2246 2246
 
2247 2247
 		if ( $remove_conditions_rule ) {
2248
-			foreach ( $form['fields'] as &$field ) {
2248
+			foreach ( $form[ 'fields' ] as &$field ) {
2249 2249
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2250 2250
 
2251 2251
 				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2252 2252
 
2253
-					if ( $field['id'] == $rule_field_id ) {
2254
-						unset( $field->conditionalLogic['rules'][ $rule_i ] );
2255
-						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field['id'] ) );
2253
+					if ( $field[ 'id' ] == $rule_field_id ) {
2254
+						unset( $field->conditionalLogic[ 'rules' ][ $rule_i ] );
2255
+						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field[ 'id' ] ) );
2256 2256
 					}
2257 2257
 				}
2258 2258
 			}
2259 2259
 		}
2260 2260
 
2261 2261
 		/** Normalize the indices... */
2262
-		$form['fields'] = array_values( $form['fields'] );
2262
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
2263 2263
 
2264 2264
 		/**
2265 2265
 		 * @filter `gravityview/edit_entry/conditional_logic` Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields?
@@ -2269,16 +2269,16 @@  discard block
 block discarded – undo
2269 2269
 		 */
2270 2270
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
2271 2271
 
2272
-		if( $use_conditional_logic ) {
2272
+		if ( $use_conditional_logic ) {
2273 2273
 			return $form;
2274 2274
 		}
2275 2275
 
2276
-		foreach( $form['fields'] as &$field ) {
2276
+		foreach ( $form[ 'fields' ] as &$field ) {
2277 2277
 			/* @var GF_Field $field */
2278 2278
 			$field->conditionalLogic = null;
2279 2279
 		}
2280 2280
 
2281
-		unset( $form['button']['conditionalLogic'] );
2281
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
2282 2282
 
2283 2283
 		return $form;
2284 2284
 
@@ -2295,7 +2295,7 @@  discard block
 block discarded – undo
2295 2295
 	 */
2296 2296
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
2297 2297
 
2298
-		if( ! $this->is_edit_entry() ) {
2298
+		if ( ! $this->is_edit_entry() ) {
2299 2299
 			return $has_conditional_logic;
2300 2300
 		}
2301 2301
 
@@ -2327,44 +2327,44 @@  discard block
 block discarded – undo
2327 2327
 		 *  2. There are two entries embedded using oEmbed
2328 2328
 		 *  3. One of the entries has just been saved
2329 2329
 		 */
2330
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
2330
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
2331 2331
 
2332 2332
 			$error = true;
2333 2333
 
2334 2334
 		}
2335 2335
 
2336
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
2336
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
2337 2337
 
2338 2338
 			$error = true;
2339 2339
 
2340
-		} elseif( ! $this->verify_nonce() ) {
2340
+		} elseif ( ! $this->verify_nonce() ) {
2341 2341
 
2342 2342
 			/**
2343 2343
 			 * If the Entry is embedded, there may be two entries on the same page.
2344 2344
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
2345 2345
 			 */
2346
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2346
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2347 2347
 				$error = true;
2348 2348
 			} else {
2349
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
2349
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
2350 2350
 			}
2351 2351
 
2352 2352
 		}
2353 2353
 
2354
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2355
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
2354
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2355
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
2356 2356
 		}
2357 2357
 
2358
-		if( $this->entry['status'] === 'trash' ) {
2359
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
2358
+		if ( $this->entry[ 'status' ] === 'trash' ) {
2359
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
2360 2360
 		}
2361 2361
 
2362 2362
 		// No errors; everything's fine here!
2363
-		if( empty( $error ) ) {
2363
+		if ( empty( $error ) ) {
2364 2364
 			return true;
2365 2365
 		}
2366 2366
 
2367
-		if( $echo && $error !== true ) {
2367
+		if ( $echo && $error !== true ) {
2368 2368
 
2369 2369
 	        $error = esc_html( $error );
2370 2370
 
@@ -2372,10 +2372,10 @@  discard block
 block discarded – undo
2372 2372
 	         * @since 1.9
2373 2373
 	         */
2374 2374
 	        if ( ! empty( $this->entry ) ) {
2375
-		        $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;" ) );
2375
+		        $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;" ) );
2376 2376
 	        }
2377 2377
 
2378
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2378
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
2379 2379
 		}
2380 2380
 
2381 2381
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2395,17 +2395,17 @@  discard block
 block discarded – undo
2395 2395
 
2396 2396
 		$error = NULL;
2397 2397
 
2398
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2399
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2398
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2399
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2400 2400
 		}
2401 2401
 
2402 2402
 		// No errors; everything's fine here!
2403
-		if( empty( $error ) ) {
2403
+		if ( empty( $error ) ) {
2404 2404
 			return true;
2405 2405
 		}
2406 2406
 
2407
-		if( $echo ) {
2408
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2407
+		if ( $echo ) {
2408
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2409 2409
 		}
2410 2410
 
2411 2411
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2426,14 +2426,14 @@  discard block
 block discarded – undo
2426 2426
 	private function check_user_cap_edit_field( $field ) {
2427 2427
 
2428 2428
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2429
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2429
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2430 2430
 			return true;
2431 2431
 		}
2432 2432
 
2433
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2433
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2434 2434
 
2435
-		if( $field_cap ) {
2436
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2435
+		if ( $field_cap ) {
2436
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2437 2437
 		}
2438 2438
 
2439 2439
 		return false;
@@ -2447,17 +2447,17 @@  discard block
 block discarded – undo
2447 2447
 	public function verify_nonce() {
2448 2448
 
2449 2449
 		// Verify form submitted for editing single
2450
-		if( $this->is_edit_entry_submission() ) {
2450
+		if ( $this->is_edit_entry_submission() ) {
2451 2451
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2452 2452
 		}
2453 2453
 
2454 2454
 		// Verify
2455
-		else if( ! $this->is_edit_entry() ) {
2455
+		else if ( ! $this->is_edit_entry() ) {
2456 2456
 			$valid = false;
2457 2457
 		}
2458 2458
 
2459 2459
 		else {
2460
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2460
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2461 2461
 		}
2462 2462
 
2463 2463
 		/**
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
 		 */
2518 2518
 		$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
2519 2519
 
2520
-		return (array) $labels;
2520
+		return (array)$labels;
2521 2521
 	}
2522 2522
 
2523 2523
 } //end class
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -700,7 +700,8 @@  discard block
 block discarded – undo
700 700
 
701 701
 							// Only allow quantity to be set if it's allowed to be edited
702 702
 							if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) {
703
-							} else { // otherwise set to what it previously was
703
+							} else {
704
+// otherwise set to what it previously was
704 705
 								$_POST[ $input_name ] = $entry[ $input['id'] ];
705 706
 							}
706 707
 						} else {
@@ -1164,7 +1165,7 @@  discard block
 block discarded – undo
1164 1165
 
1165 1166
 		$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
1166 1167
 
1167
-		if( ! $this->is_valid ){
1168
+		if( ! $this->is_valid ) {
1168 1169
 
1169 1170
 			// Keeping this compatible with Gravity Forms.
1170 1171
 			$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
@@ -2454,9 +2455,7 @@  discard block
 block discarded – undo
2454 2455
 		// Verify
2455 2456
 		else if( ! $this->is_edit_entry() ) {
2456 2457
 			$valid = false;
2457
-		}
2458
-
2459
-		else {
2458
+		} else {
2460 2459
 			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2461 2460
 		}
2462 2461
 
Please login to merge, or discard this patch.