Completed
Push — develop ( c82df7...42fd1f )
by Gennady
16:36
created
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 	function load() {
116 116
 
117 117
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
118
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
118
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
119 119
 
120 120
 		// Don't display an embedded form when editing an entry
121 121
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
122 122
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
123 123
 
124 124
 		// Stop Gravity Forms processing what is ours!
125
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
125
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
126 126
 
127
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
127
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
128 128
 
129 129
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
130 130
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
136 136
 
137 137
 		// Add fields expected by GFFormDisplay::validate()
138
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
138
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
139 139
 
140 140
 		// Fix multiselect value for GF 2.2
141 141
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @return void
153 153
 	 */
154 154
 	public function prevent_render_form() {
155
-		if( $this->is_edit_entry() ) {
156
-			if( 'wp_head' === current_filter() ) {
155
+		if ( $this->is_edit_entry() ) {
156
+			if ( 'wp_head' === current_filter() ) {
157 157
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
158 158
 			} else {
159 159
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171
-		if( ! empty( $_POST ) ) {
171
+		if ( ! empty( $_POST ) ) {
172 172
 	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175
-		if( $this->is_edit_entry_submission() ) {
176
-			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
175
+		if ( $this->is_edit_entry_submission() ) {
176
+			remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
177
+	        remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function is_edit_entry() {
186 186
 
187
-		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
187
+		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
188 188
 
189 189
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
190 190
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @return boolean
196 196
 	 */
197 197
 	public function is_edit_entry_submission() {
198
-		return !empty( $_POST[ self::$nonce_field ] );
198
+		return ! empty( $_POST[ self::$nonce_field ] );
199 199
 	}
200 200
 
201 201
 	/**
@@ -208,16 +208,16 @@  discard block
 block discarded – undo
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+	    self::$original_entry = $entries[ 0 ];
212
+	    $this->entry = $entries[ 0 ];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
216
-		$this->form_id = $this->entry['form_id'];
216
+		$this->form_id = $this->entry[ 'form_id' ];
217 217
 		$this->view_id = $gravityview_view->getViewId();
218 218
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
219 219
 
220
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
220
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
221 221
 	}
222 222
 
223 223
 
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 	private function print_scripts() {
269 269
 		$gravityview_view = GravityView_View::getInstance();
270 270
 
271
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
271
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
272 272
 
273
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
273
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
274 274
 
275 275
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
276 276
 
@@ -286,19 +286,19 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	private function process_save( $gv_data ) {
288 288
 
289
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
289
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
290 290
 			return;
291 291
 		}
292 292
 
293 293
 		// Make sure the entry, view, and form IDs are all correct
294 294
 		$valid = $this->verify_nonce();
295 295
 
296
-		if ( !$valid ) {
296
+		if ( ! $valid ) {
297 297
 			gravityview()->log->error( 'Nonce validation failed.' );
298 298
 			return;
299 299
 		}
300 300
 
301
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
301
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
302 302
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
303 303
 			return;
304 304
 		}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
 		$this->validate();
311 311
 
312
-		if( $this->is_valid ) {
312
+		if ( $this->is_valid ) {
313 313
 
314 314
 			gravityview()->log->debug( 'Submission is valid.' );
315 315
 
@@ -321,15 +321,15 @@  discard block
 block discarded – undo
321 321
 			/**
322 322
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
323 323
 			 */
324
-			unset( $_GET['page'] );
324
+			unset( $_GET[ 'page' ] );
325 325
 
326
-			$date_created = $this->entry['date_created'];
326
+			$date_created = $this->entry[ 'date_created' ];
327 327
 
328 328
 			/**
329 329
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
330 330
 			 * @since 1.17.2
331 331
 			 */
332
-			unset( $this->entry['date_created'] );
332
+			unset( $this->entry[ 'date_created' ] );
333 333
 
334 334
 			/**
335 335
 			 * @action `gravityview/edit_entry/before_update` Perform an action after the entry has been updated using Edit Entry
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
 			 * @param GravityView_Edit_Entry_Render $this This object
340 340
 			 * @param GravityView_View_Data $gv_data The View data
341 341
 			 */
342
-			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry['id'], $this, $gv_data );
342
+			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry[ 'id' ], $this, $gv_data );
343 343
 
344 344
 			GFFormsModel::save_lead( $form, $this->entry );
345 345
 
346 346
 	        // Delete the values for hidden inputs
347 347
 	        $this->unset_hidden_field_values();
348 348
 			
349
-			$this->entry['date_created'] = $date_created;
349
+			$this->entry[ 'date_created' ] = $date_created;
350 350
 
351 351
 			// Process calculation fields
352 352
 			$this->update_calculation_fields();
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 			 * @param GravityView_Edit_Entry_Render $this This object
369 369
 			 * @param GravityView_View_Data $gv_data The View data
370 370
 			 */
371
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
371
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
372 372
 
373 373
 		} else {
374 374
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -396,16 +396,16 @@  discard block
 block discarded – undo
396 396
 		 */
397 397
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
398 398
 
399
-		if( ! $unset_hidden_field_values ) {
399
+		if ( ! $unset_hidden_field_values ) {
400 400
 			return;
401 401
 		}
402 402
 
403 403
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
404 404
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
405
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
405
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
406 406
 		} else {
407 407
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
408
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
408
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
409 409
 		}
410 410
 
411 411
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
 				$empty_value = $field->get_value_save_entry(
420 420
 					is_array( $field->get_entry_inputs() ) ? array() : '',
421
-					$this->form, '', $this->entry['id'], $this->entry
421
+					$this->form, '', $this->entry[ 'id' ], $this->entry
422 422
 				);
423 423
 
424 424
 			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		}
489 489
 
490 490
 		/** No file is being uploaded. */
491
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
491
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
492 492
 			/** So return the original upload */
493 493
 			return $entry[ $input_id ];
494 494
 		}
@@ -506,11 +506,11 @@  discard block
 block discarded – undo
506 506
 	 * @return mixed
507 507
 	 */
508 508
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
509
-		if( ! $this->is_edit_entry() ) {
509
+		if ( ! $this->is_edit_entry() ) {
510 510
 			return $plupload_init;
511 511
 		}
512 512
 
513
-		$plupload_init['gf_vars']['max_files'] = 0;
513
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
514 514
 
515 515
 		return $plupload_init;
516 516
 	}
@@ -525,27 +525,27 @@  discard block
 block discarded – undo
525 525
 		$form = $this->form;
526 526
 
527 527
 	    /** @var GF_Field $field */
528
-		foreach( $form['fields'] as $k => &$field ) {
528
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
529 529
 
530 530
 			/**
531 531
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
532 532
 			 * @since 1.16.3
533 533
 			 * @var GF_Field $field
534 534
 			 */
535
-			if( $field->has_calculation() ) {
536
-				unset( $form['fields'][ $k ] );
535
+			if ( $field->has_calculation() ) {
536
+				unset( $form[ 'fields' ][ $k ] );
537 537
 			}
538 538
 
539 539
 			$field->adminOnly = false;
540 540
 
541
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
542
-				foreach( $field->inputs as $key => $input ) {
543
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
541
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
542
+				foreach ( $field->inputs as $key => $input ) {
543
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
544 544
 				}
545 545
 			}
546 546
 		}
547 547
 
548
-		$form['fields'] = array_values( $form['fields'] );
548
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
549 549
 
550 550
 		return $form;
551 551
 	}
@@ -557,14 +557,14 @@  discard block
 block discarded – undo
557 557
 		$update = false;
558 558
 
559 559
 		// get the most up to date entry values
560
-		$entry = GFAPI::get_entry( $this->entry['id'] );
560
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
561 561
 
562 562
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
563 563
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
564
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) );
564
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) );
565 565
 		} else {
566 566
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
567
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) );
567
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) );
568 568
 		}
569 569
 
570 570
 
@@ -576,24 +576,24 @@  discard block
 block discarded – undo
576 576
 				$inputs = $field->get_entry_inputs();
577 577
 				if ( is_array( $inputs ) ) {
578 578
 				    foreach ( $inputs as $input ) {
579
-						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
579
+						list( $field_id, $input_id ) = rgexplode( '.', $input[ 'id' ], 2 );
580 580
 
581 581
 						if ( 'product' === $field->type ) {
582
-							$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
582
+							$input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
583 583
 
584 584
 							// Only allow quantity to be set if it's allowed to be edited
585 585
 							if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) {
586 586
 							} else { // otherwise set to what it previously was
587
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
587
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
588 588
 							}
589 589
 						} else {
590 590
 							// Set to what it previously was if it's not editable
591 591
 							if ( ! in_array( $field_id, $allowed_fields ) ) {
592
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
592
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
593 593
 							}
594 594
 						}
595 595
 
596
-						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
596
+						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] );
597 597
 				    }
598 598
 				} else {
599 599
 					// Set to what it previously was if it's not editable
@@ -633,19 +633,19 @@  discard block
 block discarded – undo
633 633
 
634 634
 		$input_name = 'input_' . $field_id;
635 635
 
636
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
636
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
637 637
 
638 638
 			// We have a new image
639 639
 
640
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
640
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
641 641
 
642 642
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
643 643
 	        $ary = stripslashes_deep( $ary );
644 644
 			$img_url = \GV\Utils::get( $ary, 0 );
645 645
 
646
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
647
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
648
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
646
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
647
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
648
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
649 649
 
650 650
 			$image_meta = array(
651 651
 				'post_excerpt' => $img_caption,
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 
655 655
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
656 656
 			if ( ! empty( $img_title ) ) {
657
-				$image_meta['post_title'] = $img_title;
657
+				$image_meta[ 'post_title' ] = $img_title;
658 658
 			}
659 659
 
660 660
 			/**
@@ -712,15 +712,15 @@  discard block
 block discarded – undo
712 712
 	 */
713 713
 	private function maybe_update_post_fields( $form ) {
714 714
 
715
-		if( empty( $this->entry['post_id'] ) ) {
715
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
716 716
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
717 717
 			return;
718 718
 		}
719 719
 
720
-		$post_id = $this->entry['post_id'];
720
+		$post_id = $this->entry[ 'post_id' ];
721 721
 
722 722
 		// Security check
723
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
723
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
724 724
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
725 725
 			return;
726 726
 		}
@@ -733,25 +733,25 @@  discard block
 block discarded – undo
733 733
 
734 734
 			$field = RGFormsModel::get_field( $form, $field_id );
735 735
 
736
-			if( ! $field ) {
736
+			if ( ! $field ) {
737 737
 				continue;
738 738
 			}
739 739
 
740
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
740
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
741 741
 
742 742
 				// Get the value of the field, including $_POSTed value
743 743
 				$value = RGFormsModel::get_field_value( $field );
744 744
 
745 745
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
746 746
 				$entry_tmp = $this->entry;
747
-				$entry_tmp["{$field_id}"] = $value;
747
+				$entry_tmp[ "{$field_id}" ] = $value;
748 748
 
749
-				switch( $field->type ) {
749
+				switch ( $field->type ) {
750 750
 
751 751
 				    case 'post_title':
752 752
 				        $post_title = $value;
753 753
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
754
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
754
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
755 755
 				        }
756 756
 				        $updated_post->post_title = $post_title;
757 757
 				        $updated_post->post_name  = $post_title;
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 				    case 'post_content':
762 762
 				        $post_content = $value;
763 763
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
764
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
764
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
765 765
 				        }
766 766
 				        $updated_post->post_content = $post_content;
767 767
 				        unset( $post_content );
@@ -779,11 +779,11 @@  discard block
 block discarded – undo
779 779
 							$value = $value[ $field_id ];
780 780
 						}
781 781
 
782
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
782
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
783 783
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
784 784
 				        }
785 785
 
786
-						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
786
+						$value = $field->get_value_save_entry( $value, $form, '', $this->entry[ 'id' ], $this->entry );
787 787
 
788 788
 				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
789 789
 				        break;
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 				}
796 796
 
797 797
 				// update entry after
798
-				$this->entry["{$field_id}"] = $value;
798
+				$this->entry[ "{$field_id}" ] = $value;
799 799
 
800 800
 				$update_entry = true;
801 801
 
@@ -804,11 +804,11 @@  discard block
 block discarded – undo
804 804
 
805 805
 		}
806 806
 
807
-		if( $update_entry ) {
807
+		if ( $update_entry ) {
808 808
 
809 809
 			$return_entry = GFAPI::update_entry( $this->entry );
810 810
 
811
-			if( is_wp_error( $return_entry ) ) {
811
+			if ( is_wp_error( $return_entry ) ) {
812 812
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
813 813
 			} else {
814 814
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 
819 819
 		$return_post = wp_update_post( $updated_post, true );
820 820
 
821
-		if( is_wp_error( $return_post ) ) {
821
+		if ( is_wp_error( $return_post ) ) {
822 822
 			$return_post->add_data( $updated_post, '$updated_post' );
823 823
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
824 824
 		} else {
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
853 853
 
854 854
 		// replace conditional shortcodes
855
-		if( $do_shortcode ) {
855
+		if ( $do_shortcode ) {
856 856
 			$output = do_shortcode( $output );
857 857
 		}
858 858
 
@@ -871,19 +871,19 @@  discard block
 block discarded – undo
871 871
 	 */
872 872
 	private function after_update() {
873 873
 
874
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
875
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
874
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
875
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
876 876
 
877 877
 		// Re-define the entry now that we've updated it.
878
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
878
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
879 879
 
880 880
 		$entry = GFFormsModel::set_entry_meta( $entry, self::$original_form );
881 881
 
882 882
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
883 883
 			// We need to clear the cache because Gravity Forms caches the field values, which
884 884
 			// we have just updated.
885
-			foreach ($this->form['fields'] as $key => $field) {
886
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
885
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
886
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
887 887
 			}
888 888
 		}
889 889
 
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 
903 903
 		<div class="gv-edit-entry-wrapper"><?php
904 904
 
905
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
905
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
906 906
 
907 907
 			/**
908 908
 			 * Fixes weird wpautop() issue
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
919 919
 				     * @param GravityView_Edit_Entry_Render $this This object
920 920
 				     */
921
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
921
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
922 922
 
923 923
 				    echo esc_attr( $edit_entry_title );
924 924
 			?></span>
@@ -968,13 +968,13 @@  discard block
 block discarded – undo
968 968
 
969 969
 			$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
970 970
 
971
-			if( ! $this->is_valid ){
971
+			if ( ! $this->is_valid ) {
972 972
 
973 973
 				// Keeping this compatible with Gravity Forms.
974
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
975
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
974
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
975
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
976 976
 
977
-				echo GVCommon::generate_notice( $message , 'gv-error' );
977
+				echo GVCommon::generate_notice( $message, 'gv-error' );
978 978
 
979 979
 			} else {
980 980
 				$view = \GV\View::by_id( $this->view_id );
@@ -985,23 +985,23 @@  discard block
 block discarded – undo
985 985
 
986 986
                     case '0':
987 987
 	                    $redirect_url = $back_link;
988
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
988
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' );
989 989
                         break;
990 990
 
991 991
                     case '1':
992 992
 	                    $redirect_url = $directory_link = GravityView_API::directory_link();
993
-	                    $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>' );
993
+	                    $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>' );
994 994
 	                    break;
995 995
 
996 996
                     case '2':
997 997
 	                    $redirect_url = $edit_redirect_url;
998 998
 	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
999
-	                    $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>' );
999
+	                    $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>' );
1000 1000
                         break;
1001 1001
 
1002 1002
                     case '':
1003 1003
                     default:
1004
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1004
+					    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' );
1005 1005
                         break;
1006 1006
 				}
1007 1007
 
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 				 * @param array $entry Gravity Forms entry array
1018 1018
 				 * @param string $back_link URL to return to the original entry. @since 1.6
1019 1019
 				 */
1020
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
1020
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
1021 1021
 
1022 1022
 				echo GVCommon::generate_notice( $message );
1023 1023
 			}
@@ -1041,21 +1041,21 @@  discard block
 block discarded – undo
1041 1041
 		 */
1042 1042
 		do_action( 'gravityview/edit-entry/render/before', $this );
1043 1043
 
1044
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1045
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1044
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1045
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1046 1046
 		add_filter( 'gform_disable_view_counter', '__return_true' );
1047 1047
 
1048 1048
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
1049 1049
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1050 1050
 
1051 1051
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1052
-		unset( $_GET['page'] );
1052
+		unset( $_GET[ 'page' ] );
1053 1053
 
1054 1054
 		// TODO: Verify multiple-page forms
1055 1055
 
1056 1056
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1057 1057
 
1058
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1058
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1059 1059
 
1060 1060
 		ob_get_clean();
1061 1061
 
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 	 * @return string
1082 1082
 	 */
1083 1083
 	public function render_form_buttons() {
1084
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1084
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1085 1085
 	}
1086 1086
 
1087 1087
 
@@ -1101,10 +1101,10 @@  discard block
 block discarded – undo
1101 1101
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1102 1102
 
1103 1103
 		// In case we have validated the form, use it to inject the validation results into the form render
1104
-		if( isset( $this->form_after_validation ) ) {
1104
+		if ( isset( $this->form_after_validation ) ) {
1105 1105
 			$form = $this->form_after_validation;
1106 1106
 		} else {
1107
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1107
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1108 1108
 		}
1109 1109
 
1110 1110
 		$form = $this->filter_conditional_logic( $form );
@@ -1112,8 +1112,8 @@  discard block
 block discarded – undo
1112 1112
 		$form = $this->prefill_conditional_logic( $form );
1113 1113
 
1114 1114
 		// for now we don't support Save and Continue feature.
1115
-		if( ! self::$supports_save_and_continue ) {
1116
-	        unset( $form['save'] );
1115
+		if ( ! self::$supports_save_and_continue ) {
1116
+	        unset( $form[ 'save' ] );
1117 1117
 		}
1118 1118
 
1119 1119
 		$form = $this->unselect_default_values( $form );
@@ -1136,31 +1136,31 @@  discard block
 block discarded – undo
1136 1136
 	 */
1137 1137
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1138 1138
 
1139
-		if( ! GFCommon::is_post_field( $field ) ) {
1139
+		if ( ! GFCommon::is_post_field( $field ) ) {
1140 1140
 			return $field_content;
1141 1141
 		}
1142 1142
 
1143 1143
         $message = null;
1144 1144
 
1145 1145
         // First, make sure they have the capability to edit the post.
1146
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1146
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1147 1147
 
1148 1148
             /**
1149 1149
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1150 1150
              * @param string $message The existing "You don't have permission..." text
1151 1151
              */
1152
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1152
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1153 1153
 
1154
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1154
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1155 1155
             /**
1156 1156
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1157 1157
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1158 1158
              */
1159
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1159
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1160 1160
         }
1161 1161
 
1162
-        if( $message ) {
1163
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1162
+        if ( $message ) {
1163
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1164 1164
         }
1165 1165
 
1166 1166
         return $field_content;
@@ -1184,8 +1184,8 @@  discard block
 block discarded – undo
1184 1184
 
1185 1185
 		// If the form has been submitted, then we don't need to pre-fill the values,
1186 1186
 		// Except for fileupload type and when a field input is overridden- run always!!
1187
-		if(
1188
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1187
+		if (
1188
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1189 1189
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1190 1190
 			&& ! GFCommon::is_product_field( $field->type )
1191 1191
 			|| ! empty( $field_content )
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 	    $return = null;
1206 1206
 
1207 1207
 		/** @var GravityView_Field $gv_field */
1208
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1208
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1209 1209
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1210 1210
 		} else {
1211 1211
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 	    // If there was output, it's an error
1215 1215
 	    $warnings = ob_get_clean();
1216 1216
 
1217
-	    if( !empty( $warnings ) ) {
1217
+	    if ( ! empty( $warnings ) ) {
1218 1218
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1219 1219
 	    }
1220 1220
 
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1240 1240
 
1241 1241
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1242
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1242
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1243 1243
 
1244 1244
 			$field_value = array();
1245 1245
 
@@ -1248,10 +1248,10 @@  discard block
 block discarded – undo
1248 1248
 
1249 1249
 			foreach ( (array)$field->inputs as $input ) {
1250 1250
 
1251
-				$input_id = strval( $input['id'] );
1251
+				$input_id = strval( $input[ 'id' ] );
1252 1252
 
1253 1253
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1254
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1254
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1255 1255
 				    $allow_pre_populated = false;
1256 1256
 				}
1257 1257
 
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 
1260 1260
 			$pre_value = $field->get_value_submission( array(), false );
1261 1261
 
1262
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1262
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1263 1263
 
1264 1264
 		} else {
1265 1265
 
@@ -1270,13 +1270,13 @@  discard block
 block discarded – undo
1270 1270
 
1271 1271
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1272 1272
 			// or pre-populated value if not empty and set to override saved value
1273
-			$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;
1273
+			$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;
1274 1274
 
1275 1275
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1276
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1276
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1277 1277
 				$categories = array();
1278 1278
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1279
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1279
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1280 1280
 				}
1281 1281
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1282 1282
 			}
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 	     * @param GF_Field $field Gravity Forms field object
1305 1305
 	     * @param GravityView_Edit_Entry_Render $this Current object
1306 1306
 	     */
1307
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1307
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1308 1308
 
1309 1309
 		return $field_value;
1310 1310
 	}
@@ -1321,12 +1321,12 @@  discard block
 block discarded – undo
1321 1321
 	 */
1322 1322
 	public function gform_pre_validation( $form ) {
1323 1323
 
1324
-		if( ! $this->verify_nonce() ) {
1324
+		if ( ! $this->verify_nonce() ) {
1325 1325
 			return $form;
1326 1326
 		}
1327 1327
 
1328 1328
 		// Fix PHP warning regarding undefined index.
1329
-		foreach ( $form['fields'] as &$field) {
1329
+		foreach ( $form[ 'fields' ] as &$field ) {
1330 1330
 
1331 1331
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1332 1332
 			// expects certain field array items to be set.
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1335 1335
 			}
1336 1336
 
1337
-			switch( RGFormsModel::get_input_type( $field ) ) {
1337
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1338 1338
 
1339 1339
 				/**
1340 1340
 				 * 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.
@@ -1348,26 +1348,26 @@  discard block
 block discarded – undo
1348 1348
 				    // Set the previous value
1349 1349
 				    $entry = $this->get_entry();
1350 1350
 
1351
-				    $input_name = 'input_'.$field->id;
1352
-				    $form_id = $form['id'];
1351
+				    $input_name = 'input_' . $field->id;
1352
+				    $form_id = $form[ 'id' ];
1353 1353
 
1354 1354
 				    $value = NULL;
1355 1355
 
1356 1356
 				    // Use the previous entry value as the default.
1357
-				    if( isset( $entry[ $field->id ] ) ) {
1357
+				    if ( isset( $entry[ $field->id ] ) ) {
1358 1358
 				        $value = $entry[ $field->id ];
1359 1359
 				    }
1360 1360
 
1361 1361
 				    // If this is a single upload file
1362
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1363
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1364
-				        $value = $file_path['url'];
1362
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1363
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1364
+				        $value = $file_path[ 'url' ];
1365 1365
 
1366 1366
 				    } else {
1367 1367
 
1368 1368
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1369 1369
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1370
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1370
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1371 1371
 
1372 1372
 				    }
1373 1373
 
@@ -1375,10 +1375,10 @@  discard block
 block discarded – undo
1375 1375
 
1376 1376
 				        // If there are fresh uploads, process and merge them.
1377 1377
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1378
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1378
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1379 1379
 				            $value = empty( $value ) ? '[]' : $value;
1380 1380
 				            $value = stripslashes_deep( $value );
1381
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1381
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1382 1382
 				        }
1383 1383
 
1384 1384
 				    } else {
@@ -1396,8 +1396,8 @@  discard block
 block discarded – undo
1396 1396
 
1397 1397
 				case 'number':
1398 1398
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1399
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1400
-				        $_POST['input_'.$field->id ] = NULL;
1399
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1400
+				        $_POST[ 'input_' . $field->id ] = NULL;
1401 1401
 				    }
1402 1402
 				    break;
1403 1403
 			}
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
 		 * You can enter whatever you want!
1435 1435
 		 * We try validating, and customize the results using `self::custom_validation()`
1436 1436
 		 */
1437
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1437
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1438 1438
 
1439 1439
 		// Needed by the validate funtion
1440 1440
 		$failed_validation_page = NULL;
@@ -1442,14 +1442,14 @@  discard block
 block discarded – undo
1442 1442
 
1443 1443
 		// Prevent entry limit from running when editing an entry, also
1444 1444
 		// prevent form scheduling from preventing editing
1445
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1445
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1446 1446
 
1447 1447
 		// Hide fields depending on Edit Entry settings
1448
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1448
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1449 1449
 
1450 1450
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1451 1451
 
1452
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1452
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1453 1453
 	}
1454 1454
 
1455 1455
 
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 
1473 1473
 		$gv_valid = true;
1474 1474
 
1475
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1475
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1476 1476
 
1477 1477
 			$value = RGFormsModel::get_field_value( $field );
1478 1478
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1485,35 +1485,35 @@  discard block
 block discarded – undo
1485 1485
 				case 'post_image':
1486 1486
 
1487 1487
 				    // in case nothing is uploaded but there are already files saved
1488
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1488
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1489 1489
 				        $field->failed_validation = false;
1490 1490
 				        unset( $field->validation_message );
1491 1491
 				    }
1492 1492
 
1493 1493
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1494
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1494
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1495 1495
 
1496 1496
 				        $input_name = 'input_' . $field->id;
1497 1497
 				        //uploaded
1498
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1498
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1499 1499
 
1500 1500
 				        //existent
1501 1501
 				        $entry = $this->get_entry();
1502 1502
 				        $value = NULL;
1503
-				        if( isset( $entry[ $field->id ] ) ) {
1503
+				        if ( isset( $entry[ $field->id ] ) ) {
1504 1504
 				            $value = json_decode( $entry[ $field->id ], true );
1505 1505
 				        }
1506 1506
 
1507 1507
 				        // count uploaded files and existent entry files
1508 1508
 				        $count_files = count( $file_names ) + count( $value );
1509 1509
 
1510
-				        if( $count_files > $field->maxFiles ) {
1510
+				        if ( $count_files > $field->maxFiles ) {
1511 1511
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1512 1512
 				            $field->failed_validation = 1;
1513 1513
 				            $gv_valid = false;
1514 1514
 
1515 1515
 				            // in case of error make sure the newest upload files are removed from the upload input
1516
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1516
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1517 1517
 				        }
1518 1518
 
1519 1519
 				    }
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
 			}
1525 1525
 
1526 1526
 			// This field has failed validation.
1527
-			if( !empty( $field->failed_validation ) ) {
1527
+			if ( ! empty( $field->failed_validation ) ) {
1528 1528
 
1529 1529
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1530 1530
 
@@ -1542,19 +1542,19 @@  discard block
 block discarded – undo
1542 1542
 				}
1543 1543
 
1544 1544
 				// You can't continue inside a switch, so we do it after.
1545
-				if( empty( $field->failed_validation ) ) {
1545
+				if ( empty( $field->failed_validation ) ) {
1546 1546
 				    continue;
1547 1547
 				}
1548 1548
 
1549 1549
 				// checks if the No Duplicates option is not validating entry against itself, since
1550 1550
 				// we're editing a stored entry, it would also assume it's a duplicate.
1551
-				if( !empty( $field->noDuplicates ) ) {
1551
+				if ( ! empty( $field->noDuplicates ) ) {
1552 1552
 
1553 1553
 				    $entry = $this->get_entry();
1554 1554
 
1555 1555
 				    // If the value of the entry is the same as the stored value
1556 1556
 				    // Then we can assume it's not a duplicate, it's the same.
1557
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1557
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1558 1558
 				        //if value submitted was not changed, then don't validate
1559 1559
 				        $field->failed_validation = false;
1560 1560
 
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
 				}
1568 1568
 
1569 1569
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1570
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1570
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1571 1571
 				    unset( $field->validation_message );
1572 1572
 	                $field->validation_message = false;
1573 1573
 				    continue;
@@ -1579,12 +1579,12 @@  discard block
 block discarded – undo
1579 1579
 
1580 1580
 		}
1581 1581
 
1582
-		$validation_results['is_valid'] = $gv_valid;
1582
+		$validation_results[ 'is_valid' ] = $gv_valid;
1583 1583
 
1584 1584
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1585 1585
 
1586 1586
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1587
-		$this->form_after_validation = $validation_results['form'];
1587
+		$this->form_after_validation = $validation_results[ 'form' ];
1588 1588
 
1589 1589
 		return $validation_results;
1590 1590
 	}
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
 	 */
1598 1598
 	public function get_entry() {
1599 1599
 
1600
-		if( empty( $this->entry ) ) {
1600
+		if ( empty( $this->entry ) ) {
1601 1601
 			// Get the database value of the entry that's being edited
1602 1602
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1603 1603
 		}
@@ -1629,10 +1629,10 @@  discard block
 block discarded – undo
1629 1629
 		}
1630 1630
 
1631 1631
 		// If edit tab not yet configured, show all fields
1632
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1632
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1633 1633
 
1634 1634
 		// Hide fields depending on admin settings
1635
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1635
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1636 1636
 
1637 1637
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1638 1638
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
 	 */
1665 1665
 	private function filter_fields( $fields, $configured_fields ) {
1666 1666
 
1667
-		if( empty( $fields ) || !is_array( $fields ) ) {
1667
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1668 1668
 			return $fields;
1669 1669
 		}
1670 1670
 
@@ -1677,18 +1677,18 @@  discard block
 block discarded – undo
1677 1677
 
1678 1678
 			// Remove the fields that have calculation properties and keep them to be used later
1679 1679
 			// @since 1.16.2
1680
-			if( $field->has_calculation() ) {
1681
-				$this->fields_with_calculation[] = $field;
1680
+			if ( $field->has_calculation() ) {
1681
+				$this->fields_with_calculation[ ] = $field;
1682 1682
 				// don't remove the calculation fields on form render.
1683 1683
 			}
1684 1684
 
1685
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1685
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1686 1686
 				unset( $fields[ $key ] );
1687 1687
 			}
1688 1688
 		}
1689 1689
 
1690 1690
 		// The Edit tab has not been configured, so we return all fields by default.
1691
-		if( empty( $configured_fields ) ) {
1691
+		if ( empty( $configured_fields ) ) {
1692 1692
 			return array_values( $fields );
1693 1693
 		}
1694 1694
 
@@ -1697,8 +1697,8 @@  discard block
 block discarded – undo
1697 1697
 
1698 1698
 	        /** @var GF_Field $field */
1699 1699
 	        foreach ( $fields as $field ) {
1700
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1701
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1700
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1701
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1702 1702
 				    break;
1703 1703
 				}
1704 1704
 
@@ -1721,14 +1721,14 @@  discard block
 block discarded – undo
1721 1721
 
1722 1722
 		$return_field = $field;
1723 1723
 
1724
-		if( empty( $field_setting['show_label'] ) ) {
1724
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1725 1725
 			$return_field->label = '';
1726
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1727
-			$return_field->label = $field_setting['custom_label'];
1726
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1727
+			$return_field->label = $field_setting[ 'custom_label' ];
1728 1728
 		}
1729 1729
 
1730
-		if( !empty( $field_setting['custom_class'] ) ) {
1731
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1730
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1731
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1732 1732
 		}
1733 1733
 
1734 1734
 		/**
@@ -1766,16 +1766,16 @@  discard block
 block discarded – undo
1766 1766
 	     */
1767 1767
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1768 1768
 
1769
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1770
-			foreach( $fields as $k => $field ) {
1771
-				if( $field->adminOnly ) {
1769
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1770
+			foreach ( $fields as $k => $field ) {
1771
+				if ( $field->adminOnly ) {
1772 1772
 				    unset( $fields[ $k ] );
1773 1773
 				}
1774 1774
 			}
1775 1775
 			return array_values( $fields );
1776 1776
 		}
1777 1777
 
1778
-	    foreach( $fields as &$field ) {
1778
+	    foreach ( $fields as &$field ) {
1779 1779
 		    $field->adminOnly = false;
1780 1780
 		}
1781 1781
 
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
 	 */
1797 1797
 	private function unselect_default_values( $form ) {
1798 1798
 
1799
-	    foreach ( $form['fields'] as &$field ) {
1799
+	    foreach ( $form[ 'fields' ] as &$field ) {
1800 1800
 
1801 1801
 			if ( empty( $field->choices ) ) {
1802 1802
                 continue;
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 
1805 1805
             foreach ( $field->choices as &$choice ) {
1806 1806
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1807
-					$choice['isSelected'] = false;
1807
+					$choice[ 'isSelected' ] = false;
1808 1808
 				}
1809 1809
 			}
1810 1810
 		}
@@ -1829,22 +1829,22 @@  discard block
 block discarded – undo
1829 1829
 	 */
1830 1830
 	function prefill_conditional_logic( $form ) {
1831 1831
 
1832
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1832
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1833 1833
 			return $form;
1834 1834
 		}
1835 1835
 
1836 1836
 		// Have Conditional Logic pre-fill fields as if the data were default values
1837 1837
 		/** @var GF_Field $field */
1838
-		foreach ( $form['fields'] as &$field ) {
1838
+		foreach ( $form[ 'fields' ] as &$field ) {
1839 1839
 
1840
-			if( 'checkbox' === $field->type ) {
1840
+			if ( 'checkbox' === $field->type ) {
1841 1841
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1842
-				    $input_id = $input['id'];
1842
+				    $input_id = $input[ 'id' ];
1843 1843
 				    $choice = $field->choices[ $key ];
1844 1844
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1845 1845
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1846
-				    if( $match ) {
1847
-				        $field->choices[ $key ]['isSelected'] = true;
1846
+				    if ( $match ) {
1847
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1848 1848
 				    }
1849 1849
 				}
1850 1850
 			} else {
@@ -1852,15 +1852,15 @@  discard block
 block discarded – undo
1852 1852
 				// We need to run through each field to set the default values
1853 1853
 				foreach ( $this->entry as $field_id => $field_value ) {
1854 1854
 
1855
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1855
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1856 1856
 
1857
-				        if( 'list' === $field->type ) {
1857
+				        if ( 'list' === $field->type ) {
1858 1858
 				            $list_rows = maybe_unserialize( $field_value );
1859 1859
 
1860 1860
 				            $list_field_value = array();
1861
-				            foreach ( (array) $list_rows as $row ) {
1862
-				                foreach ( (array) $row as $column ) {
1863
-				                    $list_field_value[] = $column;
1861
+				            foreach ( (array)$list_rows as $row ) {
1862
+				                foreach ( (array)$row as $column ) {
1863
+				                    $list_field_value[ ] = $column;
1864 1864
 				                }
1865 1865
 				            }
1866 1866
 
@@ -1895,16 +1895,16 @@  discard block
 block discarded – undo
1895 1895
 		 */
1896 1896
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1897 1897
 
1898
-		if( $use_conditional_logic ) {
1898
+		if ( $use_conditional_logic ) {
1899 1899
 			return $form;
1900 1900
 		}
1901 1901
 
1902
-		foreach( $form['fields'] as &$field ) {
1902
+		foreach ( $form[ 'fields' ] as &$field ) {
1903 1903
 			/* @var GF_Field $field */
1904 1904
 			$field->conditionalLogic = null;
1905 1905
 		}
1906 1906
 
1907
-		unset( $form['button']['conditionalLogic'] );
1907
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1908 1908
 
1909 1909
 		return $form;
1910 1910
 
@@ -1921,7 +1921,7 @@  discard block
 block discarded – undo
1921 1921
 	 */
1922 1922
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1923 1923
 
1924
-		if( ! $this->is_edit_entry() ) {
1924
+		if ( ! $this->is_edit_entry() ) {
1925 1925
 			return $has_conditional_logic;
1926 1926
 		}
1927 1927
 
@@ -1953,44 +1953,44 @@  discard block
 block discarded – undo
1953 1953
 		 *  2. There are two entries embedded using oEmbed
1954 1954
 		 *  3. One of the entries has just been saved
1955 1955
 		 */
1956
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1956
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1957 1957
 
1958 1958
 			$error = true;
1959 1959
 
1960 1960
 		}
1961 1961
 
1962
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1962
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1963 1963
 
1964 1964
 			$error = true;
1965 1965
 
1966
-		} elseif( ! $this->verify_nonce() ) {
1966
+		} elseif ( ! $this->verify_nonce() ) {
1967 1967
 
1968 1968
 			/**
1969 1969
 			 * If the Entry is embedded, there may be two entries on the same page.
1970 1970
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1971 1971
 			 */
1972
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1972
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1973 1973
 				$error = true;
1974 1974
 			} else {
1975
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1975
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1976 1976
 			}
1977 1977
 
1978 1978
 		}
1979 1979
 
1980
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1981
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1980
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1981
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1982 1982
 		}
1983 1983
 
1984
-		if( $this->entry['status'] === 'trash' ) {
1985
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1984
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1985
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1986 1986
 		}
1987 1987
 
1988 1988
 		// No errors; everything's fine here!
1989
-		if( empty( $error ) ) {
1989
+		if ( empty( $error ) ) {
1990 1990
 			return true;
1991 1991
 		}
1992 1992
 
1993
-		if( $echo && $error !== true ) {
1993
+		if ( $echo && $error !== true ) {
1994 1994
 
1995 1995
 	        $error = esc_html( $error );
1996 1996
 
@@ -1998,10 +1998,10 @@  discard block
 block discarded – undo
1998 1998
 	         * @since 1.9
1999 1999
 	         */
2000 2000
 	        if ( ! empty( $this->entry ) ) {
2001
-		        $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;" ) );
2001
+		        $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;" ) );
2002 2002
 	        }
2003 2003
 
2004
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2004
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
2005 2005
 		}
2006 2006
 
2007 2007
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2021,17 +2021,17 @@  discard block
 block discarded – undo
2021 2021
 
2022 2022
 		$error = NULL;
2023 2023
 
2024
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2025
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2024
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2025
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2026 2026
 		}
2027 2027
 
2028 2028
 		// No errors; everything's fine here!
2029
-		if( empty( $error ) ) {
2029
+		if ( empty( $error ) ) {
2030 2030
 			return true;
2031 2031
 		}
2032 2032
 
2033
-		if( $echo ) {
2034
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2033
+		if ( $echo ) {
2034
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2035 2035
 		}
2036 2036
 
2037 2037
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2052,14 +2052,14 @@  discard block
 block discarded – undo
2052 2052
 	private function check_user_cap_edit_field( $field ) {
2053 2053
 
2054 2054
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2055
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2055
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2056 2056
 			return true;
2057 2057
 		}
2058 2058
 
2059
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2059
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2060 2060
 
2061
-		if( $field_cap ) {
2062
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2061
+		if ( $field_cap ) {
2062
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2063 2063
 		}
2064 2064
 
2065 2065
 		return false;
@@ -2073,17 +2073,17 @@  discard block
 block discarded – undo
2073 2073
 	public function verify_nonce() {
2074 2074
 
2075 2075
 		// Verify form submitted for editing single
2076
-		if( $this->is_edit_entry_submission() ) {
2076
+		if ( $this->is_edit_entry_submission() ) {
2077 2077
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2078 2078
 		}
2079 2079
 
2080 2080
 		// Verify
2081
-		else if( ! $this->is_edit_entry() ) {
2081
+		else if ( ! $this->is_edit_entry() ) {
2082 2082
 			$valid = false;
2083 2083
 		}
2084 2084
 
2085 2085
 		else {
2086
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2086
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2087 2087
 		}
2088 2088
 
2089 2089
 		/**
Please login to merge, or discard this patch.