Completed
Pull Request — develop (#1664)
by Zack
16:06
created
includes/extensions/edit-entry/class-edit-entry-render.php 1 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,13 +1259,13 @@  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
 		if ( GFCommon::has_pages( $this->form ) && apply_filters( 'gravityview/features/paged-edit', $this->view->settings->get( 'paged_edit', 0 ) ) ) {
1268
-			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form['id'], 0 ) ) ) {
1268
+			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form[ 'id' ], 0 ) ) ) {
1269 1269
 
1270 1270
 				$labels = array(
1271 1271
 					'cancel'   => __( 'Cancel', 'gravityview' ),
@@ -1284,20 +1284,20 @@  discard block
 block discarded – undo
1284 1284
 				*/
1285 1285
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1286 1286
 
1287
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
1288
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'is_valid' ] = true;
1287
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'form' ] = $this->form;
1288
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'is_valid' ] = true;
1289 1289
 
1290
-				if ( \GV\Utils::_POST( 'save' ) === $labels['next'] ) {
1290
+				if ( \GV\Utils::_POST( 'save' ) === $labels[ 'next' ] ) {
1291 1291
 					$last_page = \GFFormDisplay::get_max_page_number( $this->form );
1292 1292
 
1293 1293
 					while ( ++$page_number < $last_page && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1294 1294
 					} // Advance to next visible page
1295
-				} elseif ( \GV\Utils::_POST( 'save' ) === $labels['previous'] ) {
1295
+				} elseif ( \GV\Utils::_POST( 'save' ) === $labels[ 'previous' ] ) {
1296 1296
 					while ( --$page_number > 1 && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1297 1297
 					} // Advance to next visible page
1298 1298
 				}
1299 1299
 
1300
-				GFFormDisplay::$submission[ $this->form['id'] ]['page_number'] = $page_number;
1300
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'page_number' ] = $page_number;
1301 1301
 			}
1302 1302
 
1303 1303
 			if ( ( $page_number = intval( $page_number ) ) < 2 ) {
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
 
1324 1324
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1325 1325
 
1326
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1326
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1327 1327
 
1328 1328
 		ob_get_clean();
1329 1329
 
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 	 * @return string
1352 1352
 	 */
1353 1353
 	public function render_form_buttons() {
1354
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1354
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1355 1355
 	}
1356 1356
 
1357 1357
 
@@ -1370,15 +1370,15 @@  discard block
 block discarded – undo
1370 1370
 	 */
1371 1371
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1372 1372
 
1373
-		if( $form['id'] != $this->form_id ) {
1373
+		if ( $form[ 'id' ] != $this->form_id ) {
1374 1374
 			return $form;
1375 1375
 		}
1376 1376
 
1377 1377
 		// In case we have validated the form, use it to inject the validation results into the form render
1378
-		if( isset( $this->form_after_validation ) && $this->form_after_validation['id'] === $form['id'] ) {
1378
+		if ( isset( $this->form_after_validation ) && $this->form_after_validation[ 'id' ] === $form[ 'id' ] ) {
1379 1379
 			$form = $this->form_after_validation;
1380 1380
 		} else {
1381
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1381
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1382 1382
 		}
1383 1383
 
1384 1384
 		$form = $this->filter_conditional_logic( $form );
@@ -1386,8 +1386,8 @@  discard block
 block discarded – undo
1386 1386
 		$form = $this->prefill_conditional_logic( $form );
1387 1387
 
1388 1388
 		// for now we don't support Save and Continue feature.
1389
-		if( ! self::$supports_save_and_continue ) {
1390
-	        unset( $form['save'] );
1389
+		if ( ! self::$supports_save_and_continue ) {
1390
+	        unset( $form[ 'save' ] );
1391 1391
 		}
1392 1392
 
1393 1393
 		$form = $this->unselect_default_values( $form );
@@ -1410,31 +1410,31 @@  discard block
 block discarded – undo
1410 1410
 	 */
1411 1411
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1412 1412
 
1413
-		if( ! GFCommon::is_post_field( $field ) ) {
1413
+		if ( ! GFCommon::is_post_field( $field ) ) {
1414 1414
 			return $field_content;
1415 1415
 		}
1416 1416
 
1417 1417
         $message = null;
1418 1418
 
1419 1419
         // First, make sure they have the capability to edit the post.
1420
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1420
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1421 1421
 
1422 1422
             /**
1423 1423
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1424 1424
              * @param string $message The existing "You don't have permission..." text
1425 1425
              */
1426
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1426
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1427 1427
 
1428
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1428
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1429 1429
             /**
1430 1430
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1431 1431
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1432 1432
              */
1433
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1433
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1434 1434
         }
1435 1435
 
1436
-        if( $message ) {
1437
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1436
+        if ( $message ) {
1437
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1438 1438
         }
1439 1439
 
1440 1440
         return $field_content;
@@ -1458,8 +1458,8 @@  discard block
 block discarded – undo
1458 1458
 
1459 1459
 		// If the form has been submitted, then we don't need to pre-fill the values,
1460 1460
 		// Except for fileupload type and when a field input is overridden- run always!!
1461
-		if(
1462
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1461
+		if (
1462
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1463 1463
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1464 1464
 			&& ! GFCommon::is_product_field( $field->type )
1465 1465
 			|| ! empty( $field_content )
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
 	    $return = null;
1480 1480
 
1481 1481
 		/** @var GravityView_Field $gv_field */
1482
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1482
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1483 1483
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1484 1484
 		} else {
1485 1485
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
 	    // If there was output, it's an error
1489 1489
 	    $warnings = ob_get_clean();
1490 1490
 
1491
-	    if( !empty( $warnings ) ) {
1491
+	    if ( ! empty( $warnings ) ) {
1492 1492
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1493 1493
 	    }
1494 1494
 
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1514 1514
 
1515 1515
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1516
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1516
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1517 1517
 
1518 1518
 			$field_value = array();
1519 1519
 
@@ -1522,10 +1522,10 @@  discard block
 block discarded – undo
1522 1522
 
1523 1523
 			foreach ( (array)$field->inputs as $input ) {
1524 1524
 
1525
-				$input_id = strval( $input['id'] );
1525
+				$input_id = strval( $input[ 'id' ] );
1526 1526
 
1527 1527
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1528
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1528
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1529 1529
 				    $allow_pre_populated = false;
1530 1530
 				}
1531 1531
 
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 
1534 1534
 			$pre_value = $field->get_value_submission( array(), false );
1535 1535
 
1536
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1536
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1537 1537
 
1538 1538
 		} else {
1539 1539
 
@@ -1544,13 +1544,13 @@  discard block
 block discarded – undo
1544 1544
 
1545 1545
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1546 1546
 			// or pre-populated value if not empty and set to override saved value
1547
-			$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;
1547
+			$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 1548
 
1549 1549
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1550
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1550
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1551 1551
 				$categories = array();
1552 1552
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1553
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1553
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1554 1554
 				}
1555 1555
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1556 1556
 			}
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
 	     * @param GF_Field $field Gravity Forms field object
1579 1579
 	     * @param GravityView_Edit_Entry_Render $this Current object
1580 1580
 	     */
1581
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1581
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1582 1582
 
1583 1583
 		return $field_value;
1584 1584
 	}
@@ -1595,12 +1595,12 @@  discard block
 block discarded – undo
1595 1595
 	 */
1596 1596
 	public function gform_pre_validation( $form ) {
1597 1597
 
1598
-		if( ! $this->verify_nonce() ) {
1598
+		if ( ! $this->verify_nonce() ) {
1599 1599
 			return $form;
1600 1600
 		}
1601 1601
 
1602 1602
 		// Fix PHP warning regarding undefined index.
1603
-		foreach ( $form['fields'] as &$field) {
1603
+		foreach ( $form[ 'fields' ] as &$field ) {
1604 1604
 
1605 1605
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1606 1606
 			// expects certain field array items to be set.
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1609 1609
 			}
1610 1610
 
1611
-			switch( RGFormsModel::get_input_type( $field ) ) {
1611
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1612 1612
 
1613 1613
 				/**
1614 1614
 				 * 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.
@@ -1622,26 +1622,26 @@  discard block
 block discarded – undo
1622 1622
 				    // Set the previous value
1623 1623
 				    $entry = $this->get_entry();
1624 1624
 
1625
-				    $input_name = 'input_'.$field->id;
1626
-				    $form_id = $form['id'];
1625
+				    $input_name = 'input_' . $field->id;
1626
+				    $form_id = $form[ 'id' ];
1627 1627
 
1628 1628
 				    $value = NULL;
1629 1629
 
1630 1630
 				    // Use the previous entry value as the default.
1631
-				    if( isset( $entry[ $field->id ] ) ) {
1631
+				    if ( isset( $entry[ $field->id ] ) ) {
1632 1632
 				        $value = $entry[ $field->id ];
1633 1633
 				    }
1634 1634
 
1635 1635
 				    // If this is a single upload file
1636
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1637
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1638
-				        $value = $file_path['url'];
1636
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1637
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1638
+				        $value = $file_path[ 'url' ];
1639 1639
 
1640 1640
 				    } else {
1641 1641
 
1642 1642
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1643 1643
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1644
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1644
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1645 1645
 
1646 1646
 				    }
1647 1647
 
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 						if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1652 1652
 							$value = empty( $value ) ? '[]' : $value;
1653 1653
 							$value = stripslashes_deep( $value );
1654
-							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array() );
1654
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1655 1655
 						} else if ( GFCommon::is_json( $value ) ) {
1656 1656
 							// Existing file; let GF derive the value from the `$_gf_uploaded_files` object (see `\GF_Field_FileUpload::get_multifile_value()`)
1657 1657
 							global $_gf_uploaded_files;
@@ -1671,8 +1671,8 @@  discard block
 block discarded – undo
1671 1671
 
1672 1672
 				case 'number':
1673 1673
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1674
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1675
-				        $_POST['input_'.$field->id ] = NULL;
1674
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1675
+				        $_POST[ 'input_' . $field->id ] = NULL;
1676 1676
 				    }
1677 1677
 				    break;
1678 1678
 			}
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
 		 * You can enter whatever you want!
1710 1710
 		 * We try validating, and customize the results using `self::custom_validation()`
1711 1711
 		 */
1712
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1712
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1713 1713
 
1714 1714
 		// Needed by the validate funtion
1715 1715
 		$failed_validation_page = NULL;
@@ -1717,14 +1717,14 @@  discard block
 block discarded – undo
1717 1717
 
1718 1718
 		// Prevent entry limit from running when editing an entry, also
1719 1719
 		// prevent form scheduling from preventing editing
1720
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1720
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1721 1721
 
1722 1722
 		// Hide fields depending on Edit Entry settings
1723
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1723
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1724 1724
 
1725 1725
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1726 1726
 
1727
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1727
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1728 1728
 	}
1729 1729
 
1730 1730
 
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 
1753 1753
 		$gv_valid = true;
1754 1754
 
1755
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1755
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1756 1756
 			$value             = RGFormsModel::get_field_value( $field );
1757 1757
 			$field_type        = RGFormsModel::get_input_type( $field );
1758 1758
 			$is_required       = ! empty( $field->isRequired );
@@ -1760,7 +1760,7 @@  discard block
 block discarded – undo
1760 1760
 
1761 1761
 			// Manually validate required fields as they can be skipped be skipped by GF's validation
1762 1762
 			// This can happen when the field is considered "hidden" (see `GFFormDisplay::validate`) due to unmet conditional logic
1763
-			if ( $is_required && !$failed_validation && rgblank( $value ) ) {
1763
+			if ( $is_required && ! $failed_validation && rgblank( $value ) ) {
1764 1764
 				$field->failed_validation  = true;
1765 1765
 				$field->validation_message = esc_html__( 'This field is required.', 'gravityview' );
1766 1766
 
@@ -1784,7 +1784,7 @@  discard block
 block discarded – undo
1784 1784
 					if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1785 1785
 						$input_name = 'input_' . $field->id;
1786 1786
 						//uploaded
1787
-						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1787
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1788 1788
 
1789 1789
 						//existent
1790 1790
 						$entry = $this->get_entry();
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
 							$gv_valid                  = false;
1804 1804
 
1805 1805
 							// in case of error make sure the newest upload files are removed from the upload input
1806
-							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1806
+							GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1807 1807
 						}
1808 1808
 					}
1809 1809
 
@@ -1811,7 +1811,7 @@  discard block
 block discarded – undo
1811 1811
 			}
1812 1812
 
1813 1813
 			// This field has failed validation.
1814
-			if( !empty( $field->failed_validation ) ) {
1814
+			if ( ! empty( $field->failed_validation ) ) {
1815 1815
 
1816 1816
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1817 1817
 
@@ -1829,19 +1829,19 @@  discard block
 block discarded – undo
1829 1829
 				}
1830 1830
 
1831 1831
 				// You can't continue inside a switch, so we do it after.
1832
-				if( empty( $field->failed_validation ) ) {
1832
+				if ( empty( $field->failed_validation ) ) {
1833 1833
 				    continue;
1834 1834
 				}
1835 1835
 
1836 1836
 				// checks if the No Duplicates option is not validating entry against itself, since
1837 1837
 				// we're editing a stored entry, it would also assume it's a duplicate.
1838
-				if( !empty( $field->noDuplicates ) ) {
1838
+				if ( ! empty( $field->noDuplicates ) ) {
1839 1839
 
1840 1840
 				    $entry = $this->get_entry();
1841 1841
 
1842 1842
 				    // If the value of the entry is the same as the stored value
1843 1843
 				    // Then we can assume it's not a duplicate, it's the same.
1844
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1844
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1845 1845
 				        //if value submitted was not changed, then don't validate
1846 1846
 				        $field->failed_validation = false;
1847 1847
 
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
 				}
1855 1855
 
1856 1856
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1857
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1857
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1858 1858
 				    unset( $field->validation_message );
1859 1859
 					$field->failed_validation = false;
1860 1860
 				    continue;
@@ -1866,12 +1866,12 @@  discard block
 block discarded – undo
1866 1866
 
1867 1867
 		}
1868 1868
 
1869
-		$validation_results['is_valid'] = $gv_valid;
1869
+		$validation_results[ 'is_valid' ] = $gv_valid;
1870 1870
 
1871 1871
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1872 1872
 
1873 1873
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1874
-		$this->form_after_validation = $validation_results['form'];
1874
+		$this->form_after_validation = $validation_results[ 'form' ];
1875 1875
 
1876 1876
 		return $validation_results;
1877 1877
 	}
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 	 */
1885 1885
 	public function get_entry() {
1886 1886
 
1887
-		if( empty( $this->entry ) ) {
1887
+		if ( empty( $this->entry ) ) {
1888 1888
 			// Get the database value of the entry that's being edited
1889 1889
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1890 1890
 		}
@@ -1916,10 +1916,10 @@  discard block
 block discarded – undo
1916 1916
 		}
1917 1917
 
1918 1918
 		// If edit tab not yet configured, show all fields
1919
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1919
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1920 1920
 
1921 1921
 		// Hide fields depending on admin settings
1922
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1922
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1923 1923
 
1924 1924
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1925 1925
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1952,7 +1952,7 @@  discard block
 block discarded – undo
1952 1952
 	 */
1953 1953
 	private function filter_fields( $fields, $configured_fields ) {
1954 1954
 
1955
-		if( empty( $fields ) || !is_array( $fields ) ) {
1955
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1956 1956
 			return $fields;
1957 1957
 		}
1958 1958
 
@@ -1969,12 +1969,12 @@  discard block
 block discarded – undo
1969 1969
 
1970 1970
 			// Remove the fields that have calculation properties and keep them to be used later
1971 1971
 			// @since 1.16.2
1972
-			if( $field->has_calculation() ) {
1973
-				$this->fields_with_calculation[] = $field;
1972
+			if ( $field->has_calculation() ) {
1973
+				$this->fields_with_calculation[ ] = $field;
1974 1974
 				// don't remove the calculation fields on form render.
1975 1975
 			}
1976 1976
 
1977
-			if( in_array( $field->type, $field_type_blocklist ) ) {
1977
+			if ( in_array( $field->type, $field_type_blocklist ) ) {
1978 1978
 				unset( $fields[ $key ] );
1979 1979
 			}
1980 1980
 		}
@@ -2004,7 +2004,7 @@  discard block
 block discarded – undo
2004 2004
 					continue; // Never include when no fields are configured
2005 2005
 				}
2006 2006
 
2007
-				$out_fields[] = $field;
2007
+				$out_fields[ ] = $field;
2008 2008
 			}
2009 2009
 
2010 2010
 			return array_values( $out_fields );
@@ -2015,8 +2015,8 @@  discard block
 block discarded – undo
2015 2015
 
2016 2016
 	        /** @var GF_Field $field */
2017 2017
 	        foreach ( $fields as $field ) {
2018
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2019
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2018
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2019
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
2020 2020
 				    break;
2021 2021
 				}
2022 2022
 
@@ -2039,14 +2039,14 @@  discard block
 block discarded – undo
2039 2039
 
2040 2040
 		$return_field = $field;
2041 2041
 
2042
-		if( empty( $field_setting['show_label'] ) ) {
2042
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
2043 2043
 			$return_field->label = '';
2044
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
2045
-			$return_field->label = $field_setting['custom_label'];
2044
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
2045
+			$return_field->label = $field_setting[ 'custom_label' ];
2046 2046
 		}
2047 2047
 
2048
-		if( !empty( $field_setting['custom_class'] ) ) {
2049
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
2048
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
2049
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
2050 2050
 		}
2051 2051
 
2052 2052
 		/**
@@ -2084,16 +2084,16 @@  discard block
 block discarded – undo
2084 2084
 	     */
2085 2085
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2086 2086
 
2087
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2088
-			foreach( $fields as $k => $field ) {
2089
-				if( $field->adminOnly ) {
2087
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
2088
+			foreach ( $fields as $k => $field ) {
2089
+				if ( $field->adminOnly ) {
2090 2090
 				    unset( $fields[ $k ] );
2091 2091
 				}
2092 2092
 			}
2093 2093
 			return array_values( $fields );
2094 2094
 		}
2095 2095
 
2096
-	    foreach( $fields as &$field ) {
2096
+	    foreach ( $fields as &$field ) {
2097 2097
 		    $field->adminOnly = false;
2098 2098
 		}
2099 2099
 
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
 	 */
2115 2115
 	private function unselect_default_values( $form ) {
2116 2116
 
2117
-	    foreach ( $form['fields'] as &$field ) {
2117
+	    foreach ( $form[ 'fields' ] as &$field ) {
2118 2118
 
2119 2119
 			if ( empty( $field->choices ) ) {
2120 2120
                 continue;
@@ -2122,7 +2122,7 @@  discard block
 block discarded – undo
2122 2122
 
2123 2123
             foreach ( $field->choices as &$choice ) {
2124 2124
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2125
-					$choice['isSelected'] = false;
2125
+					$choice[ 'isSelected' ] = false;
2126 2126
 				}
2127 2127
 			}
2128 2128
 		}
@@ -2147,22 +2147,22 @@  discard block
 block discarded – undo
2147 2147
 	 */
2148 2148
 	function prefill_conditional_logic( $form ) {
2149 2149
 
2150
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2150
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2151 2151
 			return $form;
2152 2152
 		}
2153 2153
 
2154 2154
 		// Have Conditional Logic pre-fill fields as if the data were default values
2155 2155
 		/** @var GF_Field $field */
2156
-		foreach ( $form['fields'] as &$field ) {
2156
+		foreach ( $form[ 'fields' ] as &$field ) {
2157 2157
 
2158
-			if( 'checkbox' === $field->type ) {
2158
+			if ( 'checkbox' === $field->type ) {
2159 2159
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2160
-				    $input_id = $input['id'];
2160
+				    $input_id = $input[ 'id' ];
2161 2161
 				    $choice = $field->choices[ $key ];
2162 2162
 				    $value = \GV\Utils::get( $this->entry, $input_id );
2163 2163
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2164
-				    if( $match ) {
2165
-				        $field->choices[ $key ]['isSelected'] = true;
2164
+				    if ( $match ) {
2165
+				        $field->choices[ $key ][ 'isSelected' ] = true;
2166 2166
 				    }
2167 2167
 				}
2168 2168
 			} else {
@@ -2170,15 +2170,15 @@  discard block
 block discarded – undo
2170 2170
 				// We need to run through each field to set the default values
2171 2171
 				foreach ( $this->entry as $field_id => $field_value ) {
2172 2172
 
2173
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2173
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
2174 2174
 
2175
-				        if( 'list' === $field->type ) {
2175
+				        if ( 'list' === $field->type ) {
2176 2176
 				            $list_rows = maybe_unserialize( $field_value );
2177 2177
 
2178 2178
 				            $list_field_value = array();
2179
-				            foreach ( (array) $list_rows as $row ) {
2180
-				                foreach ( (array) $row as $column ) {
2181
-				                    $list_field_value[] = $column;
2179
+				            foreach ( (array)$list_rows as $row ) {
2180
+				                foreach ( (array)$row as $column ) {
2181
+				                    $list_field_value[ ] = $column;
2182 2182
 				                }
2183 2183
 				            }
2184 2184
 
@@ -2211,32 +2211,32 @@  discard block
 block discarded – undo
2211 2211
 		 * @see https://github.com/gravityview/GravityView/issues/840
2212 2212
 		 * @since develop
2213 2213
 		 */
2214
-		$the_form = GFAPI::get_form( $form['id'] );
2214
+		$the_form = GFAPI::get_form( $form[ 'id' ] );
2215 2215
 		$editable_ids = array();
2216
-		foreach ( $form['fields'] as $field ) {
2217
-			$editable_ids[] = $field['id']; // wp_list_pluck is destructive in this context
2216
+		foreach ( $form[ 'fields' ] as $field ) {
2217
+			$editable_ids[ ] = $field[ 'id' ]; // wp_list_pluck is destructive in this context
2218 2218
 		}
2219 2219
 		$remove_conditions_rule = array();
2220
-		foreach ( $the_form['fields'] as $field ) {
2221
-			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic['rules'] ) ) {
2222
-				foreach ( $field->conditionalLogic['rules'] as $i => $rule ) {
2223
-					if ( ! in_array( $rule['fieldId'], $editable_ids ) ) {
2220
+		foreach ( $the_form[ 'fields' ] as $field ) {
2221
+			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic[ 'rules' ] ) ) {
2222
+				foreach ( $field->conditionalLogic[ 'rules' ] as $i => $rule ) {
2223
+					if ( ! in_array( $rule[ 'fieldId' ], $editable_ids ) ) {
2224 2224
 						/**
2225 2225
 						 * This conditional field is not editable in this View.
2226 2226
 						 * We need to remove the rule, but only if it matches.
2227 2227
 						 */
2228
-						if ( $_field = GFAPI::get_field( $the_form, $rule['fieldId'] ) ) {
2228
+						if ( $_field = GFAPI::get_field( $the_form, $rule[ 'fieldId' ] ) ) {
2229 2229
 							$value = $_field->get_value_export( $this->entry );
2230
-						} elseif ( isset( $this->entry[ $rule['fieldId'] ] ) ) {
2231
-							$value = $this->entry[ $rule['fieldId'] ];
2230
+						} elseif ( isset( $this->entry[ $rule[ 'fieldId' ] ] ) ) {
2231
+							$value = $this->entry[ $rule[ 'fieldId' ] ];
2232 2232
 						} else {
2233
-							$value = gform_get_meta( $this->entry['id'], $rule['fieldId'] );
2233
+							$value = gform_get_meta( $this->entry[ 'id' ], $rule[ 'fieldId' ] );
2234 2234
 						}
2235 2235
 
2236
-						$match = GFFormsModel::matches_operation( $value, $rule['value'], $rule['operator'] );
2236
+						$match = GFFormsModel::matches_operation( $value, $rule[ 'value' ], $rule[ 'operator' ] );
2237 2237
 
2238 2238
 						if ( $match ) {
2239
-							$remove_conditions_rule[] = array( $field['id'], $i );
2239
+							$remove_conditions_rule[ ] = array( $field[ 'id' ], $i );
2240 2240
 						}
2241 2241
 					}
2242 2242
 				}
@@ -2244,21 +2244,21 @@  discard block
 block discarded – undo
2244 2244
 		}
2245 2245
 
2246 2246
 		if ( $remove_conditions_rule ) {
2247
-			foreach ( $form['fields'] as &$field ) {
2247
+			foreach ( $form[ 'fields' ] as &$field ) {
2248 2248
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2249 2249
 
2250 2250
 				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2251 2251
 
2252
-					if ( $field['id'] == $rule_field_id ) {
2253
-						unset( $field->conditionalLogic['rules'][ $rule_i ] );
2254
-						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field['id'] ) );
2252
+					if ( $field[ 'id' ] == $rule_field_id ) {
2253
+						unset( $field->conditionalLogic[ 'rules' ][ $rule_i ] );
2254
+						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field[ 'id' ] ) );
2255 2255
 					}
2256 2256
 				}
2257 2257
 			}
2258 2258
 		}
2259 2259
 
2260 2260
 		/** Normalize the indices... */
2261
-		$form['fields'] = array_values( $form['fields'] );
2261
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
2262 2262
 
2263 2263
 		/**
2264 2264
 		 * @filter `gravityview/edit_entry/conditional_logic` Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields?
@@ -2268,16 +2268,16 @@  discard block
 block discarded – undo
2268 2268
 		 */
2269 2269
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
2270 2270
 
2271
-		if( $use_conditional_logic ) {
2271
+		if ( $use_conditional_logic ) {
2272 2272
 			return $form;
2273 2273
 		}
2274 2274
 
2275
-		foreach( $form['fields'] as &$field ) {
2275
+		foreach ( $form[ 'fields' ] as &$field ) {
2276 2276
 			/* @var GF_Field $field */
2277 2277
 			$field->conditionalLogic = null;
2278 2278
 		}
2279 2279
 
2280
-		unset( $form['button']['conditionalLogic'] );
2280
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
2281 2281
 
2282 2282
 		return $form;
2283 2283
 
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
 	 */
2295 2295
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
2296 2296
 
2297
-		if( ! $this->is_edit_entry() ) {
2297
+		if ( ! $this->is_edit_entry() ) {
2298 2298
 			return $has_conditional_logic;
2299 2299
 		}
2300 2300
 
@@ -2326,44 +2326,44 @@  discard block
 block discarded – undo
2326 2326
 		 *  2. There are two entries embedded using oEmbed
2327 2327
 		 *  3. One of the entries has just been saved
2328 2328
 		 */
2329
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
2329
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
2330 2330
 
2331 2331
 			$error = true;
2332 2332
 
2333 2333
 		}
2334 2334
 
2335
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
2335
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
2336 2336
 
2337 2337
 			$error = true;
2338 2338
 
2339
-		} elseif( ! $this->verify_nonce() ) {
2339
+		} elseif ( ! $this->verify_nonce() ) {
2340 2340
 
2341 2341
 			/**
2342 2342
 			 * If the Entry is embedded, there may be two entries on the same page.
2343 2343
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
2344 2344
 			 */
2345
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2345
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2346 2346
 				$error = true;
2347 2347
 			} else {
2348
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
2348
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
2349 2349
 			}
2350 2350
 
2351 2351
 		}
2352 2352
 
2353
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2354
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
2353
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2354
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
2355 2355
 		}
2356 2356
 
2357
-		if( $this->entry['status'] === 'trash' ) {
2358
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
2357
+		if ( $this->entry[ 'status' ] === 'trash' ) {
2358
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
2359 2359
 		}
2360 2360
 
2361 2361
 		// No errors; everything's fine here!
2362
-		if( empty( $error ) ) {
2362
+		if ( empty( $error ) ) {
2363 2363
 			return true;
2364 2364
 		}
2365 2365
 
2366
-		if( $echo && $error !== true ) {
2366
+		if ( $echo && $error !== true ) {
2367 2367
 
2368 2368
 	        $error = esc_html( $error );
2369 2369
 
@@ -2371,10 +2371,10 @@  discard block
 block discarded – undo
2371 2371
 	         * @since 1.9
2372 2372
 	         */
2373 2373
 	        if ( ! empty( $this->entry ) ) {
2374
-		        $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;" ) );
2374
+		        $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 2375
 	        }
2376 2376
 
2377
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2377
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
2378 2378
 		}
2379 2379
 
2380 2380
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2394,17 +2394,17 @@  discard block
 block discarded – undo
2394 2394
 
2395 2395
 		$error = NULL;
2396 2396
 
2397
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2398
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2397
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2398
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2399 2399
 		}
2400 2400
 
2401 2401
 		// No errors; everything's fine here!
2402
-		if( empty( $error ) ) {
2402
+		if ( empty( $error ) ) {
2403 2403
 			return true;
2404 2404
 		}
2405 2405
 
2406
-		if( $echo ) {
2407
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2406
+		if ( $echo ) {
2407
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2408 2408
 		}
2409 2409
 
2410 2410
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2425,14 +2425,14 @@  discard block
 block discarded – undo
2425 2425
 	private function check_user_cap_edit_field( $field ) {
2426 2426
 
2427 2427
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2428
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2428
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2429 2429
 			return true;
2430 2430
 		}
2431 2431
 
2432
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2432
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2433 2433
 
2434
-		if( $field_cap ) {
2435
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2434
+		if ( $field_cap ) {
2435
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2436 2436
 		}
2437 2437
 
2438 2438
 		return false;
@@ -2446,17 +2446,17 @@  discard block
 block discarded – undo
2446 2446
 	public function verify_nonce() {
2447 2447
 
2448 2448
 		// Verify form submitted for editing single
2449
-		if( $this->is_edit_entry_submission() ) {
2449
+		if ( $this->is_edit_entry_submission() ) {
2450 2450
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2451 2451
 		}
2452 2452
 
2453 2453
 		// Verify
2454
-		else if( ! $this->is_edit_entry() ) {
2454
+		else if ( ! $this->is_edit_entry() ) {
2455 2455
 			$valid = false;
2456 2456
 		}
2457 2457
 
2458 2458
 		else {
2459
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2459
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2460 2460
 		}
2461 2461
 
2462 2462
 		/**
@@ -2516,7 +2516,7 @@  discard block
 block discarded – undo
2516 2516
 		 */
2517 2517
 		$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
2518 2518
 
2519
-		return (array) $labels;
2519
+		return (array)$labels;
2520 2520
 	}
2521 2521
 
2522 2522
 } //end class
Please login to merge, or discard this patch.
future/includes/class-gv-settings-view.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 				'paged_edit' => array(
165 165
 					'label'             => __( 'Enable multi-page editing', 'gravityview' ),
166 166
 					'group'             => 'default',
167
-					'desc'              => strtr( esc_html_x( '⚠️ Warning: Multi-page editing does not behave as it does in Gravity Forms. Please [link]read about the differences[/link] before enabling!', '[link] and [/link] are replaced by HTML and should not be translated.' ,'gravityview' ), array(
167
+					'desc'              => strtr( esc_html_x( '⚠️ Warning: Multi-page editing does not behave as it does in Gravity Forms. Please [link]read about the differences[/link] before enabling!', '[link] and [/link] are replaced by HTML and should not be translated.', 'gravityview' ), array(
168 168
 						'[link]' => '<a href="https://docs.gravityview.co/article/819-edit-entry-multi-page-forms" rel="external">',
169 169
 						'[/link]' => '</a>'
170 170
 					) ),
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 		if ( ! $detailed ) {
604 604
 			$defaults = array();
605 605
 			foreach ( $default_settings as $key => $value ) {
606
-				$defaults[ $key ] = $value['value'];
606
+				$defaults[ $key ] = $value[ 'value' ];
607 607
 			}
608 608
 			return $defaults;
609 609
 
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 				// If the $group argument is set for the method,
615 615
 				// ignore any settings that aren't in that group.
616 616
 				if ( ! empty( $group ) && is_string( $group ) ) {
617
-					if ( empty( $value['group'] ) || $value['group'] !== $group ) {
617
+					if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) {
618 618
 						unset( $default_settings[ $key ] );
619 619
 					}
620 620
 				}
Please login to merge, or discard this patch.