Completed
Push — develop ( 140fbf...8e1712 )
by
unknown
37:05 queued 17:03
created
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +241 added lines, -241 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
 	/**
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 		} else {
244 244
 			$gravityview_view     = GravityView_View::getInstance();
245 245
 			$entries              = $gravityview_view->getEntries();
246
-			self::$original_entry = $entries[0];
247
-			$this->entry          = $entries[0];
246
+			self::$original_entry = $entries[ 0 ];
247
+			$this->entry          = $entries[ 0 ];
248 248
 		}
249 249
 
250
-		self::$original_form = GFAPI::get_form( $this->entry['form_id'] );
250
+		self::$original_form = GFAPI::get_form( $this->entry[ 'form_id' ] );
251 251
 		$this->form          = self::$original_form;
252 252
 
253
-		$this->form_id = $this->entry['form_id'];
253
+		$this->form_id = $this->entry[ 'form_id' ];
254 254
 
255 255
 		$this->view_id = $view ? $view->ID : $gravityview_view->getViewId();
256 256
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
260 260
 
261
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
261
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
262 262
 	}
263 263
 
264 264
 	/**
@@ -320,15 +320,15 @@  discard block
 block discarded – undo
320 320
 	private function print_scripts() {
321 321
 		$gravityview_view = GravityView_View::getInstance();
322 322
 
323
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
323
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
324 324
 
325 325
 		GFFormDisplay::enqueue_form_scripts( $this->form ? $this->form : $gravityview_view->getForm(), false );
326 326
 
327 327
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
328 328
 
329
-		wp_enqueue_script( 'sack'); // Sack is required for images.
330
-		wp_enqueue_script( 'gform_gravityforms');
331
-		wp_enqueue_script( 'gravityview-fe-view');
329
+		wp_enqueue_script( 'sack' ); // Sack is required for images.
330
+		wp_enqueue_script( 'gform_gravityforms' );
331
+		wp_enqueue_script( 'gravityview-fe-view' );
332 332
 
333 333
 		// File download/delete icons
334 334
 		wp_enqueue_style( 'gform_admin_icons' );
@@ -342,19 +342,19 @@  discard block
 block discarded – undo
342 342
 	 */
343 343
 	private function process_save( $gv_data ) {
344 344
 
345
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
345
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
346 346
 			return;
347 347
 		}
348 348
 
349 349
 		// Make sure the entry, view, and form IDs are all correct
350 350
 		$valid = $this->verify_nonce();
351 351
 
352
-		if ( !$valid ) {
352
+		if ( ! $valid ) {
353 353
 			gravityview()->log->error( 'Nonce validation failed.' );
354 354
 			return;
355 355
 		}
356 356
 
357
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
357
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
358 358
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
359 359
 			return;
360 360
 		}
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 
366 366
 		$this->validate();
367 367
 
368
-		if( $this->is_valid ) {
368
+		if ( $this->is_valid ) {
369 369
 
370 370
 			gravityview()->log->debug( 'Submission is valid.' );
371 371
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 			/**
378 378
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
379 379
 			 */
380
-			unset( $_GET['page'] );
380
+			unset( $_GET[ 'page' ] );
381 381
 
382 382
 			add_filter( 'gform_use_post_value_for_conditional_logic_save_entry', '__return_true' );
383 383
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 			 * @param GravityView_Edit_Entry_Render $this This object
390 390
 			 * @param GravityView_View_Data $gv_data The View data
391 391
 			 */
392
-			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry['id'], $this, $gv_data );
392
+			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry[ 'id' ], $this, $gv_data );
393 393
 
394 394
 			GFFormsModel::save_lead( $form, $this->entry );
395 395
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 			 * @param GravityView_Edit_Entry_Render $this This object
420 420
 			 * @param GravityView_View_Data $gv_data The View data
421 421
 			 */
422
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
422
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
423 423
 
424 424
 		} else {
425 425
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -455,10 +455,10 @@  discard block
 block discarded – undo
455 455
 
456 456
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
457 457
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
458
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
458
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
459 459
 		} else {
460 460
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
461
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
461
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
462 462
 		}
463 463
 
464 464
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 
477 477
 				$empty_value = $field->get_value_save_entry(
478 478
 					is_array( $field->get_entry_inputs() ) ? array() : '',
479
-					$this->form, '', $this->entry['id'], $this->entry
479
+					$this->form, '', $this->entry[ 'id' ], $this->entry
480 480
 				);
481 481
 
482 482
 				if ( $field->has_calculation() ) {
483
-					$this->unset_hidden_calculations[] = $field->id; // Unset
483
+					$this->unset_hidden_calculations[ ] = $field->id; // Unset
484 484
 					$empty_value = '';
485 485
 				}
486 486
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 	private function preset_approval_fields() {
510 510
 		$has_approved_field = false;
511 511
 
512
-		foreach ( self::$original_form['fields'] as $field ) {
512
+		foreach ( self::$original_form[ 'fields' ] as $field ) {
513 513
 			if ( $field->gravityview_approved ) {
514 514
 				$has_approved_field = true;
515 515
 				break;
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 
523 523
 		$is_field_hidden = true;
524 524
 
525
-		foreach ( $this->form['fields'] as $field ) {
525
+		foreach ( $this->form[ 'fields' ] as $field ) {
526 526
 			if ( $field->gravityview_approved ) {
527 527
 				$is_field_hidden = false;
528 528
 				break;
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 
548 548
 		remove_filter( 'gravityview/approve_entries/update_unapproved_meta', array( $this, 'prevent_update_unapproved_meta' ), 9 );
549 549
 
550
-		if ( ! $value = gform_get_meta( $entry['id'], 'is_approved' ) ) {
550
+		if ( ! $value = gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
551 551
 
552 552
 			$value = GravityView_Entry_Approval_Status::UNAPPROVED;
553 553
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 		}
613 613
 
614 614
 		/** No file is being uploaded. */
615
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
615
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
616 616
 			/** So return the original upload, with $value as backup (it can be empty during edit form rendering) */
617 617
 			return rgar( $entry, $input_id, $value );
618 618
 		}
@@ -630,11 +630,11 @@  discard block
 block discarded – undo
630 630
 	 * @return mixed
631 631
 	 */
632 632
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
633
-		if( ! $this->is_edit_entry() ) {
633
+		if ( ! $this->is_edit_entry() ) {
634 634
 			return $plupload_init;
635 635
 		}
636 636
 
637
-		$plupload_init['gf_vars']['max_files'] = 0;
637
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
638 638
 
639 639
 		return $plupload_init;
640 640
 	}
@@ -649,26 +649,26 @@  discard block
 block discarded – undo
649 649
 		$form = $this->filter_conditional_logic( $this->form );
650 650
 
651 651
 	    /** @type GF_Field $field */
652
-		foreach( $form['fields'] as $k => &$field ) {
652
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
653 653
 
654 654
 			/**
655 655
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
656 656
 			 * @since 1.16.3
657 657
 			 */
658
-			if( $field->has_calculation() ) {
659
-				unset( $form['fields'][ $k ] );
658
+			if ( $field->has_calculation() ) {
659
+				unset( $form[ 'fields' ][ $k ] );
660 660
 			}
661 661
 
662 662
 			$field->adminOnly = false;
663 663
 
664
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
665
-				foreach( $field->inputs as $key => $input ) {
666
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
664
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
665
+				foreach ( $field->inputs as $key => $input ) {
666
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
667 667
 				}
668 668
 			}
669 669
 		}
670 670
 
671
-		$form['fields'] = array_values( $form['fields'] );
671
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
672 672
 
673 673
 		return $form;
674 674
 	}
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
 		$update = false;
681 681
 
682 682
 		// get the most up to date entry values
683
-		$entry = GFAPI::get_entry( $this->entry['id'] );
683
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
684 684
 
685 685
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
686 686
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
687
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) );
687
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) );
688 688
 		} else {
689 689
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
690
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) );
690
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) );
691 691
 		}
692 692
 
693 693
 
@@ -704,24 +704,24 @@  discard block
 block discarded – undo
704 704
 				$inputs = $field->get_entry_inputs();
705 705
 				if ( is_array( $inputs ) ) {
706 706
 				    foreach ( $inputs as $input ) {
707
-						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
707
+						list( $field_id, $input_id ) = rgexplode( '.', $input[ 'id' ], 2 );
708 708
 
709 709
 						if ( 'product' === $field->type ) {
710
-							$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
710
+							$input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
711 711
 
712 712
 							// Only allow quantity to be set if it's allowed to be edited
713 713
 							if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) {
714 714
 							} else { // otherwise set to what it previously was
715
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
715
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
716 716
 							}
717 717
 						} else {
718 718
 							// Set to what it previously was if it's not editable
719 719
 							if ( ! in_array( $field_id, $allowed_fields ) ) {
720
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
720
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
721 721
 							}
722 722
 						}
723 723
 
724
-						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
724
+						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] );
725 725
 				    }
726 726
 				} else {
727 727
 					// Set to what it previously was if it's not editable
@@ -761,19 +761,19 @@  discard block
 block discarded – undo
761 761
 
762 762
 		$input_name = 'input_' . $field_id;
763 763
 
764
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
764
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
765 765
 
766 766
 			// We have a new image
767 767
 
768
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
768
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
769 769
 
770 770
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
771 771
 	        $ary = stripslashes_deep( $ary );
772 772
 			$img_url = \GV\Utils::get( $ary, 0 );
773 773
 
774
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
775
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
776
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
774
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
775
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
776
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
777 777
 
778 778
 			$image_meta = array(
779 779
 				'post_excerpt' => $img_caption,
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 
783 783
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
784 784
 			if ( ! empty( $img_title ) ) {
785
-				$image_meta['post_title'] = $img_title;
785
+				$image_meta[ 'post_title' ] = $img_title;
786 786
 			}
787 787
 
788 788
 			/**
@@ -840,15 +840,15 @@  discard block
 block discarded – undo
840 840
 	 */
841 841
 	private function maybe_update_post_fields( $form ) {
842 842
 
843
-		if( empty( $this->entry['post_id'] ) ) {
843
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
844 844
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
845 845
 			return;
846 846
 		}
847 847
 
848
-		$post_id = $this->entry['post_id'];
848
+		$post_id = $this->entry[ 'post_id' ];
849 849
 
850 850
 		// Security check
851
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
851
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
852 852
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
853 853
 			return;
854 854
 		}
@@ -861,25 +861,25 @@  discard block
 block discarded – undo
861 861
 
862 862
 			$field = RGFormsModel::get_field( $form, $field_id );
863 863
 
864
-			if( ! $field ) {
864
+			if ( ! $field ) {
865 865
 				continue;
866 866
 			}
867 867
 
868
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
868
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
869 869
 
870 870
 				// Get the value of the field, including $_POSTed value
871 871
 				$value = RGFormsModel::get_field_value( $field );
872 872
 
873 873
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
874 874
 				$entry_tmp = $this->entry;
875
-				$entry_tmp["{$field_id}"] = $value;
875
+				$entry_tmp[ "{$field_id}" ] = $value;
876 876
 
877
-				switch( $field->type ) {
877
+				switch ( $field->type ) {
878 878
 
879 879
 				    case 'post_title':
880 880
 				        $post_title = $value;
881 881
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
882
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
882
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
883 883
 				        }
884 884
 				        $updated_post->post_title = $post_title;
885 885
 				        $updated_post->post_name  = $post_title;
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 				    case 'post_content':
890 890
 				        $post_content = $value;
891 891
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
892
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
892
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
893 893
 				        }
894 894
 				        $updated_post->post_content = $post_content;
895 895
 				        unset( $post_content );
@@ -907,11 +907,11 @@  discard block
 block discarded – undo
907 907
 							$value = $value[ $field_id ];
908 908
 						}
909 909
 
910
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
910
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
911 911
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
912 912
 				        }
913 913
 
914
-						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
914
+						$value = $field->get_value_save_entry( $value, $form, '', $this->entry[ 'id' ], $this->entry );
915 915
 
916 916
 				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
917 917
 				        break;
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 				}
924 924
 
925 925
 				// update entry after
926
-				$this->entry["{$field_id}"] = $value;
926
+				$this->entry[ "{$field_id}" ] = $value;
927 927
 
928 928
 				$update_entry = true;
929 929
 
@@ -932,11 +932,11 @@  discard block
 block discarded – undo
932 932
 
933 933
 		}
934 934
 
935
-		if( $update_entry ) {
935
+		if ( $update_entry ) {
936 936
 
937 937
 			$return_entry = GFAPI::update_entry( $this->entry );
938 938
 
939
-			if( is_wp_error( $return_entry ) ) {
939
+			if ( is_wp_error( $return_entry ) ) {
940 940
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
941 941
 			} else {
942 942
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 
947 947
 		$return_post = wp_update_post( $updated_post, true );
948 948
 
949
-		if( is_wp_error( $return_post ) ) {
949
+		if ( is_wp_error( $return_post ) ) {
950 950
 			$return_post->add_data( $updated_post, '$updated_post' );
951 951
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
952 952
 		} else {
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
981 981
 
982 982
 		// replace conditional shortcodes
983
-		if( $do_shortcode ) {
983
+		if ( $do_shortcode ) {
984 984
 			$output = do_shortcode( $output );
985 985
 		}
986 986
 
@@ -999,19 +999,19 @@  discard block
 block discarded – undo
999 999
 	 */
1000 1000
 	private function after_update() {
1001 1001
 
1002
-		do_action( 'gform_after_update_entry', self::$original_form, $this->entry['id'], self::$original_entry );
1003
-		do_action( "gform_after_update_entry_{$this->form['id']}", self::$original_form, $this->entry['id'], self::$original_entry );
1002
+		do_action( 'gform_after_update_entry', self::$original_form, $this->entry[ 'id' ], self::$original_entry );
1003
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", self::$original_form, $this->entry[ 'id' ], self::$original_entry );
1004 1004
 
1005 1005
 		// Re-define the entry now that we've updated it.
1006
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
1006
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
1007 1007
 
1008 1008
 		$entry = GFFormsModel::set_entry_meta( $entry, self::$original_form );
1009 1009
 
1010 1010
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
1011 1011
 			// We need to clear the cache because Gravity Forms caches the field values, which
1012 1012
 			// we have just updated.
1013
-			foreach ($this->form['fields'] as $key => $field) {
1014
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
1013
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
1014
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
1015 1015
 			}
1016 1016
 		}
1017 1017
 
@@ -1021,11 +1021,11 @@  discard block
 block discarded – undo
1021 1021
 		 * @since develop
1022 1022
 		 */
1023 1023
 		if ( $allowed_feeds = $this->view->settings->get( 'edit_feeds', array() ) ) {
1024
-			$feeds = GFAPI::get_feeds( null, $entry['form_id'] );
1024
+			$feeds = GFAPI::get_feeds( null, $entry[ 'form_id' ] );
1025 1025
 			if ( ! is_wp_error( $feeds ) ) {
1026 1026
 				$registered_feeds = array();
1027 1027
 				foreach ( GFAddOn::get_registered_addons() as $registered_feed ) {
1028
-					if ( is_subclass_of( $registered_feed,  'GFFeedAddOn' ) ) {
1028
+					if ( is_subclass_of( $registered_feed, 'GFFeedAddOn' ) ) {
1029 1029
 						if ( method_exists( $registered_feed, 'get_instance' ) ) {
1030 1030
 							$registered_feed = call_user_func( array( $registered_feed, 'get_instance' ) );
1031 1031
 							$registered_feeds[ $registered_feed->get_slug() ] = $registered_feed;
@@ -1033,8 +1033,8 @@  discard block
 block discarded – undo
1033 1033
 					}
1034 1034
 				}
1035 1035
 				foreach ( $feeds as $feed ) {
1036
-					if ( in_array( $feed['id'], $allowed_feeds ) ) {
1037
-						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed['addon_slug'] ) ) {
1036
+					if ( in_array( $feed[ 'id' ], $allowed_feeds ) ) {
1037
+						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed[ 'addon_slug' ] ) ) {
1038 1038
 							$returned_entry = $feed_object->process_feed( $feed, $entry, self::$original_form );
1039 1039
 							if ( is_array( $returned_entry ) && rgar( $returned_entry, 'id' ) ) {
1040 1040
 								$entry = $returned_entry;
@@ -1062,9 +1062,9 @@  discard block
 block discarded – undo
1062 1062
 
1063 1063
 		$view = \GV\View::by_id( $this->view_id );
1064 1064
 
1065
-		if( $view->settings->get( 'edit_locking' ) ) {
1065
+		if ( $view->settings->get( 'edit_locking' ) ) {
1066 1066
 			$locking = new GravityView_Edit_Entry_Locking();
1067
-			$locking->maybe_lock_object( $this->entry['id'] );
1067
+			$locking->maybe_lock_object( $this->entry[ 'id' ] );
1068 1068
 		}
1069 1069
 
1070 1070
 		?>
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 
1078 1078
 		<div class="gv-edit-entry-wrapper"><?php
1079 1079
 
1080
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
1080
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
1081 1081
 
1082 1082
 			/**
1083 1083
 			 * Fixes weird wpautop() issue
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
1094 1094
 				     * @param GravityView_Edit_Entry_Render $this This object
1095 1095
 				     */
1096
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gk-gravityview'), $this );
1096
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gk-gravityview' ), $this );
1097 1097
 
1098 1098
 				    echo esc_attr( $edit_entry_title );
1099 1099
 			?></span>
@@ -1170,18 +1170,18 @@  discard block
 block discarded – undo
1170 1170
 			*/
1171 1171
 			$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1172 1172
 
1173
-			$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit'];
1173
+			$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels[ 'submit' ];
1174 1174
 		}
1175 1175
 
1176 1176
 		$back_link = remove_query_arg( array( 'page', 'view', 'edit', 'gvid' ) );
1177 1177
 
1178
-		if( ! $this->is_valid ){
1178
+		if ( ! $this->is_valid ) {
1179 1179
 
1180 1180
 			// Keeping this compatible with Gravity Forms.
1181
-			$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gk-gravityview') . " " . __('Errors have been highlighted below.', 'gk-gravityview') . "</div>";
1182
-			$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
1181
+			$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gk-gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gk-gravityview' ) . "</div>";
1182
+			$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
1183 1183
 
1184
-			echo GVCommon::generate_notice( $message , 'gv-error' );
1184
+			echo GVCommon::generate_notice( $message, 'gv-error' );
1185 1185
 
1186 1186
 		} elseif ( false === $this->is_paged_submitted ) {
1187 1187
 			// Paged form that hasn't been submitted on the last page yet
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 			 * @param int $view_id View ID
1195 1195
 			 * @param array $entry Gravity Forms entry array
1196 1196
 			 */
1197
-			$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message , $this->view_id, $this->entry );
1197
+			$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message, $this->view_id, $this->entry );
1198 1198
 
1199 1199
 			echo GVCommon::generate_notice( $message );
1200 1200
 		} else {
@@ -1206,23 +1206,23 @@  discard block
 block discarded – undo
1206 1206
 
1207 1207
 				case '0':
1208 1208
 					$redirect_url = $back_link;
1209
-					$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gk-gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1209
+					$entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gk-gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' );
1210 1210
 					break;
1211 1211
 
1212 1212
 				case '1':
1213 1213
 					$redirect_url = $directory_link = GravityView_API::directory_link();
1214
-					$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.','gk-gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1214
+					$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.', 'gk-gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1215 1215
 					break;
1216 1216
 
1217 1217
 				case '2':
1218 1218
 					$redirect_url = $edit_redirect_url;
1219 1219
 					$redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1220
-					$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.','gk-gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1220
+					$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.', 'gk-gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1221 1221
 					break;
1222 1222
 
1223 1223
 				case '':
1224 1224
 				default:
1225
-					$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gk-gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1225
+					$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gk-gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' );
1226 1226
 					break;
1227 1227
 			}
1228 1228
 
@@ -1263,8 +1263,8 @@  discard block
 block discarded – undo
1263 1263
 		 */
1264 1264
 		do_action( 'gravityview/edit-entry/render/before', $this );
1265 1265
 
1266
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1267
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1266
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1267
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1268 1268
 		add_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1269 1269
 		add_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
1270 1270
 		add_filter( 'gform_disable_view_counter', '__return_true' );
@@ -1273,14 +1273,14 @@  discard block
 block discarded – undo
1273 1273
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1274 1274
 
1275 1275
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1276
-		unset( $_GET['page'] );
1276
+		unset( $_GET[ 'page' ] );
1277 1277
 
1278 1278
 		$this->show_next_button = false;
1279 1279
 		$this->show_previous_button = false;
1280 1280
 
1281 1281
 		// TODO: Verify multiple-page forms
1282 1282
 		if ( GFCommon::has_pages( $this->form ) && apply_filters( 'gravityview/features/paged-edit', false ) ) {
1283
-			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form['id'], 0 ) ) ) {
1283
+			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form[ 'id' ], 0 ) ) ) {
1284 1284
 
1285 1285
 				$labels = array(
1286 1286
 					'cancel'   => __( 'Cancel', 'gk-gravityview' ),
@@ -1299,20 +1299,20 @@  discard block
 block discarded – undo
1299 1299
 				*/
1300 1300
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1301 1301
 
1302
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
1303
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'is_valid' ] = true;
1302
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'form' ] = $this->form;
1303
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'is_valid' ] = true;
1304 1304
 
1305
-				if ( \GV\Utils::_POST( 'save' ) === $labels['next'] ) {
1305
+				if ( \GV\Utils::_POST( 'save' ) === $labels[ 'next' ] ) {
1306 1306
 					$last_page = \GFFormDisplay::get_max_page_number( $this->form );
1307 1307
 
1308 1308
 					while ( ++$page_number < $last_page && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1309 1309
 					} // Advance to next visible page
1310
-				} elseif ( \GV\Utils::_POST( 'save' ) === $labels['previous'] ) {
1310
+				} elseif ( \GV\Utils::_POST( 'save' ) === $labels[ 'previous' ] ) {
1311 1311
 					while ( --$page_number > 1 && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1312 1312
 					} // Advance to next visible page
1313 1313
 				}
1314 1314
 
1315
-				GFFormDisplay::$submission[ $this->form['id'] ]['page_number'] = $page_number;
1315
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'page_number' ] = $page_number;
1316 1316
 			}
1317 1317
 
1318 1318
 			if ( ( $page_number = intval( $page_number ) ) < 2 ) {
@@ -1338,7 +1338,7 @@  discard block
 block discarded – undo
1338 1338
 
1339 1339
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1340 1340
 
1341
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1341
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1342 1342
 
1343 1343
 		ob_get_clean();
1344 1344
 
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 	 * @return string
1367 1367
 	 */
1368 1368
 	public function render_form_buttons() {
1369
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1369
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1370 1370
 	}
1371 1371
 
1372 1372
 
@@ -1385,15 +1385,15 @@  discard block
 block discarded – undo
1385 1385
 	 */
1386 1386
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1387 1387
 
1388
-		if( $form['id'] != $this->form_id ) {
1388
+		if ( $form[ 'id' ] != $this->form_id ) {
1389 1389
 			return $form;
1390 1390
 		}
1391 1391
 
1392 1392
 		// In case we have validated the form, use it to inject the validation results into the form render
1393
-		if( isset( $this->form_after_validation ) && $this->form_after_validation['id'] === $form['id'] ) {
1393
+		if ( isset( $this->form_after_validation ) && $this->form_after_validation[ 'id' ] === $form[ 'id' ] ) {
1394 1394
 			$form = $this->form_after_validation;
1395 1395
 		} else {
1396
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1396
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1397 1397
 		}
1398 1398
 
1399 1399
 		$form = $this->filter_conditional_logic( $form );
@@ -1401,8 +1401,8 @@  discard block
 block discarded – undo
1401 1401
 		$form = $this->prefill_conditional_logic( $form );
1402 1402
 
1403 1403
 		// for now we don't support Save and Continue feature.
1404
-		if( ! self::$supports_save_and_continue ) {
1405
-	        unset( $form['save'] );
1404
+		if ( ! self::$supports_save_and_continue ) {
1405
+	        unset( $form[ 'save' ] );
1406 1406
 		}
1407 1407
 
1408 1408
 		$form = $this->unselect_default_values( $form );
@@ -1425,29 +1425,29 @@  discard block
 block discarded – undo
1425 1425
 	 */
1426 1426
 	public function verify_user_can_edit_post( $field_content = '', $field = null, $value = '', $lead_id = 0, $form_id = 0 ) {
1427 1427
 
1428
-		if( ! GFCommon::is_post_field( $field ) ) {
1428
+		if ( ! GFCommon::is_post_field( $field ) ) {
1429 1429
 			return $field_content;
1430 1430
 		}
1431 1431
 
1432 1432
         $message = null;
1433 1433
 
1434 1434
         // First, make sure they have the capability to edit the post.
1435
-		if( null === get_post( $this->entry['post_id'] ) ) {
1435
+		if ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1436 1436
             /**
1437 1437
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1438 1438
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1439 1439
              */
1440
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gk-gravityview' ) );
1441
-        } elseif( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1440
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gk-gravityview' ) );
1441
+        } elseif ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1442 1442
 			/**
1443 1443
 			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1444 1444
 			 * @param string $message The existing "You don't have permission..." text
1445 1445
 			 */
1446
-			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gk-gravityview') );
1446
+			$message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gk-gravityview' ) );
1447 1447
 		}
1448 1448
 
1449
-        if( $message ) {
1450
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1449
+        if ( $message ) {
1450
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1451 1451
         }
1452 1452
 
1453 1453
         return $field_content;
@@ -1471,8 +1471,8 @@  discard block
 block discarded – undo
1471 1471
 
1472 1472
 		// If the form has been submitted, then we don't need to pre-fill the values,
1473 1473
 		// Except for fileupload type and when a field input is overridden- run always!!
1474
-		if(
1475
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1474
+		if (
1475
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1476 1476
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1477 1477
 			&& ! GFCommon::is_product_field( $field->type )
1478 1478
 			|| ! empty( $field_content )
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
 	    $return = null;
1493 1493
 
1494 1494
 		/** @var GravityView_Field $gv_field */
1495
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1495
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1496 1496
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1497 1497
 		} else {
1498 1498
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
 	    // If there was output, it's an error
1502 1502
 	    $warnings = ob_get_clean();
1503 1503
 
1504
-	    if( !empty( $warnings ) ) {
1504
+	    if ( ! empty( $warnings ) ) {
1505 1505
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1506 1506
 	    }
1507 1507
 
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1527 1527
 
1528 1528
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1529
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1529
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1530 1530
 
1531 1531
 			$field_value = array();
1532 1532
 
@@ -1535,10 +1535,10 @@  discard block
 block discarded – undo
1535 1535
 
1536 1536
 			foreach ( (array)$field->inputs as $input ) {
1537 1537
 
1538
-				$input_id = strval( $input['id'] );
1538
+				$input_id = strval( $input[ 'id' ] );
1539 1539
 
1540 1540
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1541
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1541
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1542 1542
 				    $allow_pre_populated = false;
1543 1543
 				}
1544 1544
 
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 
1547 1547
 			$pre_value = $field->get_value_submission( array(), false );
1548 1548
 
1549
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1549
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1550 1550
 
1551 1551
 		} else {
1552 1552
 
@@ -1557,13 +1557,13 @@  discard block
 block discarded – undo
1557 1557
 
1558 1558
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1559 1559
 			// or pre-populated value if not empty and set to override saved value
1560
-			$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;
1560
+			$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;
1561 1561
 
1562 1562
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1563
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1563
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1564 1564
 				$categories = array();
1565 1565
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1566
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1566
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1567 1567
 				}
1568 1568
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1569 1569
 			}
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
 	     * @param GF_Field $field Gravity Forms field object
1592 1592
 	     * @param GravityView_Edit_Entry_Render $this Current object
1593 1593
 	     */
1594
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1594
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1595 1595
 
1596 1596
 		return $field_value;
1597 1597
 	}
@@ -1608,12 +1608,12 @@  discard block
 block discarded – undo
1608 1608
 	 */
1609 1609
 	public function gform_pre_validation( $form ) {
1610 1610
 
1611
-		if( ! $this->verify_nonce() ) {
1611
+		if ( ! $this->verify_nonce() ) {
1612 1612
 			return $form;
1613 1613
 		}
1614 1614
 
1615 1615
 		// Fix PHP warning regarding undefined index.
1616
-		foreach ( $form['fields'] as &$field) {
1616
+		foreach ( $form[ 'fields' ] as &$field ) {
1617 1617
 
1618 1618
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1619 1619
 			// expects certain field array items to be set.
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1622 1622
 			}
1623 1623
 
1624
-			switch( RGFormsModel::get_input_type( $field ) ) {
1624
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1625 1625
 
1626 1626
 				/**
1627 1627
 				 * 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.
@@ -1635,26 +1635,26 @@  discard block
 block discarded – undo
1635 1635
 				    // Set the previous value
1636 1636
 				    $entry = $this->get_entry();
1637 1637
 
1638
-				    $input_name = 'input_'.$field->id;
1639
-				    $form_id = $form['id'];
1638
+				    $input_name = 'input_' . $field->id;
1639
+				    $form_id = $form[ 'id' ];
1640 1640
 
1641 1641
 				    $value = NULL;
1642 1642
 
1643 1643
 				    // Use the previous entry value as the default.
1644
-				    if( isset( $entry[ $field->id ] ) ) {
1644
+				    if ( isset( $entry[ $field->id ] ) ) {
1645 1645
 				        $value = $entry[ $field->id ];
1646 1646
 				    }
1647 1647
 
1648 1648
 				    // If this is a single upload file
1649
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1650
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1651
-				        $value = $file_path['url'];
1649
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1650
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1651
+				        $value = $file_path[ 'url' ];
1652 1652
 
1653 1653
 				    } else {
1654 1654
 
1655 1655
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1656 1656
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1657
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1657
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1658 1658
 
1659 1659
 				    }
1660 1660
 
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
 						if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1665 1665
 							$value = empty( $value ) ? '[]' : $value;
1666 1666
 							$value = stripslashes_deep( $value );
1667
-							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array() );
1667
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1668 1668
 						} else if ( GFCommon::is_json( $value ) ) {
1669 1669
 							// Existing file; let GF derive the value from the `$_gf_uploaded_files` object (see `\GF_Field_FileUpload::get_multifile_value()`)
1670 1670
 							global $_gf_uploaded_files;
@@ -1684,8 +1684,8 @@  discard block
 block discarded – undo
1684 1684
 
1685 1685
 				case 'number':
1686 1686
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1687
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1688
-				        $_POST['input_'.$field->id ] = NULL;
1687
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1688
+				        $_POST[ 'input_' . $field->id ] = NULL;
1689 1689
 				    }
1690 1690
 				    break;
1691 1691
 			}
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
 		 * You can enter whatever you want!
1723 1723
 		 * We try validating, and customize the results using `self::custom_validation()`
1724 1724
 		 */
1725
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1725
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1726 1726
 
1727 1727
 		// Needed by the validate funtion
1728 1728
 		$failed_validation_page = NULL;
@@ -1730,14 +1730,14 @@  discard block
 block discarded – undo
1730 1730
 
1731 1731
 		// Prevent entry limit from running when editing an entry, also
1732 1732
 		// prevent form scheduling from preventing editing
1733
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1733
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1734 1734
 
1735 1735
 		// Hide fields depending on Edit Entry settings
1736
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1736
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1737 1737
 
1738 1738
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1739 1739
 
1740
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1740
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1741 1741
 	}
1742 1742
 
1743 1743
 
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
 
1766 1766
 		$gv_valid = true;
1767 1767
 
1768
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1768
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1769 1769
 			$value             = RGFormsModel::get_field_value( $field );
1770 1770
 			$field_type        = RGFormsModel::get_input_type( $field );
1771 1771
 			$is_required       = ! empty( $field->isRequired );
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 
1774 1774
 			// Manually validate required fields as they can be skipped be skipped by GF's validation
1775 1775
 			// This can happen when the field is considered "hidden" (see `GFFormDisplay::validate`) due to unmet conditional logic
1776
-			if ( $is_required && !$failed_validation && rgblank( $value ) ) {
1776
+			if ( $is_required && ! $failed_validation && rgblank( $value ) ) {
1777 1777
 				$field->failed_validation  = true;
1778 1778
 				$field->validation_message = esc_html__( 'This field is required.', 'gk-gravityview' );
1779 1779
 
@@ -1797,7 +1797,7 @@  discard block
 block discarded – undo
1797 1797
 					if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1798 1798
 						$input_name = 'input_' . $field->id;
1799 1799
 						//uploaded
1800
-						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1800
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1801 1801
 
1802 1802
 						//existent
1803 1803
 						$entry = $this->get_entry();
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
 							$gv_valid                  = false;
1817 1817
 
1818 1818
 							// in case of error make sure the newest upload files are removed from the upload input
1819
-							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1819
+							GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1820 1820
 						}
1821 1821
 					}
1822 1822
 
@@ -1824,7 +1824,7 @@  discard block
 block discarded – undo
1824 1824
 			}
1825 1825
 
1826 1826
 			// This field has failed validation.
1827
-			if( !empty( $field->failed_validation ) ) {
1827
+			if ( ! empty( $field->failed_validation ) ) {
1828 1828
 
1829 1829
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1830 1830
 
@@ -1842,19 +1842,19 @@  discard block
 block discarded – undo
1842 1842
 				}
1843 1843
 
1844 1844
 				// You can't continue inside a switch, so we do it after.
1845
-				if( empty( $field->failed_validation ) ) {
1845
+				if ( empty( $field->failed_validation ) ) {
1846 1846
 				    continue;
1847 1847
 				}
1848 1848
 
1849 1849
 				// checks if the No Duplicates option is not validating entry against itself, since
1850 1850
 				// we're editing a stored entry, it would also assume it's a duplicate.
1851
-				if( !empty( $field->noDuplicates ) ) {
1851
+				if ( ! empty( $field->noDuplicates ) ) {
1852 1852
 
1853 1853
 				    $entry = $this->get_entry();
1854 1854
 
1855 1855
 				    // If the value of the entry is the same as the stored value
1856 1856
 				    // Then we can assume it's not a duplicate, it's the same.
1857
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1857
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1858 1858
 				        //if value submitted was not changed, then don't validate
1859 1859
 				        $field->failed_validation = false;
1860 1860
 
@@ -1867,7 +1867,7 @@  discard block
 block discarded – undo
1867 1867
 				}
1868 1868
 
1869 1869
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1870
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1870
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1871 1871
 				    unset( $field->validation_message );
1872 1872
 					$field->failed_validation = false;
1873 1873
 				    continue;
@@ -1879,12 +1879,12 @@  discard block
 block discarded – undo
1879 1879
 
1880 1880
 		}
1881 1881
 
1882
-		$validation_results['is_valid'] = $gv_valid;
1882
+		$validation_results[ 'is_valid' ] = $gv_valid;
1883 1883
 
1884 1884
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1885 1885
 
1886 1886
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1887
-		$this->form_after_validation = $validation_results['form'];
1887
+		$this->form_after_validation = $validation_results[ 'form' ];
1888 1888
 
1889 1889
 		return $validation_results;
1890 1890
 	}
@@ -1897,7 +1897,7 @@  discard block
 block discarded – undo
1897 1897
 	 */
1898 1898
 	public function get_entry() {
1899 1899
 
1900
-		if( empty( $this->entry ) ) {
1900
+		if ( empty( $this->entry ) ) {
1901 1901
 			// Get the database value of the entry that's being edited
1902 1902
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1903 1903
 		}
@@ -1929,10 +1929,10 @@  discard block
 block discarded – undo
1929 1929
 		}
1930 1930
 
1931 1931
 		// If edit tab not yet configured, show all fields
1932
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1932
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1933 1933
 
1934 1934
 		// Hide fields depending on admin settings
1935
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1935
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1936 1936
 
1937 1937
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1938 1938
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1965,7 +1965,7 @@  discard block
 block discarded – undo
1965 1965
 	 */
1966 1966
 	private function filter_fields( $fields, $configured_fields ) {
1967 1967
 
1968
-		if( empty( $fields ) || !is_array( $fields ) ) {
1968
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1969 1969
 			return $fields;
1970 1970
 		}
1971 1971
 
@@ -1982,12 +1982,12 @@  discard block
 block discarded – undo
1982 1982
 
1983 1983
 			// Remove the fields that have calculation properties and keep them to be used later
1984 1984
 			// @since 1.16.2
1985
-			if( $field->has_calculation() ) {
1986
-				$this->fields_with_calculation[] = $field;
1985
+			if ( $field->has_calculation() ) {
1986
+				$this->fields_with_calculation[ ] = $field;
1987 1987
 				// don't remove the calculation fields on form render.
1988 1988
 			}
1989 1989
 
1990
-			if( in_array( $field->type, $field_type_blocklist ) ) {
1990
+			if ( in_array( $field->type, $field_type_blocklist ) ) {
1991 1991
 				unset( $fields[ $key ] );
1992 1992
 			}
1993 1993
 		}
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 					continue; // Never include when no fields are configured
2018 2018
 				}
2019 2019
 
2020
-				$out_fields[] = $field;
2020
+				$out_fields[ ] = $field;
2021 2021
 			}
2022 2022
 
2023 2023
 			return array_values( $out_fields );
@@ -2028,8 +2028,8 @@  discard block
 block discarded – undo
2028 2028
 
2029 2029
 	        /** @var GF_Field $field */
2030 2030
 	        foreach ( $fields as $field ) {
2031
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2032
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2031
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2032
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
2033 2033
 				    break;
2034 2034
 				}
2035 2035
 
@@ -2052,14 +2052,14 @@  discard block
 block discarded – undo
2052 2052
 
2053 2053
 		$return_field = $field;
2054 2054
 
2055
-		if( empty( $field_setting['show_label'] ) ) {
2055
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
2056 2056
 			$return_field->label = '';
2057
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
2058
-			$return_field->label = $field_setting['custom_label'];
2057
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
2058
+			$return_field->label = $field_setting[ 'custom_label' ];
2059 2059
 		}
2060 2060
 
2061
-		if( !empty( $field_setting['custom_class'] ) ) {
2062
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
2061
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
2062
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
2063 2063
 		}
2064 2064
 
2065 2065
 		/**
@@ -2097,16 +2097,16 @@  discard block
 block discarded – undo
2097 2097
 	     */
2098 2098
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2099 2099
 
2100
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2101
-			foreach( $fields as $k => $field ) {
2102
-				if( $field->adminOnly ) {
2100
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
2101
+			foreach ( $fields as $k => $field ) {
2102
+				if ( $field->adminOnly ) {
2103 2103
 				    unset( $fields[ $k ] );
2104 2104
 				}
2105 2105
 			}
2106 2106
 			return array_values( $fields );
2107 2107
 		}
2108 2108
 
2109
-	    foreach( $fields as &$field ) {
2109
+	    foreach ( $fields as &$field ) {
2110 2110
 		    $field->adminOnly = false;
2111 2111
 		}
2112 2112
 
@@ -2127,7 +2127,7 @@  discard block
 block discarded – undo
2127 2127
 	 */
2128 2128
 	private function unselect_default_values( $form ) {
2129 2129
 
2130
-	    foreach ( $form['fields'] as &$field ) {
2130
+	    foreach ( $form[ 'fields' ] as &$field ) {
2131 2131
 
2132 2132
 			if ( empty( $field->choices ) ) {
2133 2133
                 continue;
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
 
2136 2136
             foreach ( $field->choices as &$choice ) {
2137 2137
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2138
-					$choice['isSelected'] = false;
2138
+					$choice[ 'isSelected' ] = false;
2139 2139
 				}
2140 2140
 			}
2141 2141
 		}
@@ -2160,22 +2160,22 @@  discard block
 block discarded – undo
2160 2160
 	 */
2161 2161
 	function prefill_conditional_logic( $form ) {
2162 2162
 
2163
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2163
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2164 2164
 			return $form;
2165 2165
 		}
2166 2166
 
2167 2167
 		// Have Conditional Logic pre-fill fields as if the data were default values
2168 2168
 		/** @var GF_Field $field */
2169
-		foreach ( $form['fields'] as &$field ) {
2169
+		foreach ( $form[ 'fields' ] as &$field ) {
2170 2170
 
2171
-			if( 'checkbox' === $field->type ) {
2171
+			if ( 'checkbox' === $field->type ) {
2172 2172
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2173
-				    $input_id = $input['id'];
2173
+				    $input_id = $input[ 'id' ];
2174 2174
 				    $choice = $field->choices[ $key ];
2175 2175
 				    $value = \GV\Utils::get( $this->entry, $input_id );
2176 2176
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2177
-				    if( $match ) {
2178
-				        $field->choices[ $key ]['isSelected'] = true;
2177
+				    if ( $match ) {
2178
+				        $field->choices[ $key ][ 'isSelected' ] = true;
2179 2179
 				    }
2180 2180
 				}
2181 2181
 			} else {
@@ -2183,15 +2183,15 @@  discard block
 block discarded – undo
2183 2183
 				// We need to run through each field to set the default values
2184 2184
 				foreach ( $this->entry as $field_id => $field_value ) {
2185 2185
 
2186
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2186
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
2187 2187
 
2188
-				        if( 'list' === $field->type ) {
2188
+				        if ( 'list' === $field->type ) {
2189 2189
 				            $list_rows = maybe_unserialize( $field_value );
2190 2190
 
2191 2191
 				            $list_field_value = array();
2192
-				            foreach ( (array) $list_rows as $row ) {
2193
-				                foreach ( (array) $row as $column ) {
2194
-				                    $list_field_value[] = $column;
2192
+				            foreach ( (array)$list_rows as $row ) {
2193
+				                foreach ( (array)$row as $column ) {
2194
+				                    $list_field_value[ ] = $column;
2195 2195
 				                }
2196 2196
 				            }
2197 2197
 
@@ -2224,32 +2224,32 @@  discard block
 block discarded – undo
2224 2224
 		 * @see https://github.com/gravityview/GravityView/issues/840
2225 2225
 		 * @since develop
2226 2226
 		 */
2227
-		$the_form = GFAPI::get_form( $form['id'] );
2227
+		$the_form = GFAPI::get_form( $form[ 'id' ] );
2228 2228
 		$editable_ids = array();
2229
-		foreach ( $form['fields'] as $field ) {
2230
-			$editable_ids[] = $field['id']; // wp_list_pluck is destructive in this context
2229
+		foreach ( $form[ 'fields' ] as $field ) {
2230
+			$editable_ids[ ] = $field[ 'id' ]; // wp_list_pluck is destructive in this context
2231 2231
 		}
2232 2232
 		$remove_conditions_rule = array();
2233
-		foreach ( $the_form['fields'] as $field ) {
2234
-			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic['rules'] ) ) {
2235
-				foreach ( $field->conditionalLogic['rules'] as $i => $rule ) {
2236
-					if ( ! in_array( $rule['fieldId'], $editable_ids ) ) {
2233
+		foreach ( $the_form[ 'fields' ] as $field ) {
2234
+			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic[ 'rules' ] ) ) {
2235
+				foreach ( $field->conditionalLogic[ 'rules' ] as $i => $rule ) {
2236
+					if ( ! in_array( $rule[ 'fieldId' ], $editable_ids ) ) {
2237 2237
 						/**
2238 2238
 						 * This conditional field is not editable in this View.
2239 2239
 						 * We need to remove the rule, but only if it matches.
2240 2240
 						 */
2241
-						if ( $_field = GFAPI::get_field( $the_form, $rule['fieldId'] ) ) {
2241
+						if ( $_field = GFAPI::get_field( $the_form, $rule[ 'fieldId' ] ) ) {
2242 2242
 							$value = $_field->get_value_export( $this->entry );
2243
-						} elseif ( isset( $this->entry[ $rule['fieldId'] ] ) ) {
2244
-							$value = $this->entry[ $rule['fieldId'] ];
2243
+						} elseif ( isset( $this->entry[ $rule[ 'fieldId' ] ] ) ) {
2244
+							$value = $this->entry[ $rule[ 'fieldId' ] ];
2245 2245
 						} else {
2246
-							$value = gform_get_meta( $this->entry['id'], $rule['fieldId'] );
2246
+							$value = gform_get_meta( $this->entry[ 'id' ], $rule[ 'fieldId' ] );
2247 2247
 						}
2248 2248
 
2249
-						$match = GFFormsModel::matches_operation( $value, $rule['value'], $rule['operator'] );
2249
+						$match = GFFormsModel::matches_operation( $value, $rule[ 'value' ], $rule[ 'operator' ] );
2250 2250
 
2251 2251
 						if ( $match ) {
2252
-							$remove_conditions_rule[] = array( $field['id'], $i );
2252
+							$remove_conditions_rule[ ] = array( $field[ 'id' ], $i );
2253 2253
 						}
2254 2254
 					}
2255 2255
 				}
@@ -2257,21 +2257,21 @@  discard block
 block discarded – undo
2257 2257
 		}
2258 2258
 
2259 2259
 		if ( $remove_conditions_rule ) {
2260
-			foreach ( $form['fields'] as &$field ) {
2260
+			foreach ( $form[ 'fields' ] as &$field ) {
2261 2261
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2262 2262
 
2263 2263
 				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2264 2264
 
2265
-					if ( $field['id'] == $rule_field_id ) {
2266
-						unset( $field->conditionalLogic['rules'][ $rule_i ] );
2267
-						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field['id'] ) );
2265
+					if ( $field[ 'id' ] == $rule_field_id ) {
2266
+						unset( $field->conditionalLogic[ 'rules' ][ $rule_i ] );
2267
+						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field[ 'id' ] ) );
2268 2268
 					}
2269 2269
 				}
2270 2270
 			}
2271 2271
 		}
2272 2272
 
2273 2273
 		/** Normalize the indices... */
2274
-		$form['fields'] = array_values( $form['fields'] );
2274
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
2275 2275
 
2276 2276
 		/**
2277 2277
 		 * @filter `gravityview/edit_entry/conditional_logic` Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields?
@@ -2281,16 +2281,16 @@  discard block
 block discarded – undo
2281 2281
 		 */
2282 2282
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
2283 2283
 
2284
-		if( $use_conditional_logic ) {
2284
+		if ( $use_conditional_logic ) {
2285 2285
 			return $form;
2286 2286
 		}
2287 2287
 
2288
-		foreach( $form['fields'] as &$field ) {
2288
+		foreach ( $form[ 'fields' ] as &$field ) {
2289 2289
 			/* @var GF_Field $field */
2290 2290
 			$field->conditionalLogic = null;
2291 2291
 		}
2292 2292
 
2293
-		unset( $form['button']['conditionalLogic'] );
2293
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
2294 2294
 
2295 2295
 		return $form;
2296 2296
 
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
 	 */
2308 2308
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
2309 2309
 
2310
-		if( ! $this->is_edit_entry() ) {
2310
+		if ( ! $this->is_edit_entry() ) {
2311 2311
 			return $has_conditional_logic;
2312 2312
 		}
2313 2313
 
@@ -2339,44 +2339,44 @@  discard block
 block discarded – undo
2339 2339
 		 *  2. There are two entries embedded using oEmbed
2340 2340
 		 *  3. One of the entries has just been saved
2341 2341
 		 */
2342
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
2342
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
2343 2343
 
2344 2344
 			$error = true;
2345 2345
 
2346 2346
 		}
2347 2347
 
2348
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
2348
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
2349 2349
 
2350 2350
 			$error = true;
2351 2351
 
2352
-		} elseif( ! $this->verify_nonce() ) {
2352
+		} elseif ( ! $this->verify_nonce() ) {
2353 2353
 
2354 2354
 			/**
2355 2355
 			 * If the Entry is embedded, there may be two entries on the same page.
2356 2356
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
2357 2357
 			 */
2358
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2358
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2359 2359
 				$error = true;
2360 2360
 			} else {
2361
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gk-gravityview');
2361
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gk-gravityview' );
2362 2362
 			}
2363 2363
 
2364 2364
 		}
2365 2365
 
2366
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view ) ) {
2367
-			$error = __( 'You do not have permission to edit this entry.', 'gk-gravityview');
2366
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view ) ) {
2367
+			$error = __( 'You do not have permission to edit this entry.', 'gk-gravityview' );
2368 2368
 		}
2369 2369
 
2370
-		if( $this->entry['status'] === 'trash' ) {
2371
-			$error = __('You cannot edit the entry; it is in the trash.', 'gk-gravityview' );
2370
+		if ( $this->entry[ 'status' ] === 'trash' ) {
2371
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gk-gravityview' );
2372 2372
 		}
2373 2373
 
2374 2374
 		// No errors; everything's fine here!
2375
-		if( empty( $error ) ) {
2375
+		if ( empty( $error ) ) {
2376 2376
 			return true;
2377 2377
 		}
2378 2378
 
2379
-		if( $echo && $error !== true ) {
2379
+		if ( $echo && $error !== true ) {
2380 2380
 
2381 2381
 	        $error = esc_html( $error );
2382 2382
 
@@ -2384,10 +2384,10 @@  discard block
 block discarded – undo
2384 2384
 	         * @since 1.9
2385 2385
 	         */
2386 2386
 	        if ( ! empty( $this->entry ) ) {
2387
-		        $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gk-gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
2387
+		        $error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gk-gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
2388 2388
 	        }
2389 2389
 
2390
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2390
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
2391 2391
 		}
2392 2392
 
2393 2393
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2407,17 +2407,17 @@  discard block
 block discarded – undo
2407 2407
 
2408 2408
 		$error = NULL;
2409 2409
 
2410
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2411
-			$error = __( 'You do not have permission to edit this field.', 'gk-gravityview');
2410
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2411
+			$error = __( 'You do not have permission to edit this field.', 'gk-gravityview' );
2412 2412
 		}
2413 2413
 
2414 2414
 		// No errors; everything's fine here!
2415
-		if( empty( $error ) ) {
2415
+		if ( empty( $error ) ) {
2416 2416
 			return true;
2417 2417
 		}
2418 2418
 
2419
-		if( $echo ) {
2420
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2419
+		if ( $echo ) {
2420
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2421 2421
 		}
2422 2422
 
2423 2423
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2438,14 +2438,14 @@  discard block
 block discarded – undo
2438 2438
 	private function check_user_cap_edit_field( $field ) {
2439 2439
 
2440 2440
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2441
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2441
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2442 2442
 			return true;
2443 2443
 		}
2444 2444
 
2445
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2445
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2446 2446
 
2447
-		if( $field_cap ) {
2448
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2447
+		if ( $field_cap ) {
2448
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2449 2449
 		}
2450 2450
 
2451 2451
 		return false;
@@ -2459,17 +2459,17 @@  discard block
 block discarded – undo
2459 2459
 	public function verify_nonce() {
2460 2460
 
2461 2461
 		// Verify form submitted for editing single
2462
-		if( $this->is_edit_entry_submission() ) {
2462
+		if ( $this->is_edit_entry_submission() ) {
2463 2463
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2464 2464
 		}
2465 2465
 
2466 2466
 		// Verify
2467
-		else if( ! $this->is_edit_entry() ) {
2467
+		else if ( ! $this->is_edit_entry() ) {
2468 2468
 			$valid = false;
2469 2469
 		}
2470 2470
 
2471 2471
 		else {
2472
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2472
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2473 2473
 		}
2474 2474
 
2475 2475
 		/**
@@ -2529,7 +2529,7 @@  discard block
 block discarded – undo
2529 2529
 		 */
2530 2530
 		$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
2531 2531
 
2532
-		return (array) $labels;
2532
+		return (array)$labels;
2533 2533
 	}
2534 2534
 
2535 2535
 } //end class
Please login to merge, or discard this patch.