Completed
Pull Request — develop (#1404)
by Gennady
06:10
created
includes/extensions/delete-entry/class-delete-entry.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
 		add_action( 'wp', array( $this, 'process_delete' ), 10000 );
44 44
 
45
-		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field'), 10, 3 );
45
+		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
46 46
 
47 47
 		add_action( 'gravityview_before', array( $this, 'maybe_display_message' ) );
48 48
 
49 49
 		// For the Delete Entry Link, you don't want visible to all users.
50
-		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps'), 10, 5 );
50
+		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
51 51
 
52 52
 		// Modify the field options based on the name of the field type
53 53
 		add_filter( 'gravityview_template_delete_link_options', array( $this, 'delete_link_field_options' ), 10, 5 );
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 		// add template path to check for field
56 56
 		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
57 57
 
58
-		add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button'), 10, 4 );
58
+		add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button' ), 10, 4 );
59 59
 
60
-		add_action ( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 );
61
-		add_action ( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 );
60
+		add_action( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 );
61
+		add_action( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 );
62 62
 
63 63
 		add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 );
64 64
 	}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	static function getInstance() {
73 73
 
74
-		if( empty( self::$instance ) ) {
74
+		if ( empty( self::$instance ) ) {
75 75
 			self::$instance = new self;
76 76
 		}
77 77
 
@@ -151,20 +151,20 @@  discard block
 block discarded – undo
151 151
 	function delete_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
152 152
 
153 153
 		// Always a link, never a filter
154
-		unset( $field_options['show_as_link'], $field_options['search_filter'] );
154
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] );
155 155
 
156 156
 		// Delete Entry link should only appear to visitors capable of editing entries
157
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
157
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
158 158
 
159
-		$add_option['delete_link'] = array(
159
+		$add_option[ 'delete_link' ] = array(
160 160
 			'type' => 'text',
161 161
 			'label' => __( 'Delete Link Text', 'gravityview' ),
162 162
 			'desc' => NULL,
163
-			'value' => __('Delete Entry', 'gravityview'),
163
+			'value' => __( 'Delete Entry', 'gravityview' ),
164 164
 			'merge_tags' => true,
165 165
 		);
166 166
 
167
-		$field_options['allow_edit_cap'] = array(
167
+		$field_options[ 'allow_edit_cap' ] = array(
168 168
 			'type' => 'select',
169 169
 			'label' => __( 'Allow the following users to delete the entry:', 'gravityview' ),
170 170
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
190 190
 
191
-		if( 'edit' !== $zone ) {
192
-			$entry_default_fields['delete_link'] = array(
191
+		if ( 'edit' !== $zone ) {
192
+			$entry_default_fields[ 'delete_link' ] = array(
193 193
 				'label' => __( 'Delete Entry', 'gravityview' ),
194 194
 				'type'  => 'delete_link',
195 195
 				'desc'  => __( 'A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview' ),
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	function add_available_field( $available_fields = array() ) {
208 208
 
209
-		$available_fields['delete_link'] = array(
209
+		$available_fields[ 'delete_link' ] = array(
210 210
 			'label_text' => __( 'Delete Entry', 'gravityview' ),
211 211
 			'field_id' => 'delete_link',
212 212
 			'label_type' => 'field',
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 		$caps = $visibility_caps;
235 235
 
236 236
 		// If we're configuring fields in the edit context, we want a limited selection
237
-		if( $field_id === 'delete_link' ) {
237
+		if ( $field_id === 'delete_link' ) {
238 238
 
239 239
 			// Remove other built-in caps.
240
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
240
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] );
241 241
 
242
-			$caps['read'] = _x('Entry Creator', 'User capability', 'gravityview');
242
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
243 243
 		}
244 244
 
245 245
 		return $caps;
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param [type] $entry [description]
253 253
 	 */
254 254
 	function set_entry( $entry = null ) {
255
-		$this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[0] : $entry;
255
+		$this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[ 0 ] : $entry;
256 256
 	}
257 257
 
258 258
 	/**
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
 		self::getInstance()->set_entry( $entry );
287 287
 
288
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
288
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
289 289
 
290 290
 		if ( empty( $base ) ) {
291 291
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		}
294 294
 
295 295
 		// Use the slug instead of the ID for consistent security
296
-		$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
296
+		$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
297 297
 
298 298
 		$actionurl = add_query_arg( array(
299 299
 			'action'	=> 'delete',
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             'view_id' => $view_id,
303 303
 		), $base );
304 304
 
305
-		$url = wp_nonce_url( $actionurl, 'delete_'.$entry_slug, 'delete' );
305
+		$url = wp_nonce_url( $actionurl, 'delete_' . $entry_slug, 'delete' );
306 306
 
307 307
 		return $url;
308 308
 	}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	public function add_delete_button( $form = array(), $entry = array(), $view_id = null, $post_id = null ) {
325 325
 
326 326
 		// Only show the link to those who are allowed to see it.
327
-		if( !self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
327
+		if ( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
328 328
 			return;
329 329
 		}
330 330
 
@@ -335,13 +335,13 @@  discard block
 block discarded – undo
335 335
 		$show_delete_button = apply_filters( 'gravityview/delete-entry/show-delete-button', true );
336 336
 
337 337
 		// If the button is hidden by the filter, don't show.
338
-		if( !$show_delete_button ) {
338
+		if ( ! $show_delete_button ) {
339 339
 			return;
340 340
 		}
341 341
 
342 342
 		$attributes = array(
343 343
 			'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete',
344
-			'tabindex' => ( GFCommon::$tab_index ++ ),
344
+			'tabindex' => ( GFCommon::$tab_index++ ),
345 345
 			'onclick' => self::get_confirm_dialog(),
346 346
 		);
347 347
 
@@ -365,27 +365,27 @@  discard block
 block discarded – undo
365 365
 	function process_delete() {
366 366
 
367 367
 		// If the form is submitted
368
-		if( isset( $_GET['action'] ) && 'delete' === $_GET['action'] && isset( $_GET['entry_id'] ) ) {
368
+		if ( isset( $_GET[ 'action' ] ) && 'delete' === $_GET[ 'action' ] && isset( $_GET[ 'entry_id' ] ) ) {
369 369
 
370 370
 			// Make sure it's a GravityView request
371
-			$valid_nonce_key = wp_verify_nonce( $_GET['delete'], self::get_nonce_key( $_GET['entry_id'] ) );
371
+			$valid_nonce_key = wp_verify_nonce( $_GET[ 'delete' ], self::get_nonce_key( $_GET[ 'entry_id' ] ) );
372 372
 
373
-			if( ! $valid_nonce_key ) {
373
+			if ( ! $valid_nonce_key ) {
374 374
 				gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' );
375 375
 				return;
376 376
 			}
377 377
 
378 378
 			// Get the entry slug
379
-			$entry_slug = esc_attr( $_GET['entry_id'] );
379
+			$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
380 380
 
381 381
 			// See if there's an entry there
382 382
 			$entry = gravityview_get_entry( $entry_slug, true, false );
383 383
 
384
-			if( $entry ) {
384
+			if ( $entry ) {
385 385
 
386 386
 				$has_permission = $this->user_can_delete_entry( $entry, \GV\Utils::_GET( 'gvid', \GV\Utils::_GET( 'view_id' ) ) );
387 387
 
388
-				if( is_wp_error( $has_permission ) ) {
388
+				if ( is_wp_error( $has_permission ) ) {
389 389
 
390 390
 					$messages = array(
391 391
 						'message' => urlencode( $has_permission->get_error_message() ),
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 					// Delete the entry
398 398
 					$delete_response = $this->delete_or_trash_entry( $entry );
399 399
 
400
-					if( is_wp_error( $delete_response ) ) {
400
+					if ( is_wp_error( $delete_response ) ) {
401 401
 
402 402
 						$messages = array(
403 403
 							'message' => urlencode( $delete_response->get_error_message() ),
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 				gravityview()->log->debug( 'Delete entry failed: there was no entry with the entry slug {entry_slug}', array( 'entry_slug' => $entry_slug ) );
420 420
 
421 421
 				$messages = array(
422
-					'message' => urlencode( __('The entry does not exist.', 'gravityview') ),
422
+					'message' => urlencode( __( 'The entry does not exist.', 'gravityview' ) ),
423 423
 					'status' => 'error',
424 424
 				);
425 425
 			}
@@ -459,18 +459,18 @@  discard block
 block discarded – undo
459 459
 	 */
460 460
 	private function delete_or_trash_entry( $entry ) {
461 461
 
462
-		$entry_id = $entry['id'];
462
+		$entry_id = $entry[ 'id' ];
463 463
 		
464 464
 		$mode = $this->get_delete_mode();
465 465
 
466
-		if( 'delete' === $mode ) {
466
+		if ( 'delete' === $mode ) {
467 467
 
468 468
 			gravityview()->log->debug( 'Starting delete entry: {entry_id}', array( 'entry_id' => $entry_id ) );
469 469
 
470 470
 			// Delete the entry
471 471
 			$delete_response = GFAPI::delete_entry( $entry_id );
472 472
 
473
-			if( ! is_wp_error( $delete_response ) ) {
473
+			if ( ! is_wp_error( $delete_response ) ) {
474 474
 				$delete_response = 'deleted';
475 475
 
476 476
 				/**
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
 			$trashed = GFAPI::update_entry_property( $entry_id, 'status', 'trash' );
492 492
 			new GravityView_Cache;
493 493
 
494
-			if( ! $trashed ) {
495
-				$delete_response = new WP_Error( 'trash_entry_failed', __('Moving the entry to the trash failed.', 'gravityview' ) );
494
+			if ( ! $trashed ) {
495
+				$delete_response = new WP_Error( 'trash_entry_failed', __( 'Moving the entry to the trash failed.', 'gravityview' ) );
496 496
 			} else {
497 497
 
498 498
 				/**
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 	public function process_connected_posts( $entry_id = 0, $entry = array() ) {
524 524
 
525 525
 		// The entry had no connected post
526
-		if( empty( $entry['post_id'] ) ) {
526
+		if ( empty( $entry[ 'post_id' ] ) ) {
527 527
 			return;
528 528
 		}
529 529
 
@@ -534,19 +534,19 @@  discard block
 block discarded – undo
534 534
 		 */
535 535
 		$delete_post = apply_filters( 'gravityview/delete-entry/delete-connected-post', true );
536 536
 		
537
-		if( false === $delete_post ) {
537
+		if ( false === $delete_post ) {
538 538
 			return;
539 539
 		}
540 540
 
541 541
 		$action = current_action();
542 542
 
543
-		if( 'gravityview/delete-entry/deleted' === $action ) {
544
-			$result = wp_delete_post( $entry['post_id'], true );
543
+		if ( 'gravityview/delete-entry/deleted' === $action ) {
544
+			$result = wp_delete_post( $entry[ 'post_id' ], true );
545 545
 		} else {
546
-			$result = wp_trash_post( $entry['post_id'] );
546
+			$result = wp_trash_post( $entry[ 'post_id' ] );
547 547
 		}
548 548
 
549
-		if( false === $result ) {
549
+		if ( false === $result ) {
550 550
 			gravityview()->log->error( '(called by {action}): Error processing the Post connected to the entry.', array( 'action' => $action, 'data' => $entry ) );
551 551
 		} else {
552 552
 			gravityview()->log->debug( '(called by {action}): Successfully processed Post connected to the entry.', array( 'action' => $action, 'data' => $entry ) );
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
 	public function verify_nonce() {
563 563
 
564 564
 		// No delete entry request was made
565
-		if( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) {
565
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) {
566 566
 			return false;
567 567
 		}
568 568
 
569
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
569
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
570 570
 
571
-		$valid = wp_verify_nonce( $_GET['delete'], $nonce_key );
571
+		$valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key );
572 572
 
573 573
 		/**
574 574
 		 * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid.
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	public static function get_confirm_dialog() {
592 592
 
593
-		$confirm = __('Are you sure you want to delete this entry? This cannot be undone.', 'gravityview');
593
+		$confirm = __( 'Are you sure you want to delete this entry? This cannot be undone.', 'gravityview' );
594 594
 
595 595
 		/**
596 596
 		 * @filter `gravityview/delete-entry/confirm-text` Modify the Delete Entry Javascript confirmation text
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 		 */
599 599
 		$confirm = apply_filters( 'gravityview/delete-entry/confirm-text', $confirm );
600 600
 
601
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
601
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
602 602
 	}
603 603
 
604 604
 	/**
@@ -616,16 +616,16 @@  discard block
 block discarded – undo
616 616
 
617 617
 		$error = NULL;
618 618
 
619
-		if( ! $this->verify_nonce() ) {
620
-			$error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview');
619
+		if ( ! $this->verify_nonce() ) {
620
+			$error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview' );
621 621
 		}
622 622
 
623
-		if( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
624
-			$error = __( 'You do not have permission to delete this entry.', 'gravityview');
623
+		if ( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
624
+			$error = __( 'You do not have permission to delete this entry.', 'gravityview' );
625 625
 		}
626 626
 
627
-		if( $entry['status'] === 'trash' ) {
628
-			if( 'trash' === $this->get_delete_mode() ) {
627
+		if ( $entry[ 'status' ] === 'trash' ) {
628
+			if ( 'trash' === $this->get_delete_mode() ) {
629 629
 				$error = __( 'The entry is already in the trash.', 'gravityview' );
630 630
 			} else {
631 631
 				$error = __( 'You cannot delete the entry; it is already in the trash.', 'gravityview' );
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 		}
634 634
 
635 635
 		// No errors; everything's fine here!
636
-		if( empty( $error ) ) {
636
+		if ( empty( $error ) ) {
637 637
 			return true;
638 638
 		}
639 639
 
@@ -661,17 +661,17 @@  discard block
 block discarded – undo
661 661
 			$view = \GV\View::by_id( $view_id );
662 662
 		} else {
663 663
 			if ( ! $view instanceof \GV\View ) {
664
-				$view = \GV\View::by_id ( $view );
664
+				$view = \GV\View::by_id( $view );
665 665
 			}
666 666
 			$view_id = $view->ID;
667 667
 		}
668 668
 
669 669
 		$current_user = wp_get_current_user();
670 670
 
671
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : NULL;
671
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : NULL;
672 672
 
673 673
 		// Or if they can delete any entries (as defined in Gravity Forms), we're good.
674
-		if( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) {
674
+		if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) {
675 675
 
676 676
 			gravityview()->log->debug( 'Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.' );
677 677
 
@@ -680,20 +680,20 @@  discard block
 block discarded – undo
680 680
 
681 681
 
682 682
 		// If field options are passed, check if current user can view the link
683
-		if( !empty( $field ) ) {
683
+		if ( ! empty( $field ) ) {
684 684
 
685 685
 			// If capability is not defined, something is not right!
686
-			if( empty( $field['allow_edit_cap'] ) ) {
686
+			if ( empty( $field[ 'allow_edit_cap' ] ) ) {
687 687
 
688 688
 				gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) );
689 689
 
690 690
 				return false;
691 691
 			}
692 692
 
693
-			if( GVCommon::has_cap( $field['allow_edit_cap'] ) ) {
693
+			if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) {
694 694
 
695 695
 				// Do not return true if cap is read, as we need to check if the current user created the entry
696
-				if( $field['allow_edit_cap'] !== 'read' ) {
696
+				if ( $field[ 'allow_edit_cap' ] !== 'read' ) {
697 697
 					return true;
698 698
 				}
699 699
 
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
 
707 707
 		}
708 708
 
709
-		if( !isset( $entry['created_by'] ) ) {
709
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
710 710
 
711
-			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
711
+			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
712 712
 
713 713
 			return false;
714 714
 		}
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 		}
723 723
 
724 724
 		// If the logged-in user is the same as the user who created the entry, we're good.
725
-		if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
725
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
726 726
 
727 727
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
728 728
 
@@ -746,12 +746,12 @@  discard block
 block discarded – undo
746 746
 	 * @return void
747 747
 	 */
748 748
 	public function maybe_display_message( $current_view_id = 0 ) {
749
-		if( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
749
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
750 750
 			return;
751 751
 		}
752 752
 
753 753
 		// Entry wasn't deleted from current View
754
-		if( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) {
754
+		if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) {
755 755
 			return;
756 756
 		}
757 757
 
@@ -760,11 +760,11 @@  discard block
 block discarded – undo
760 760
 
761 761
 	public function display_message() {
762 762
 
763
-		if ( empty( $_GET['status'] ) || empty( $_GET['delete'] ) ) {
763
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'delete' ] ) ) {
764 764
 			return;
765 765
 		}
766 766
 
767
-		$status = esc_attr( $_GET['status'] );
767
+		$status = esc_attr( $_GET[ 'status' ] );
768 768
 		$message_from_url = \GV\Utils::_GET( 'message' );
769 769
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
770 770
 		$class = '';
@@ -772,14 +772,14 @@  discard block
 block discarded – undo
772 772
 		switch ( $status ) {
773 773
 			case 'error':
774 774
 				$class = ' gv-error error';
775
-				$error_message = __('There was an error deleting the entry: %s', 'gravityview');
775
+				$error_message = __( 'There was an error deleting the entry: %s', 'gravityview' );
776 776
 				$message = sprintf( $error_message, $message_from_url );
777 777
 				break;
778 778
 			case 'trashed':
779
-				$message = __('The entry was successfully moved to the trash.', 'gravityview');
779
+				$message = __( 'The entry was successfully moved to the trash.', 'gravityview' );
780 780
 				break;
781 781
 			default:
782
-				$message = __('The entry was successfully deleted.', 'gravityview');
782
+				$message = __( 'The entry was successfully deleted.', 'gravityview' );
783 783
 				break;
784 784
 		}
785 785
 
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
 		$message = apply_filters( 'gravityview/delete-entry/message', esc_attr( $message ), $status, $message_from_url );
794 794
 
795 795
 		// DISPLAY ERROR/SUCCESS MESSAGE
796
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
796
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
797 797
 	}
798 798
 
799 799
 
Please login to merge, or discard this patch.
includes/extensions/duplicate-entry/class-duplicate-entry.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 	public function duplicate_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
116 116
 
117 117
 		// Always a link, never a filter, always same window
118
-		unset( $field_options['show_as_link'], $field_options['search_filter'], $field_options['new_window'] );
118
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ], $field_options[ 'new_window' ] );
119 119
 
120 120
 		// Duplicate Entry link should only appear to visitors capable of editing entries
121
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
121
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
122 122
 
123
-		$add_option['duplicate_link'] = array(
123
+		$add_option[ 'duplicate_link' ] = array(
124 124
 			'type' => 'text',
125 125
 			'label' => __( 'Duplicate Link Text', 'gravityview' ),
126 126
 			'desc' => NULL,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 			'merge_tags' => true,
129 129
 		);
130 130
 
131
-		$field_options['allow_duplicate_cap'] = array(
131
+		$field_options[ 'allow_duplicate_cap' ] = array(
132 132
 			'type' => 'select',
133 133
 			'label' => __( 'Allow the following users to duplicate the entry:', 'gravityview' ),
134 134
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	public function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
156 156
 
157 157
 		if ( 'edit' !== $zone ) {
158
-			$entry_default_fields['duplicate_link'] = array(
158
+			$entry_default_fields[ 'duplicate_link' ] = array(
159 159
 				'label' => __( 'Duplicate Entry', 'gravityview' ),
160 160
 				'type'  => 'duplicate_link',
161 161
 				'desc'  => __( 'A link to duplicate the entry. Respects the Duplicate Entry permissions.', 'gravityview' ),
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function add_available_field( $available_fields = array() ) {
178 178
 
179
-		$available_fields['duplicate_link'] = array(
179
+		$available_fields[ 'duplicate_link' ] = array(
180 180
 			'label_text' => __( 'Duplicate Entry', 'gravityview' ),
181 181
 			'field_id' => 'duplicate_link',
182 182
 			'label_type' => 'field',
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 		if ( 'duplicate_link' === $field_id ) {
210 210
 
211 211
 			// Remove other built-in caps.
212
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['duplicate_others_posts'] );
212
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'duplicate_others_posts' ] );
213 213
 
214
-			$caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' );
214
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
215 215
 		}
216 216
 
217 217
 		return $caps;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
248 248
 
249
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
249
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
250 250
 
251 251
 		if ( empty( $base ) ) {
252 252
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -255,12 +255,12 @@  discard block
 block discarded – undo
255 255
 
256 256
 		$actionurl = add_query_arg( array(
257 257
 			'action'	=> 'duplicate',
258
-			'entry_id'	=> $entry['id'],
258
+			'entry_id'	=> $entry[ 'id' ],
259 259
 			'gvid' => $view_id,
260 260
             'view_id' => $view_id,
261 261
 		), $base );
262 262
 
263
-		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl );
263
+		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry[ 'id' ] ) ), $actionurl );
264 264
 	}
265 265
 
266 266
 	/**
@@ -281,12 +281,12 @@  discard block
 block discarded – undo
281 281
 	public function process_duplicate() {
282 282
 
283 283
 		// If the form is submitted
284
-		if ( ! isset( $_GET['action'] ) || 'duplicate' !== $_GET['action'] || ! isset( $_GET['entry_id'] ) ) {
284
+		if ( ! isset( $_GET[ 'action' ] ) || 'duplicate' !== $_GET[ 'action' ] || ! isset( $_GET[ 'entry_id' ] ) ) {
285 285
 			return;
286 286
 		}
287 287
 
288 288
 		// Make sure it's a GravityView request
289
-		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET['entry_id'] ) );
289
+		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET[ 'entry_id' ] ) );
290 290
 
291 291
 		if ( ! $valid_nonce_key ) {
292 292
 			gravityview()->log->debug( 'Duplicate entry not processed: nonce validation failed.' );
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		}
295 295
 
296 296
 		// Get the entry slug
297
-		$entry_slug = esc_attr( $_GET['entry_id'] );
297
+		$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
298 298
 
299 299
 		// See if there's an entry there
300 300
 		$entry = gravityview_get_entry( $entry_slug, true, false );
@@ -388,15 +388,15 @@  discard block
 block discarded – undo
388 388
 			return new WP_Error( 'gravityview-duplicate-entry-missing', __( 'The entry does not exist.', 'gravityview' ) );
389 389
 		}
390 390
 
391
-		$row['id'] = null;
392
-		$row['date_created'] = date( 'Y-m-d H:i:s', time() );
393
-		$row['date_updated'] = $row['date_created'];
394
-		$row['is_starred'] = false;
395
-		$row['is_read'] = false;
396
-		$row['ip'] = GFFormsModel::get_ip();
397
-		$row['source_url'] = esc_url_raw( remove_query_arg( array( 'action', 'gvid' ) ) );
398
-		$row['user_agent'] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
399
-		$row['created_by'] = wp_get_current_user()->ID;
391
+		$row[ 'id' ] = null;
392
+		$row[ 'date_created' ] = date( 'Y-m-d H:i:s', time() );
393
+		$row[ 'date_updated' ] = $row[ 'date_created' ];
394
+		$row[ 'is_starred' ] = false;
395
+		$row[ 'is_read' ] = false;
396
+		$row[ 'ip' ] = GFFormsModel::get_ip();
397
+		$row[ 'source_url' ] = esc_url_raw( remove_query_arg( array( 'action', 'gvid' ) ) );
398
+		$row[ 'user_agent' ] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
399
+		$row[ 'created_by' ] = wp_get_current_user()->ID;
400 400
 
401 401
 		/**
402 402
 		 * @filter `gravityview/entry/duplicate/details` Modify the new entry details before it's created.
@@ -424,15 +424,15 @@  discard block
 block discarded – undo
424 424
 
425 425
 		$save_this_meta = array();
426 426
 		foreach ( $duplicate_meta->get_output() as $m ) {
427
-			$save_this_meta[] = array(
428
-				'meta_key' => $m['meta_key'],
429
-				'meta_value' => $m['meta_value'],
430
-				'item_index' => $m['item_index'],
427
+			$save_this_meta[ ] = array(
428
+				'meta_key' => $m[ 'meta_key' ],
429
+				'meta_value' => $m[ 'meta_value' ],
430
+				'item_index' => $m[ 'item_index' ],
431 431
 			);
432 432
 		}
433 433
 
434 434
 		// Update the row ID for later usage
435
-		$row['id'] = $duplicated_id;
435
+		$row[ 'id' ] = $duplicated_id;
436 436
 
437 437
 		/**
438 438
 		 * @filter `gravityview/entry/duplicate/meta` Modify the new entry meta details.
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 		$save_this_meta = apply_filters( 'gravityview/entry/duplicate/meta', $save_this_meta, $row, $entry );
444 444
 
445 445
 		foreach ( $save_this_meta as $data ) {
446
-			$data['form_id'] = $entry['form_id'];
447
-			$data['entry_id'] = $duplicated_id;
446
+			$data[ 'form_id' ] = $entry[ 'form_id' ];
447
+			$data[ 'entry_id' ] = $duplicated_id;
448 448
 
449 449
 			if ( ! $wpdb->insert( $entry_meta_table, $data ) ) {
450 450
 				return new WP_Error( 'gravityview-duplicate-entry-db-meta', __( 'There was an error duplicating the entry.', 'gravityview' ) );
@@ -478,13 +478,13 @@  discard block
 block discarded – undo
478 478
 	public function verify_nonce() {
479 479
 
480 480
 		// No duplicate entry request was made
481
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['duplicate'] ) ) {
481
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
482 482
 			return false;
483 483
 		}
484 484
 
485
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
485
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
486 486
 
487
-		$valid = wp_verify_nonce( $_GET['duplicate'], $nonce_key );
487
+		$valid = wp_verify_nonce( $_GET[ 'duplicate' ], $nonce_key );
488 488
 
489 489
 		/**
490 490
 		 * @filter `gravityview/duplicate-entry/verify_nonce` Override Duplicate Entry nonce validation. Return true to declare nonce valid.
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 			return '';
521 521
 		}
522 522
 
523
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
523
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
524 524
 	}
525 525
 
526 526
 	/**
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	public static function check_user_cap_duplicate_entry( $entry, $field = array(), $view_id = 0 ) {
575 575
 		$current_user = wp_get_current_user();
576 576
 
577
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
577
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
578 578
 
579 579
 		// Or if they can duplicate any entries (as defined in Gravity Forms), we're good.
580 580
 		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gform_full_access', 'gravityview_full_access' ), $entry_id ) ) {
@@ -589,17 +589,17 @@  discard block
 block discarded – undo
589 589
 		if ( ! empty( $field ) ) {
590 590
 
591 591
 			// If capability is not defined, something is not right!
592
-			if ( empty( $field['allow_duplicate_cap'] ) ) {
592
+			if ( empty( $field[ 'allow_duplicate_cap' ] ) ) {
593 593
 
594 594
 				gravityview()->log->error( 'Cannot read duplicate entry field caps', array( 'data' => $field ) );
595 595
 
596 596
 				return false;
597 597
 			}
598 598
 
599
-			if ( GVCommon::has_cap( $field['allow_duplicate_cap'] ) ) {
599
+			if ( GVCommon::has_cap( $field[ 'allow_duplicate_cap' ] ) ) {
600 600
 
601 601
 				// Do not return true if cap is read, as we need to check if the current user created the entry
602
-				if ( 'read' !== $field['allow_duplicate_cap'] ) {
602
+				if ( 'read' !== $field[ 'allow_duplicate_cap' ] ) {
603 603
 					return true;
604 604
 				}
605 605
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 
613 613
 		}
614 614
 
615
-		if ( ! isset( $entry['created_by'] ) ) {
615
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
616 616
 
617 617
 			gravityview()->log->error( 'Cannot duplicate entry; entry `created_by` doesn\'t exist.' );
618 618
 
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 		}
638 638
 
639 639
 		// If the logged-in user is the same as the user who created the entry, we're good.
640
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
640
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
641 641
 
642 642
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
643 643
 
@@ -661,12 +661,12 @@  discard block
 block discarded – undo
661 661
 	 * @return void
662 662
 	 */
663 663
 	public function maybe_display_message( $current_view_id = 0 ) {
664
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
664
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
665 665
 			return;
666 666
 		}
667 667
 
668 668
 		// Entry wasn't duplicated from current View
669
-		if ( isset( $_GET['view_id'] ) && ( intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) ) {
669
+		if ( isset( $_GET[ 'view_id' ] ) && ( intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) ) {
670 670
 			return;
671 671
 		}
672 672
 
@@ -674,11 +674,11 @@  discard block
 block discarded – undo
674 674
 	}
675 675
 
676 676
 	public function display_message() {
677
-		if ( empty( $_GET['status'] ) || empty( $_GET['duplicate'] ) ) {
677
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
678 678
 			return;
679 679
 		}
680 680
 
681
-		$status = esc_attr( $_GET['status'] );
681
+		$status = esc_attr( $_GET[ 'status' ] );
682 682
 		$message_from_url = \GV\Utils::_GET( 'message' );
683 683
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
684 684
 		$class = '';
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 		$message = apply_filters( 'gravityview/duplicate-entry/message', esc_attr( $message ), $status, $message_from_url );
705 705
 
706 706
 		// DISPLAY ERROR/SUCCESS MESSAGE
707
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
707
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
708 708
 	}
709 709
 
710 710
 	/**
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 		?>
736 736
 		<span class="duplicate">
737 737
 			|
738
-			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry['id'] ), self::get_nonce_key( $entry['id'] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
738
+			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry[ 'id' ] ), self::get_nonce_key( $entry[ 'id' ] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
739 739
 		</span>
740 740
 		<?php
741 741
 	}
@@ -757,9 +757,9 @@  discard block
 block discarded – undo
757 757
 
758 758
 		if ( 'success' === \GV\Utils::_GET( 'result' ) ) {
759 759
 			add_filter( 'gform_admin_messages', function( $messages ) {
760
-				$messages = (array) $messages;
760
+				$messages = (array)$messages;
761 761
 
762
-				$messages[] = esc_html__( 'Entry duplicated.', 'gravityview' );
762
+				$messages[ ] = esc_html__( 'Entry duplicated.', 'gravityview' );
763 763
 				return $messages;
764 764
 			} );
765 765
 		}
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 
771 771
 			$check_logs_message = '';
772 772
 
773
-			if( $is_logging_active ) {
773
+			if ( $is_logging_active ) {
774 774
 				$check_logs_message = sprintf( ' <a href="%s">%s</a>',
775 775
 					esc_url( admin_url( 'admin.php?page=gf_settings&subview=gravityformslogging' ) ),
776 776
 					esc_html_x( 'Check the GravityView logs for more information.', 'Error message links to logging page', 'gravityview' )
@@ -778,9 +778,9 @@  discard block
 block discarded – undo
778 778
 			}
779 779
 
780 780
 			add_filter( 'gform_admin_error_messages', function( $messages ) use ( $check_logs_message ) {
781
-				$messages = (array) $messages;
781
+				$messages = (array)$messages;
782 782
 
783
-				$messages[] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
783
+				$messages[ ] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
784 784
 
785 785
 				return $messages;
786 786
 			} );
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry.php 2 patches
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -18,82 +18,82 @@  discard block
 block discarded – undo
18 18
 
19 19
 class GravityView_Edit_Entry {
20 20
 
21
-    /**
22
-     * @var string
23
-     */
21
+	/**
22
+	 * @var string
23
+	 */
24 24
 	static $file;
25 25
 
26 26
 	static $instance;
27 27
 
28
-    /**
29
-     * Component instances.
30
-     * @var array
31
-     */
32
-    public $instances = array();
28
+	/**
29
+	 * Component instances.
30
+	 * @var array
31
+	 */
32
+	public $instances = array();
33 33
 
34 34
 
35 35
 	function __construct() {
36 36
 
37
-        self::$file = plugin_dir_path( __FILE__ );
37
+		self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
40
-            $this->load_components( 'admin' );
41
-        }
39
+		if( is_admin() ) {
40
+			$this->load_components( 'admin' );
41
+		}
42 42
 
43 43
 
44
-        $this->load_components( 'render' );
44
+		$this->load_components( 'render' );
45 45
 
46
-        // If GF User Registration Add-on exists
47
-        $this->load_components( 'user-registration' );
46
+		// If GF User Registration Add-on exists
47
+		$this->load_components( 'user-registration' );
48 48
 
49
-        $this->add_hooks();
49
+		$this->add_hooks();
50 50
 
51 51
 		// Process hooks for addons that may or may not be present
52 52
 		$this->addon_specific_hooks();
53 53
 	}
54 54
 
55 55
 
56
-    static function getInstance() {
56
+	static function getInstance() {
57 57
 
58
-        if( empty( self::$instance ) ) {
59
-            self::$instance = new GravityView_Edit_Entry;
60
-        }
58
+		if( empty( self::$instance ) ) {
59
+			self::$instance = new GravityView_Edit_Entry;
60
+		}
61 61
 
62
-        return self::$instance;
63
-    }
62
+		return self::$instance;
63
+	}
64 64
 
65 65
 
66
-    private function load_components( $component ) {
66
+	private function load_components( $component ) {
67 67
 
68
-        $dir = trailingslashit( self::$file );
68
+		$dir = trailingslashit( self::$file );
69 69
 
70
-        $filename  = $dir . 'class-edit-entry-' . $component . '.php';
71
-        $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
70
+		$filename  = $dir . 'class-edit-entry-' . $component . '.php';
71
+		$classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
72 72
 
73
-        // Loads component and pass extension's instance so that component can
74
-        // talk each other.
75
-        require_once $filename;
76
-        $this->instances[ $component ] = new $classname( $this );
77
-        $this->instances[ $component ]->load();
73
+		// Loads component and pass extension's instance so that component can
74
+		// talk each other.
75
+		require_once $filename;
76
+		$this->instances[ $component ] = new $classname( $this );
77
+		$this->instances[ $component ]->load();
78 78
 
79
-    }
79
+	}
80 80
 
81
-    private function add_hooks() {
81
+	private function add_hooks() {
82 82
 
83
-        // Add front-end access to Gravity Forms delete file action
84
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
83
+		// Add front-end access to Gravity Forms delete file action
84
+		add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
85 85
 
86
-        // Make sure this hook is run for non-admins
87
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
86
+		// Make sure this hook is run for non-admins
87
+		add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
88 88
 
89
-        add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
89
+		add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
90 90
 
91
-        // add template path to check for field
92
-        add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
91
+		// add template path to check for field
92
+		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
93 93
 
94 94
 		add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 );
95 95
 
96
-    }
96
+	}
97 97
 
98 98
 	/**
99 99
 	 * Trigger hooks that are normally run in the admin for Addons, but need to be triggered manually because we're not in the admin
@@ -151,74 +151,74 @@  discard block
 block discarded – undo
151 151
 		return false;
152 152
 	}
153 153
 
154
-    /**
155
-     * Include this extension templates path
156
-     * @param array $file_paths List of template paths ordered
157
-     */
158
-    public function add_template_path( $file_paths ) {
159
-
160
-        // Index 100 is the default GravityView template path.
161
-        $file_paths[ 110 ] = self::$file;
162
-
163
-        return $file_paths;
164
-    }
165
-
166
-    /**
167
-     *
168
-     * Return a well formatted nonce key according to GravityView Edit Entry protocol
169
-     *
170
-     * @param $view_id int GravityView view id
171
-     * @param $form_id int Gravity Forms form id
172
-     * @param $entry_id int Gravity Forms entry id
173
-     * @return string
174
-     */
175
-    public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
176
-        return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
177
-    }
178
-
179
-
180
-    /**
181
-     * The edit entry link creates a secure link with a nonce
182
-     *
183
-     * It also mimics the URL structure Gravity Forms expects to have so that
184
-     * it formats the display of the edit form like it does in the backend, like
185
-     * "You can edit this post from the post page" fields, for example.
186
-     *
187
-     * @param $entry array Gravity Forms entry object
188
-     * @param $view_id int GravityView view id
189
-     * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
190
-     * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
191
-     * @return string
192
-     */
193
-    public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
194
-
195
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
196
-
197
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
198
-
199
-        $url = add_query_arg( array(
200
-            'edit' => wp_create_nonce( $nonce_key )
201
-        ), $base );
202
-
203
-        if( $post_id ) {
204
-	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
205
-        }
206
-
207
-	    /**
208
-	     * Allow passing params to dynamically populate entry with values
209
-	     * @since 1.9.2
210
-	     */
211
-	    if( !empty( $field_values ) ) {
212
-
213
-		    if( is_array( $field_values ) ) {
214
-			    // If already an array, no parse_str() needed
215
-			    $params = $field_values;
216
-		    } else {
217
-			    parse_str( $field_values, $params );
218
-		    }
219
-
220
-		    $url = add_query_arg( $params, $url );
221
-	    }
154
+	/**
155
+	 * Include this extension templates path
156
+	 * @param array $file_paths List of template paths ordered
157
+	 */
158
+	public function add_template_path( $file_paths ) {
159
+
160
+		// Index 100 is the default GravityView template path.
161
+		$file_paths[ 110 ] = self::$file;
162
+
163
+		return $file_paths;
164
+	}
165
+
166
+	/**
167
+	 *
168
+	 * Return a well formatted nonce key according to GravityView Edit Entry protocol
169
+	 *
170
+	 * @param $view_id int GravityView view id
171
+	 * @param $form_id int Gravity Forms form id
172
+	 * @param $entry_id int Gravity Forms entry id
173
+	 * @return string
174
+	 */
175
+	public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
176
+		return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
177
+	}
178
+
179
+
180
+	/**
181
+	 * The edit entry link creates a secure link with a nonce
182
+	 *
183
+	 * It also mimics the URL structure Gravity Forms expects to have so that
184
+	 * it formats the display of the edit form like it does in the backend, like
185
+	 * "You can edit this post from the post page" fields, for example.
186
+	 *
187
+	 * @param $entry array Gravity Forms entry object
188
+	 * @param $view_id int GravityView view id
189
+	 * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
190
+	 * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
191
+	 * @return string
192
+	 */
193
+	public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
194
+
195
+		$nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
196
+
197
+		$base = gv_entry_link( $entry, $post_id ? : $view_id  );
198
+
199
+		$url = add_query_arg( array(
200
+			'edit' => wp_create_nonce( $nonce_key )
201
+		), $base );
202
+
203
+		if( $post_id ) {
204
+			$url = add_query_arg( array( 'gvid' => $view_id ), $url );
205
+		}
206
+
207
+		/**
208
+		 * Allow passing params to dynamically populate entry with values
209
+		 * @since 1.9.2
210
+		 */
211
+		if( !empty( $field_values ) ) {
212
+
213
+			if( is_array( $field_values ) ) {
214
+				// If already an array, no parse_str() needed
215
+				$params = $field_values;
216
+			} else {
217
+				parse_str( $field_values, $params );
218
+			}
219
+
220
+			$url = add_query_arg( $params, $url );
221
+		}
222 222
 
223 223
 		/**
224 224
 		 * @filter `gravityview/edit/link` Filter the edit URL link.
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		 * @param \GV\View $view The View.
228 228
 		 */
229 229
 		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
230
-    }
230
+	}
231 231
 
232 232
 	/**
233 233
 	 * Edit mode doesn't allow certain field types.
@@ -282,19 +282,19 @@  discard block
 block discarded – undo
282 282
 	}
283 283
 
284 284
 
285
-    /**
286
-     * checks if user has permissions to edit a specific entry
287
-     *
288
-     * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
289
-     *
290
-     * @param  array $entry Gravity Forms entry array
291
-     * @param \GV\View int $view_id ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
292
-     * @return bool
293
-     */
294
-    public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
285
+	/**
286
+	 * checks if user has permissions to edit a specific entry
287
+	 *
288
+	 * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
289
+	 *
290
+	 * @param  array $entry Gravity Forms entry array
291
+	 * @param \GV\View int $view_id ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
292
+	 * @return bool
293
+	 */
294
+	public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
295 295
 
296
-        // No permission by default
297
-        $user_can_edit = false;
296
+		// No permission by default
297
+		$user_can_edit = false;
298 298
 
299 299
 		// get user_edit setting
300 300
 		if ( empty( $view ) ) {
@@ -312,59 +312,59 @@  discard block
 block discarded – undo
312 312
 			$user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
313 313
 		}
314 314
 
315
-        // If they can edit any entries (as defined in Gravity Forms)
316
-        // Or if they can edit other people's entries
317
-        // Then we're good.
318
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
315
+		// If they can edit any entries (as defined in Gravity Forms)
316
+		// Or if they can edit other people's entries
317
+		// Then we're good.
318
+		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
319 319
 
320
-            gravityview()->log->debug( 'User has ability to edit all entries.' );
320
+			gravityview()->log->debug( 'User has ability to edit all entries.' );
321 321
 
322
-            $user_can_edit = true;
322
+			$user_can_edit = true;
323 323
 
324
-        } else if( !isset( $entry['created_by'] ) ) {
324
+		} else if( !isset( $entry['created_by'] ) ) {
325 325
 
326
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
326
+			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
327 327
 
328
-            $user_can_edit = false;
328
+			$user_can_edit = false;
329 329
 
330
-        } else {
330
+		} else {
331 331
 
332 332
 
333
-            $current_user = wp_get_current_user();
333
+			$current_user = wp_get_current_user();
334 334
 
335
-            // User edit is disabled
336
-            if( empty( $user_edit ) ) {
335
+			// User edit is disabled
336
+			if( empty( $user_edit ) ) {
337 337
 
338
-                gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
338
+				gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
339 339
 
340
-                $user_can_edit = false;
341
-            }
340
+				$user_can_edit = false;
341
+			}
342 342
 
343
-            // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
344
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
343
+			// User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
344
+			else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
345 345
 
346
-                gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
346
+				gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
347 347
 
348
-                $user_can_edit = true;
348
+				$user_can_edit = true;
349 349
 
350
-            } else if( ! is_user_logged_in() ) {
350
+			} else if( ! is_user_logged_in() ) {
351 351
 
352
-                gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
353
-            }
352
+				gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
353
+			}
354 354
 
355
-        }
355
+		}
356 356
 
357
-        /**
358
-         * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
359
-         * @since 1.15 Added `$entry` and `$view_id` parameters
360
-         * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
361
-         * @param[in] array $entry Gravity Forms entry array {@since 1.15}
362
-         * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
363
-         */
364
-        $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
357
+		/**
358
+		 * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
359
+		 * @since 1.15 Added `$entry` and `$view_id` parameters
360
+		 * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
361
+		 * @param[in] array $entry Gravity Forms entry array {@since 1.15}
362
+		 * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
363
+		 */
364
+		$user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
365 365
 
366
-        return (bool)$user_can_edit;
367
-    }
366
+		return (bool)$user_can_edit;
367
+	}
368 368
 
369 369
 
370 370
 
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     static function getInstance() {
57 57
 
58
-        if( empty( self::$instance ) ) {
58
+        if ( empty( self::$instance ) ) {
59 59
             self::$instance = new GravityView_Edit_Entry;
60 60
         }
61 61
 
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
     private function add_hooks() {
82 82
 
83 83
         // Add front-end access to Gravity Forms delete file action
84
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
84
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) );
85 85
 
86 86
         // Make sure this hook is run for non-admins
87
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
87
+        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) );
88 88
 
89 89
         add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
90 90
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	private function addon_specific_hooks() {
103 103
 
104
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
105
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
104
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
105
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
106 106
 		}
107 107
 
108 108
 	}
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
      */
193 193
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
194 194
 
195
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
195
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
196 196
 
197
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
197
+        $base = gv_entry_link( $entry, $post_id ?: $view_id );
198 198
 
199 199
         $url = add_query_arg( array(
200 200
             'edit' => wp_create_nonce( $nonce_key )
201 201
         ), $base );
202 202
 
203
-        if( $post_id ) {
203
+        if ( $post_id ) {
204 204
 	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
205 205
         }
206 206
 
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 	     * Allow passing params to dynamically populate entry with values
209 209
 	     * @since 1.9.2
210 210
 	     */
211
-	    if( !empty( $field_values ) ) {
211
+	    if ( ! empty( $field_values ) ) {
212 212
 
213
-		    if( is_array( $field_values ) ) {
213
+		    if ( is_array( $field_values ) ) {
214 214
 			    // If already an array, no parse_str() needed
215 215
 			    $params = $field_values;
216 216
 		    } else {
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		 * @param array $entry The entry.
227 227
 		 * @param \GV\View $view The View.
228 228
 		 */
229
-		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
229
+		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) );
230 230
     }
231 231
 
232 232
 	/**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	public function modify_field_blacklist( $fields = array(), $context = NULL ) {
239 239
 
240
-		if( empty( $context ) || $context !== 'edit' ) {
240
+		if ( empty( $context ) || $context !== 'edit' ) {
241 241
 			return $fields;
242 242
 		}
243 243
 
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
         // If they can edit any entries (as defined in Gravity Forms)
316 316
         // Or if they can edit other people's entries
317 317
         // Then we're good.
318
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
318
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
319 319
 
320 320
             gravityview()->log->debug( 'User has ability to edit all entries.' );
321 321
 
322 322
             $user_can_edit = true;
323 323
 
324
-        } else if( !isset( $entry['created_by'] ) ) {
324
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
325 325
 
326
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
326
+            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
327 327
 
328 328
             $user_can_edit = false;
329 329
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             $current_user = wp_get_current_user();
334 334
 
335 335
             // User edit is disabled
336
-            if( empty( $user_edit ) ) {
336
+            if ( empty( $user_edit ) ) {
337 337
 
338 338
                 gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
339 339
 
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
             }
342 342
 
343 343
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
344
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
344
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
345 345
 
346 346
                 gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
347 347
 
348 348
                 $user_can_edit = true;
349 349
 
350
-            } else if( ! is_user_logged_in() ) {
350
+            } else if ( ! is_user_logged_in() ) {
351 351
 
352 352
                 gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
353 353
             }
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +242 added lines, -242 removed lines patch added patch discarded remove patch
@@ -135,16 +135,16 @@  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' ) );
142 142
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
143 143
 
144 144
 		// Stop Gravity Forms processing what is ours!
145
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
145
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
146 146
 
147
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
147
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
148 148
 
149 149
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ), 10, 4 );
150 150
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
156 156
 
157 157
 		// Add fields expected by GFFormDisplay::validate()
158
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
158
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
159 159
 
160 160
 		// Fix multiselect value for GF 2.2
161 161
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 * @return void
173 173
 	 */
174 174
 	public function prevent_render_form() {
175
-		if( $this->is_edit_entry() ) {
176
-			if( 'wp_head' === current_filter() ) {
175
+		if ( $this->is_edit_entry() ) {
176
+			if ( 'wp_head' === current_filter() ) {
177 177
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
178 178
 			} else {
179 179
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	public function prevent_maybe_process_form() {
190 190
 
191
-	    if( ! $this->is_edit_entry_submission() ) {
191
+	    if ( ! $this->is_edit_entry_submission() ) {
192 192
 			return;
193 193
 		}
194 194
 
195 195
 		gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] Removing GFForms::maybe_process_form() action.' );
196 196
 
197
-		remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
198
-		remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
197
+		remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
198
+		remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
199 199
 	}
200 200
 
201 201
 	/**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
 		$is_edit_entry =
208 208
 			( GravityView_frontend::is_single_entry() || ( ! empty( gravityview()->request->is_entry() ) ) )
209
-			&& ( ! empty( $_GET['edit'] ) );
209
+			&& ( ! empty( $_GET[ 'edit' ] ) );
210 210
 
211 211
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
212 212
 	}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @return boolean
218 218
 	 */
219 219
 	public function is_edit_entry_submission() {
220
-		return !empty( $_POST[ self::$nonce_field ] );
220
+		return ! empty( $_POST[ self::$nonce_field ] );
221 221
 	}
222 222
 
223 223
 	/**
@@ -230,16 +230,16 @@  discard block
 block discarded – undo
230 230
 
231 231
 
232 232
 		$entries = $gravityview_view->getEntries();
233
-	    self::$original_entry = $entries[0];
234
-	    $this->entry = $entries[0];
233
+	    self::$original_entry = $entries[ 0 ];
234
+	    $this->entry = $entries[ 0 ];
235 235
 
236 236
 		self::$original_form = $gravityview_view->getForm();
237 237
 		$this->form = $gravityview_view->getForm();
238
-		$this->form_id = $this->entry['form_id'];
238
+		$this->form_id = $this->entry[ 'form_id' ];
239 239
 		$this->view_id = $gravityview_view->getViewId();
240 240
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
241 241
 
242
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
242
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
243 243
 	}
244 244
 
245 245
 
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
 	private function print_scripts() {
299 299
 		$gravityview_view = GravityView_View::getInstance();
300 300
 
301
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
301
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
302 302
 
303
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
303
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
304 304
 
305 305
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
306 306
 
@@ -316,19 +316,19 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	private function process_save( $gv_data ) {
318 318
 
319
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
319
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
320 320
 			return;
321 321
 		}
322 322
 
323 323
 		// Make sure the entry, view, and form IDs are all correct
324 324
 		$valid = $this->verify_nonce();
325 325
 
326
-		if ( !$valid ) {
326
+		if ( ! $valid ) {
327 327
 			gravityview()->log->error( 'Nonce validation failed.' );
328 328
 			return;
329 329
 		}
330 330
 
331
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
331
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
332 332
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
333 333
 			return;
334 334
 		}
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
 		$this->validate();
341 341
 
342
-		if( $this->is_valid ) {
342
+		if ( $this->is_valid ) {
343 343
 
344 344
 			gravityview()->log->debug( 'Submission is valid.' );
345 345
 
@@ -351,15 +351,15 @@  discard block
 block discarded – undo
351 351
 			/**
352 352
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
353 353
 			 */
354
-			unset( $_GET['page'] );
354
+			unset( $_GET[ 'page' ] );
355 355
 
356
-			$date_created = $this->entry['date_created'];
356
+			$date_created = $this->entry[ 'date_created' ];
357 357
 
358 358
 			/**
359 359
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
360 360
 			 * @since 1.17.2
361 361
 			 */
362
-			unset( $this->entry['date_created'] );
362
+			unset( $this->entry[ 'date_created' ] );
363 363
 
364 364
 			/**
365 365
 			 * @action `gravityview/edit_entry/before_update` Perform an action after the entry has been updated using Edit Entry
@@ -369,14 +369,14 @@  discard block
 block discarded – undo
369 369
 			 * @param GravityView_Edit_Entry_Render $this This object
370 370
 			 * @param GravityView_View_Data $gv_data The View data
371 371
 			 */
372
-			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry['id'], $this, $gv_data );
372
+			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry[ 'id' ], $this, $gv_data );
373 373
 
374 374
 			GFFormsModel::save_lead( $form, $this->entry );
375 375
 
376 376
 	        // Delete the values for hidden inputs
377 377
 	        $this->unset_hidden_field_values();
378 378
 
379
-			$this->entry['date_created'] = $date_created;
379
+			$this->entry[ 'date_created' ] = $date_created;
380 380
 
381 381
 			// Process calculation fields
382 382
 			$this->update_calculation_fields();
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 			 * @param GravityView_Edit_Entry_Render $this This object
402 402
 			 * @param GravityView_View_Data $gv_data The View data
403 403
 			 */
404
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
404
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
405 405
 
406 406
 		} else {
407 407
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -437,10 +437,10 @@  discard block
 block discarded – undo
437 437
 
438 438
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
439 439
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
440
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
440
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
441 441
 		} else {
442 442
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
443
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
443
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
444 444
 		}
445 445
 
446 446
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -458,11 +458,11 @@  discard block
 block discarded – undo
458 458
 
459 459
 				$empty_value = $field->get_value_save_entry(
460 460
 					is_array( $field->get_entry_inputs() ) ? array() : '',
461
-					$this->form, '', $this->entry['id'], $this->entry
461
+					$this->form, '', $this->entry[ 'id' ], $this->entry
462 462
 				);
463 463
 
464 464
 				if ( $field->has_calculation() ) {
465
-					$this->unset_hidden_calculations[] = $field->id; // Unset
465
+					$this->unset_hidden_calculations[ ] = $field->id; // Unset
466 466
 					$empty_value = '';
467 467
 				}
468 468
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	private function preset_approval_fields() {
492 492
 		$has_approved_field = false;
493 493
 
494
-		foreach ( self::$original_form['fields'] as $field ) {
494
+		foreach ( self::$original_form[ 'fields' ] as $field ) {
495 495
 			if ( $field->gravityview_approved ) {
496 496
 				$has_approved_field = true;
497 497
 				break;
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 
505 505
 		$is_field_hidden = true;
506 506
 
507
-		foreach ( $this->form['fields'] as $field ) {
507
+		foreach ( $this->form[ 'fields' ] as $field ) {
508 508
 			if ( $field->gravityview_approved ) {
509 509
 				$is_field_hidden = false;
510 510
 				break;
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 
530 530
 		remove_filter( 'gravityview/approve_entries/update_unapproved_meta', array( $this, 'prevent_update_unapproved_meta' ), 9 );
531 531
 
532
-		if ( ! $value = gform_get_meta( $entry['id'], 'is_approved' ) ) {
532
+		if ( ! $value = gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
533 533
 
534 534
 			$value = GravityView_Entry_Approval_Status::UNAPPROVED;
535 535
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 		}
595 595
 
596 596
 		/** No file is being uploaded. */
597
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
597
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
598 598
 			/** So return the original upload, with $value as backup (it can be empty during edit form rendering) */
599 599
 			return rgar( $entry, $input_id, $value );
600 600
 		}
@@ -612,11 +612,11 @@  discard block
 block discarded – undo
612 612
 	 * @return mixed
613 613
 	 */
614 614
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
615
-		if( ! $this->is_edit_entry() ) {
615
+		if ( ! $this->is_edit_entry() ) {
616 616
 			return $plupload_init;
617 617
 		}
618 618
 
619
-		$plupload_init['gf_vars']['max_files'] = 0;
619
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
620 620
 
621 621
 		return $plupload_init;
622 622
 	}
@@ -631,27 +631,27 @@  discard block
 block discarded – undo
631 631
 		$form = $this->filter_conditional_logic( $this->form );
632 632
 
633 633
 	    /** @var GF_Field $field */
634
-		foreach( $form['fields'] as $k => &$field ) {
634
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
635 635
 
636 636
 			/**
637 637
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
638 638
 			 * @since 1.16.3
639 639
 			 * @var GF_Field $field
640 640
 			 */
641
-			if( $field->has_calculation() ) {
642
-				unset( $form['fields'][ $k ] );
641
+			if ( $field->has_calculation() ) {
642
+				unset( $form[ 'fields' ][ $k ] );
643 643
 			}
644 644
 
645 645
 			$field->adminOnly = false;
646 646
 
647
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
648
-				foreach( $field->inputs as $key => $input ) {
649
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
647
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
648
+				foreach ( $field->inputs as $key => $input ) {
649
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
650 650
 				}
651 651
 			}
652 652
 		}
653 653
 
654
-		$form['fields'] = array_values( $form['fields'] );
654
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
655 655
 
656 656
 		return $form;
657 657
 	}
@@ -663,14 +663,14 @@  discard block
 block discarded – undo
663 663
 		$update = false;
664 664
 
665 665
 		// get the most up to date entry values
666
-		$entry = GFAPI::get_entry( $this->entry['id'] );
666
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
667 667
 
668 668
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
669 669
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
670
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) );
670
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) );
671 671
 		} else {
672 672
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
673
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) );
673
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) );
674 674
 		}
675 675
 
676 676
 
@@ -687,24 +687,24 @@  discard block
 block discarded – undo
687 687
 				$inputs = $field->get_entry_inputs();
688 688
 				if ( is_array( $inputs ) ) {
689 689
 				    foreach ( $inputs as $input ) {
690
-						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
690
+						list( $field_id, $input_id ) = rgexplode( '.', $input[ 'id' ], 2 );
691 691
 
692 692
 						if ( 'product' === $field->type ) {
693
-							$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
693
+							$input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
694 694
 
695 695
 							// Only allow quantity to be set if it's allowed to be edited
696 696
 							if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) {
697 697
 							} else { // otherwise set to what it previously was
698
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
698
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
699 699
 							}
700 700
 						} else {
701 701
 							// Set to what it previously was if it's not editable
702 702
 							if ( ! in_array( $field_id, $allowed_fields ) ) {
703
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
703
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
704 704
 							}
705 705
 						}
706 706
 
707
-						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
707
+						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] );
708 708
 				    }
709 709
 				} else {
710 710
 					// Set to what it previously was if it's not editable
@@ -744,19 +744,19 @@  discard block
 block discarded – undo
744 744
 
745 745
 		$input_name = 'input_' . $field_id;
746 746
 
747
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
747
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
748 748
 
749 749
 			// We have a new image
750 750
 
751
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
751
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
752 752
 
753 753
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
754 754
 	        $ary = stripslashes_deep( $ary );
755 755
 			$img_url = \GV\Utils::get( $ary, 0 );
756 756
 
757
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
758
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
759
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
757
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
758
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
759
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
760 760
 
761 761
 			$image_meta = array(
762 762
 				'post_excerpt' => $img_caption,
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 
766 766
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
767 767
 			if ( ! empty( $img_title ) ) {
768
-				$image_meta['post_title'] = $img_title;
768
+				$image_meta[ 'post_title' ] = $img_title;
769 769
 			}
770 770
 
771 771
 			/**
@@ -823,15 +823,15 @@  discard block
 block discarded – undo
823 823
 	 */
824 824
 	private function maybe_update_post_fields( $form ) {
825 825
 
826
-		if( empty( $this->entry['post_id'] ) ) {
826
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
827 827
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
828 828
 			return;
829 829
 		}
830 830
 
831
-		$post_id = $this->entry['post_id'];
831
+		$post_id = $this->entry[ 'post_id' ];
832 832
 
833 833
 		// Security check
834
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
834
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
835 835
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
836 836
 			return;
837 837
 		}
@@ -844,25 +844,25 @@  discard block
 block discarded – undo
844 844
 
845 845
 			$field = RGFormsModel::get_field( $form, $field_id );
846 846
 
847
-			if( ! $field ) {
847
+			if ( ! $field ) {
848 848
 				continue;
849 849
 			}
850 850
 
851
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
851
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
852 852
 
853 853
 				// Get the value of the field, including $_POSTed value
854 854
 				$value = RGFormsModel::get_field_value( $field );
855 855
 
856 856
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
857 857
 				$entry_tmp = $this->entry;
858
-				$entry_tmp["{$field_id}"] = $value;
858
+				$entry_tmp[ "{$field_id}" ] = $value;
859 859
 
860
-				switch( $field->type ) {
860
+				switch ( $field->type ) {
861 861
 
862 862
 				    case 'post_title':
863 863
 				        $post_title = $value;
864 864
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
865
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
865
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
866 866
 				        }
867 867
 				        $updated_post->post_title = $post_title;
868 868
 				        $updated_post->post_name  = $post_title;
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 				    case 'post_content':
873 873
 				        $post_content = $value;
874 874
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
875
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
875
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
876 876
 				        }
877 877
 				        $updated_post->post_content = $post_content;
878 878
 				        unset( $post_content );
@@ -890,11 +890,11 @@  discard block
 block discarded – undo
890 890
 							$value = $value[ $field_id ];
891 891
 						}
892 892
 
893
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
893
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
894 894
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
895 895
 				        }
896 896
 
897
-						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
897
+						$value = $field->get_value_save_entry( $value, $form, '', $this->entry[ 'id' ], $this->entry );
898 898
 
899 899
 				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
900 900
 				        break;
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 				}
907 907
 
908 908
 				// update entry after
909
-				$this->entry["{$field_id}"] = $value;
909
+				$this->entry[ "{$field_id}" ] = $value;
910 910
 
911 911
 				$update_entry = true;
912 912
 
@@ -915,11 +915,11 @@  discard block
 block discarded – undo
915 915
 
916 916
 		}
917 917
 
918
-		if( $update_entry ) {
918
+		if ( $update_entry ) {
919 919
 
920 920
 			$return_entry = GFAPI::update_entry( $this->entry );
921 921
 
922
-			if( is_wp_error( $return_entry ) ) {
922
+			if ( is_wp_error( $return_entry ) ) {
923 923
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
924 924
 			} else {
925 925
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 
930 930
 		$return_post = wp_update_post( $updated_post, true );
931 931
 
932
-		if( is_wp_error( $return_post ) ) {
932
+		if ( is_wp_error( $return_post ) ) {
933 933
 			$return_post->add_data( $updated_post, '$updated_post' );
934 934
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
935 935
 		} else {
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
964 964
 
965 965
 		// replace conditional shortcodes
966
-		if( $do_shortcode ) {
966
+		if ( $do_shortcode ) {
967 967
 			$output = do_shortcode( $output );
968 968
 		}
969 969
 
@@ -982,19 +982,19 @@  discard block
 block discarded – undo
982 982
 	 */
983 983
 	private function after_update() {
984 984
 
985
-		do_action( 'gform_after_update_entry', self::$original_form, $this->entry['id'], self::$original_entry );
986
-		do_action( "gform_after_update_entry_{$this->form['id']}", self::$original_form, $this->entry['id'], self::$original_entry );
985
+		do_action( 'gform_after_update_entry', self::$original_form, $this->entry[ 'id' ], self::$original_entry );
986
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", self::$original_form, $this->entry[ 'id' ], self::$original_entry );
987 987
 
988 988
 		// Re-define the entry now that we've updated it.
989
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
989
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
990 990
 
991 991
 		$entry = GFFormsModel::set_entry_meta( $entry, self::$original_form );
992 992
 
993 993
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
994 994
 			// We need to clear the cache because Gravity Forms caches the field values, which
995 995
 			// we have just updated.
996
-			foreach ($this->form['fields'] as $key => $field) {
997
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
996
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
997
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
998 998
 			}
999 999
 		}
1000 1000
 
@@ -1004,11 +1004,11 @@  discard block
 block discarded – undo
1004 1004
 		 * @since develop
1005 1005
 		 */
1006 1006
 		if ( $allowed_feeds = $this->view->settings->get( 'edit_feeds', array() ) ) {
1007
-			$feeds = GFAPI::get_feeds( null, $entry['form_id'] );
1007
+			$feeds = GFAPI::get_feeds( null, $entry[ 'form_id' ] );
1008 1008
 			if ( ! is_wp_error( $feeds ) ) {
1009 1009
 				$registered_feeds = array();
1010 1010
 				foreach ( GFAddOn::get_registered_addons() as $registered_feed ) {
1011
-					if ( is_subclass_of( $registered_feed,  'GFFeedAddOn' ) ) {
1011
+					if ( is_subclass_of( $registered_feed, 'GFFeedAddOn' ) ) {
1012 1012
 						if ( method_exists( $registered_feed, 'get_instance' ) ) {
1013 1013
 							$registered_feed = call_user_func( array( $registered_feed, 'get_instance' ) );
1014 1014
 							$registered_feeds[ $registered_feed->get_slug() ] = $registered_feed;
@@ -1016,8 +1016,8 @@  discard block
 block discarded – undo
1016 1016
 					}
1017 1017
 				}
1018 1018
 				foreach ( $feeds as $feed ) {
1019
-					if ( in_array( $feed['id'], $allowed_feeds ) ) {
1020
-						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed['addon_slug'] ) ) {
1019
+					if ( in_array( $feed[ 'id' ], $allowed_feeds ) ) {
1020
+						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed[ 'addon_slug' ] ) ) {
1021 1021
 							$returned_entry = $feed_object->process_feed( $feed, $entry, self::$original_form );
1022 1022
 							if ( is_array( $returned_entry ) && rgar( $returned_entry, 'id' ) ) {
1023 1023
 								$entry = $returned_entry;
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
 		<div class="gv-edit-entry-wrapper"><?php
1049 1049
 
1050
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
1050
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
1051 1051
 
1052 1052
 			/**
1053 1053
 			 * Fixes weird wpautop() issue
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
1064 1064
 				     * @param GravityView_Edit_Entry_Render $this This object
1065 1065
 				     */
1066
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
1066
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
1067 1067
 
1068 1068
 				    echo esc_attr( $edit_entry_title );
1069 1069
 			?></span>
@@ -1129,18 +1129,18 @@  discard block
 block discarded – undo
1129 1129
 				*/
1130 1130
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1131 1131
 
1132
-				$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit'];
1132
+				$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels[ 'submit' ];
1133 1133
 			}
1134 1134
 
1135 1135
 			$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
1136 1136
 
1137
-			if( ! $this->is_valid ){
1137
+			if ( ! $this->is_valid ) {
1138 1138
 
1139 1139
 				// Keeping this compatible with Gravity Forms.
1140
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
1141
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
1140
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
1141
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
1142 1142
 
1143
-				echo GVCommon::generate_notice( $message , 'gv-error' );
1143
+				echo GVCommon::generate_notice( $message, 'gv-error' );
1144 1144
 
1145 1145
 			} elseif ( false === $this->is_paged_submitted ) {
1146 1146
 				// Paged form that hasn't been submitted on the last page yet
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 				 * @param int $view_id View ID
1154 1154
 				 * @param array $entry Gravity Forms entry array
1155 1155
 				 */
1156
-				$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message , $this->view_id, $this->entry );
1156
+				$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message, $this->view_id, $this->entry );
1157 1157
 
1158 1158
 				echo GVCommon::generate_notice( $message );
1159 1159
 			} else {
@@ -1165,23 +1165,23 @@  discard block
 block discarded – undo
1165 1165
 
1166 1166
                     case '0':
1167 1167
 	                    $redirect_url = $back_link;
1168
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1168
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' );
1169 1169
                         break;
1170 1170
 
1171 1171
                     case '1':
1172 1172
 	                    $redirect_url = $directory_link = GravityView_API::directory_link();
1173
-	                    $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>' );
1173
+	                    $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>' );
1174 1174
 	                    break;
1175 1175
 
1176 1176
                     case '2':
1177 1177
 	                    $redirect_url = $edit_redirect_url;
1178 1178
 	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1179
-	                    $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>' );
1179
+	                    $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>' );
1180 1180
                         break;
1181 1181
 
1182 1182
                     case '':
1183 1183
                     default:
1184
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1184
+					    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' );
1185 1185
                         break;
1186 1186
 				}
1187 1187
 
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 				 * @param array $entry Gravity Forms entry array
1198 1198
 				 * @param string $back_link URL to return to the original entry. @since 1.6
1199 1199
 				 */
1200
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
1200
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
1201 1201
 
1202 1202
 				echo GVCommon::generate_notice( $message );
1203 1203
 			}
@@ -1221,8 +1221,8 @@  discard block
 block discarded – undo
1221 1221
 		 */
1222 1222
 		do_action( 'gravityview/edit-entry/render/before', $this );
1223 1223
 
1224
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1225
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1224
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1225
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1226 1226
 		add_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1227 1227
 		add_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
1228 1228
 		add_filter( 'gform_disable_view_counter', '__return_true' );
@@ -1231,14 +1231,14 @@  discard block
 block discarded – undo
1231 1231
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1232 1232
 
1233 1233
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1234
-		unset( $_GET['page'] );
1234
+		unset( $_GET[ 'page' ] );
1235 1235
 
1236 1236
 		$this->show_next_button = false;
1237 1237
 		$this->show_previous_button = false;
1238 1238
 
1239 1239
 		// TODO: Verify multiple-page forms
1240 1240
 		if ( GFCommon::has_pages( $this->form ) && apply_filters( 'gravityview/features/paged-edit', false ) ) {
1241
-			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form['id'], 0 ) ) ) {
1241
+			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form[ 'id' ], 0 ) ) ) {
1242 1242
 
1243 1243
 				$labels = array(
1244 1244
 					'cancel'   => __( 'Cancel', 'gravityview' ),
@@ -1257,20 +1257,20 @@  discard block
 block discarded – undo
1257 1257
 				*/
1258 1258
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1259 1259
 
1260
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
1261
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'is_valid' ] = true;
1260
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'form' ] = $this->form;
1261
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'is_valid' ] = true;
1262 1262
 
1263
-				if ( \GV\Utils::_POST( 'save' ) === $labels['next'] ) {
1263
+				if ( \GV\Utils::_POST( 'save' ) === $labels[ 'next' ] ) {
1264 1264
 					$last_page = \GFFormDisplay::get_max_page_number( $this->form );
1265 1265
 
1266 1266
 					while ( ++$page_number < $last_page && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1267 1267
 					} // Advance to next visible page
1268
-				} elseif ( \GV\Utils::_POST( 'save' ) === $labels['previous'] ) {
1268
+				} elseif ( \GV\Utils::_POST( 'save' ) === $labels[ 'previous' ] ) {
1269 1269
 					while ( --$page_number > 1 && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1270 1270
 					} // Advance to next visible page
1271 1271
 				}
1272 1272
 
1273
-				GFFormDisplay::$submission[ $this->form['id'] ]['page_number'] = $page_number;
1273
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'page_number' ] = $page_number;
1274 1274
 			}
1275 1275
 
1276 1276
 			if ( ( $page_number = intval( $page_number ) ) < 2 ) {
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 
1297 1297
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1298 1298
 
1299
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1299
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1300 1300
 
1301 1301
 		ob_get_clean();
1302 1302
 
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
 	 * @return string
1325 1325
 	 */
1326 1326
 	public function render_form_buttons() {
1327
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1327
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1328 1328
 	}
1329 1329
 
1330 1330
 
@@ -1343,15 +1343,15 @@  discard block
 block discarded – undo
1343 1343
 	 */
1344 1344
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1345 1345
 
1346
-		if( $form['id'] != $this->form_id ) {
1346
+		if ( $form[ 'id' ] != $this->form_id ) {
1347 1347
 			return $form;
1348 1348
 		}
1349 1349
 
1350 1350
 		// In case we have validated the form, use it to inject the validation results into the form render
1351
-		if( isset( $this->form_after_validation ) && $this->form_after_validation['id'] === $form['id'] ) {
1351
+		if ( isset( $this->form_after_validation ) && $this->form_after_validation[ 'id' ] === $form[ 'id' ] ) {
1352 1352
 			$form = $this->form_after_validation;
1353 1353
 		} else {
1354
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1354
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1355 1355
 		}
1356 1356
 
1357 1357
 		$form = $this->filter_conditional_logic( $form );
@@ -1359,8 +1359,8 @@  discard block
 block discarded – undo
1359 1359
 		$form = $this->prefill_conditional_logic( $form );
1360 1360
 
1361 1361
 		// for now we don't support Save and Continue feature.
1362
-		if( ! self::$supports_save_and_continue ) {
1363
-	        unset( $form['save'] );
1362
+		if ( ! self::$supports_save_and_continue ) {
1363
+	        unset( $form[ 'save' ] );
1364 1364
 		}
1365 1365
 
1366 1366
 		$form = $this->unselect_default_values( $form );
@@ -1383,31 +1383,31 @@  discard block
 block discarded – undo
1383 1383
 	 */
1384 1384
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1385 1385
 
1386
-		if( ! GFCommon::is_post_field( $field ) ) {
1386
+		if ( ! GFCommon::is_post_field( $field ) ) {
1387 1387
 			return $field_content;
1388 1388
 		}
1389 1389
 
1390 1390
         $message = null;
1391 1391
 
1392 1392
         // First, make sure they have the capability to edit the post.
1393
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1393
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1394 1394
 
1395 1395
             /**
1396 1396
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1397 1397
              * @param string $message The existing "You don't have permission..." text
1398 1398
              */
1399
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1399
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1400 1400
 
1401
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1401
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1402 1402
             /**
1403 1403
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1404 1404
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1405 1405
              */
1406
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1406
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1407 1407
         }
1408 1408
 
1409
-        if( $message ) {
1410
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1409
+        if ( $message ) {
1410
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1411 1411
         }
1412 1412
 
1413 1413
         return $field_content;
@@ -1431,8 +1431,8 @@  discard block
 block discarded – undo
1431 1431
 
1432 1432
 		// If the form has been submitted, then we don't need to pre-fill the values,
1433 1433
 		// Except for fileupload type and when a field input is overridden- run always!!
1434
-		if(
1435
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1434
+		if (
1435
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1436 1436
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1437 1437
 			&& ! GFCommon::is_product_field( $field->type )
1438 1438
 			|| ! empty( $field_content )
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
 	    $return = null;
1453 1453
 
1454 1454
 		/** @var GravityView_Field $gv_field */
1455
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1455
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1456 1456
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1457 1457
 		} else {
1458 1458
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 	    // If there was output, it's an error
1462 1462
 	    $warnings = ob_get_clean();
1463 1463
 
1464
-	    if( !empty( $warnings ) ) {
1464
+	    if ( ! empty( $warnings ) ) {
1465 1465
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1466 1466
 	    }
1467 1467
 
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1487 1487
 
1488 1488
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1489
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1489
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1490 1490
 
1491 1491
 			$field_value = array();
1492 1492
 
@@ -1495,10 +1495,10 @@  discard block
 block discarded – undo
1495 1495
 
1496 1496
 			foreach ( (array)$field->inputs as $input ) {
1497 1497
 
1498
-				$input_id = strval( $input['id'] );
1498
+				$input_id = strval( $input[ 'id' ] );
1499 1499
 
1500 1500
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1501
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1501
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1502 1502
 				    $allow_pre_populated = false;
1503 1503
 				}
1504 1504
 
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
 
1507 1507
 			$pre_value = $field->get_value_submission( array(), false );
1508 1508
 
1509
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1509
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1510 1510
 
1511 1511
 		} else {
1512 1512
 
@@ -1517,13 +1517,13 @@  discard block
 block discarded – undo
1517 1517
 
1518 1518
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1519 1519
 			// or pre-populated value if not empty and set to override saved value
1520
-			$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;
1520
+			$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;
1521 1521
 
1522 1522
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1523
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1523
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1524 1524
 				$categories = array();
1525 1525
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1526
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1526
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1527 1527
 				}
1528 1528
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1529 1529
 			}
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 	     * @param GF_Field $field Gravity Forms field object
1552 1552
 	     * @param GravityView_Edit_Entry_Render $this Current object
1553 1553
 	     */
1554
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1554
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1555 1555
 
1556 1556
 		return $field_value;
1557 1557
 	}
@@ -1568,12 +1568,12 @@  discard block
 block discarded – undo
1568 1568
 	 */
1569 1569
 	public function gform_pre_validation( $form ) {
1570 1570
 
1571
-		if( ! $this->verify_nonce() ) {
1571
+		if ( ! $this->verify_nonce() ) {
1572 1572
 			return $form;
1573 1573
 		}
1574 1574
 
1575 1575
 		// Fix PHP warning regarding undefined index.
1576
-		foreach ( $form['fields'] as &$field) {
1576
+		foreach ( $form[ 'fields' ] as &$field ) {
1577 1577
 
1578 1578
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1579 1579
 			// expects certain field array items to be set.
@@ -1581,7 +1581,7 @@  discard block
 block discarded – undo
1581 1581
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1582 1582
 			}
1583 1583
 
1584
-			switch( RGFormsModel::get_input_type( $field ) ) {
1584
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1585 1585
 
1586 1586
 				/**
1587 1587
 				 * 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.
@@ -1595,26 +1595,26 @@  discard block
 block discarded – undo
1595 1595
 				    // Set the previous value
1596 1596
 				    $entry = $this->get_entry();
1597 1597
 
1598
-				    $input_name = 'input_'.$field->id;
1599
-				    $form_id = $form['id'];
1598
+				    $input_name = 'input_' . $field->id;
1599
+				    $form_id = $form[ 'id' ];
1600 1600
 
1601 1601
 				    $value = NULL;
1602 1602
 
1603 1603
 				    // Use the previous entry value as the default.
1604
-				    if( isset( $entry[ $field->id ] ) ) {
1604
+				    if ( isset( $entry[ $field->id ] ) ) {
1605 1605
 				        $value = $entry[ $field->id ];
1606 1606
 				    }
1607 1607
 
1608 1608
 				    // If this is a single upload file
1609
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1610
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1611
-				        $value = $file_path['url'];
1609
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1610
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1611
+				        $value = $file_path[ 'url' ];
1612 1612
 
1613 1613
 				    } else {
1614 1614
 
1615 1615
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1616 1616
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1617
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1617
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1618 1618
 
1619 1619
 				    }
1620 1620
 
@@ -1622,10 +1622,10 @@  discard block
 block discarded – undo
1622 1622
 
1623 1623
 				        // If there are fresh uploads, process and merge them.
1624 1624
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1625
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1625
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1626 1626
 				            $value = empty( $value ) ? '[]' : $value;
1627 1627
 				            $value = stripslashes_deep( $value );
1628
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1628
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1629 1629
 				        }
1630 1630
 
1631 1631
 				    } else {
@@ -1643,8 +1643,8 @@  discard block
 block discarded – undo
1643 1643
 
1644 1644
 				case 'number':
1645 1645
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1646
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1647
-				        $_POST['input_'.$field->id ] = NULL;
1646
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1647
+				        $_POST[ 'input_' . $field->id ] = NULL;
1648 1648
 				    }
1649 1649
 				    break;
1650 1650
 			}
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
 		 * You can enter whatever you want!
1682 1682
 		 * We try validating, and customize the results using `self::custom_validation()`
1683 1683
 		 */
1684
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1684
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1685 1685
 
1686 1686
 		// Needed by the validate funtion
1687 1687
 		$failed_validation_page = NULL;
@@ -1689,14 +1689,14 @@  discard block
 block discarded – undo
1689 1689
 
1690 1690
 		// Prevent entry limit from running when editing an entry, also
1691 1691
 		// prevent form scheduling from preventing editing
1692
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1692
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1693 1693
 
1694 1694
 		// Hide fields depending on Edit Entry settings
1695
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1695
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1696 1696
 
1697 1697
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1698 1698
 
1699
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1699
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1700 1700
 	}
1701 1701
 
1702 1702
 
@@ -1719,7 +1719,7 @@  discard block
 block discarded – undo
1719 1719
 
1720 1720
 		$gv_valid = true;
1721 1721
 
1722
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1722
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1723 1723
 
1724 1724
 			$value = RGFormsModel::get_field_value( $field );
1725 1725
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1732,22 +1732,22 @@  discard block
 block discarded – undo
1732 1732
 				case 'post_image':
1733 1733
 
1734 1734
 				    // in case nothing is uploaded but there are already files saved
1735
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1735
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1736 1736
 				        $field->failed_validation = false;
1737 1737
 				        unset( $field->validation_message );
1738 1738
 				    }
1739 1739
 
1740 1740
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1741
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1741
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1742 1742
 
1743 1743
 				        $input_name = 'input_' . $field->id;
1744 1744
 				        //uploaded
1745
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1745
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1746 1746
 
1747 1747
 				        //existent
1748 1748
 				        $entry = $this->get_entry();
1749 1749
 				        $value = NULL;
1750
-				        if( isset( $entry[ $field->id ] ) ) {
1750
+				        if ( isset( $entry[ $field->id ] ) ) {
1751 1751
 				            $value = json_decode( $entry[ $field->id ], true );
1752 1752
 				        }
1753 1753
 
@@ -1755,13 +1755,13 @@  discard block
 block discarded – undo
1755 1755
 				        $count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1756 1756
 						               ( is_array( $value ) ? count( $value ) : 0 );
1757 1757
 
1758
-				        if( $count_files > $field->maxFiles ) {
1758
+				        if ( $count_files > $field->maxFiles ) {
1759 1759
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1760 1760
 				            $field->failed_validation = 1;
1761 1761
 				            $gv_valid = false;
1762 1762
 
1763 1763
 				            // in case of error make sure the newest upload files are removed from the upload input
1764
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1764
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1765 1765
 				        }
1766 1766
 
1767 1767
 				    }
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 			}
1773 1773
 
1774 1774
 			// This field has failed validation.
1775
-			if( !empty( $field->failed_validation ) ) {
1775
+			if ( ! empty( $field->failed_validation ) ) {
1776 1776
 
1777 1777
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1778 1778
 
@@ -1790,19 +1790,19 @@  discard block
 block discarded – undo
1790 1790
 				}
1791 1791
 
1792 1792
 				// You can't continue inside a switch, so we do it after.
1793
-				if( empty( $field->failed_validation ) ) {
1793
+				if ( empty( $field->failed_validation ) ) {
1794 1794
 				    continue;
1795 1795
 				}
1796 1796
 
1797 1797
 				// checks if the No Duplicates option is not validating entry against itself, since
1798 1798
 				// we're editing a stored entry, it would also assume it's a duplicate.
1799
-				if( !empty( $field->noDuplicates ) ) {
1799
+				if ( ! empty( $field->noDuplicates ) ) {
1800 1800
 
1801 1801
 				    $entry = $this->get_entry();
1802 1802
 
1803 1803
 				    // If the value of the entry is the same as the stored value
1804 1804
 				    // Then we can assume it's not a duplicate, it's the same.
1805
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1805
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1806 1806
 				        //if value submitted was not changed, then don't validate
1807 1807
 				        $field->failed_validation = false;
1808 1808
 
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
 				}
1816 1816
 
1817 1817
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1818
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1818
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1819 1819
 				    unset( $field->validation_message );
1820 1820
 	                $field->validation_message = false;
1821 1821
 				    continue;
@@ -1827,12 +1827,12 @@  discard block
 block discarded – undo
1827 1827
 
1828 1828
 		}
1829 1829
 
1830
-		$validation_results['is_valid'] = $gv_valid;
1830
+		$validation_results[ 'is_valid' ] = $gv_valid;
1831 1831
 
1832 1832
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1833 1833
 
1834 1834
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1835
-		$this->form_after_validation = $validation_results['form'];
1835
+		$this->form_after_validation = $validation_results[ 'form' ];
1836 1836
 
1837 1837
 		return $validation_results;
1838 1838
 	}
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
 	 */
1846 1846
 	public function get_entry() {
1847 1847
 
1848
-		if( empty( $this->entry ) ) {
1848
+		if ( empty( $this->entry ) ) {
1849 1849
 			// Get the database value of the entry that's being edited
1850 1850
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1851 1851
 		}
@@ -1877,10 +1877,10 @@  discard block
 block discarded – undo
1877 1877
 		}
1878 1878
 
1879 1879
 		// If edit tab not yet configured, show all fields
1880
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1880
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1881 1881
 
1882 1882
 		// Hide fields depending on admin settings
1883
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1883
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1884 1884
 
1885 1885
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1886 1886
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
 	 */
1914 1914
 	private function filter_fields( $fields, $configured_fields ) {
1915 1915
 
1916
-		if( empty( $fields ) || !is_array( $fields ) ) {
1916
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1917 1917
 			return $fields;
1918 1918
 		}
1919 1919
 
@@ -1930,12 +1930,12 @@  discard block
 block discarded – undo
1930 1930
 
1931 1931
 			// Remove the fields that have calculation properties and keep them to be used later
1932 1932
 			// @since 1.16.2
1933
-			if( $field->has_calculation() ) {
1934
-				$this->fields_with_calculation[] = $field;
1933
+			if ( $field->has_calculation() ) {
1934
+				$this->fields_with_calculation[ ] = $field;
1935 1935
 				// don't remove the calculation fields on form render.
1936 1936
 			}
1937 1937
 
1938
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1938
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1939 1939
 				unset( $fields[ $key ] );
1940 1940
 			}
1941 1941
 		}
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 					continue; // Same
1954 1954
 				}
1955 1955
 
1956
-				$out_fields[] = $field;
1956
+				$out_fields[ ] = $field;
1957 1957
 			}
1958 1958
 
1959 1959
 			return array_values( $out_fields );
@@ -1964,8 +1964,8 @@  discard block
 block discarded – undo
1964 1964
 
1965 1965
 	        /** @var GF_Field $field */
1966 1966
 	        foreach ( $fields as $field ) {
1967
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1968
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1967
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1968
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1969 1969
 				    break;
1970 1970
 				}
1971 1971
 
@@ -1988,14 +1988,14 @@  discard block
 block discarded – undo
1988 1988
 
1989 1989
 		$return_field = $field;
1990 1990
 
1991
-		if( empty( $field_setting['show_label'] ) ) {
1991
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1992 1992
 			$return_field->label = '';
1993
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1994
-			$return_field->label = $field_setting['custom_label'];
1993
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1994
+			$return_field->label = $field_setting[ 'custom_label' ];
1995 1995
 		}
1996 1996
 
1997
-		if( !empty( $field_setting['custom_class'] ) ) {
1998
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1997
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1998
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1999 1999
 		}
2000 2000
 
2001 2001
 		/**
@@ -2033,16 +2033,16 @@  discard block
 block discarded – undo
2033 2033
 	     */
2034 2034
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2035 2035
 
2036
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2037
-			foreach( $fields as $k => $field ) {
2038
-				if( $field->adminOnly ) {
2036
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
2037
+			foreach ( $fields as $k => $field ) {
2038
+				if ( $field->adminOnly ) {
2039 2039
 				    unset( $fields[ $k ] );
2040 2040
 				}
2041 2041
 			}
2042 2042
 			return array_values( $fields );
2043 2043
 		}
2044 2044
 
2045
-	    foreach( $fields as &$field ) {
2045
+	    foreach ( $fields as &$field ) {
2046 2046
 		    $field->adminOnly = false;
2047 2047
 		}
2048 2048
 
@@ -2063,7 +2063,7 @@  discard block
 block discarded – undo
2063 2063
 	 */
2064 2064
 	private function unselect_default_values( $form ) {
2065 2065
 
2066
-	    foreach ( $form['fields'] as &$field ) {
2066
+	    foreach ( $form[ 'fields' ] as &$field ) {
2067 2067
 
2068 2068
 			if ( empty( $field->choices ) ) {
2069 2069
                 continue;
@@ -2071,7 +2071,7 @@  discard block
 block discarded – undo
2071 2071
 
2072 2072
             foreach ( $field->choices as &$choice ) {
2073 2073
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2074
-					$choice['isSelected'] = false;
2074
+					$choice[ 'isSelected' ] = false;
2075 2075
 				}
2076 2076
 			}
2077 2077
 		}
@@ -2096,22 +2096,22 @@  discard block
 block discarded – undo
2096 2096
 	 */
2097 2097
 	function prefill_conditional_logic( $form ) {
2098 2098
 
2099
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2099
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2100 2100
 			return $form;
2101 2101
 		}
2102 2102
 
2103 2103
 		// Have Conditional Logic pre-fill fields as if the data were default values
2104 2104
 		/** @var GF_Field $field */
2105
-		foreach ( $form['fields'] as &$field ) {
2105
+		foreach ( $form[ 'fields' ] as &$field ) {
2106 2106
 
2107
-			if( 'checkbox' === $field->type ) {
2107
+			if ( 'checkbox' === $field->type ) {
2108 2108
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2109
-				    $input_id = $input['id'];
2109
+				    $input_id = $input[ 'id' ];
2110 2110
 				    $choice = $field->choices[ $key ];
2111 2111
 				    $value = \GV\Utils::get( $this->entry, $input_id );
2112 2112
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2113
-				    if( $match ) {
2114
-				        $field->choices[ $key ]['isSelected'] = true;
2113
+				    if ( $match ) {
2114
+				        $field->choices[ $key ][ 'isSelected' ] = true;
2115 2115
 				    }
2116 2116
 				}
2117 2117
 			} else {
@@ -2119,15 +2119,15 @@  discard block
 block discarded – undo
2119 2119
 				// We need to run through each field to set the default values
2120 2120
 				foreach ( $this->entry as $field_id => $field_value ) {
2121 2121
 
2122
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2122
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
2123 2123
 
2124
-				        if( 'list' === $field->type ) {
2124
+				        if ( 'list' === $field->type ) {
2125 2125
 				            $list_rows = maybe_unserialize( $field_value );
2126 2126
 
2127 2127
 				            $list_field_value = array();
2128
-				            foreach ( (array) $list_rows as $row ) {
2129
-				                foreach ( (array) $row as $column ) {
2130
-				                    $list_field_value[] = $column;
2128
+				            foreach ( (array)$list_rows as $row ) {
2129
+				                foreach ( (array)$row as $column ) {
2130
+				                    $list_field_value[ ] = $column;
2131 2131
 				                }
2132 2132
 				            }
2133 2133
 
@@ -2160,32 +2160,32 @@  discard block
 block discarded – undo
2160 2160
 		 * @see https://github.com/gravityview/GravityView/issues/840
2161 2161
 		 * @since develop
2162 2162
 		 */
2163
-		$the_form = GFAPI::get_form( $form['id'] );
2163
+		$the_form = GFAPI::get_form( $form[ 'id' ] );
2164 2164
 		$editable_ids = array();
2165
-		foreach ( $form['fields'] as $field ) {
2166
-			$editable_ids[] = $field['id']; // wp_list_pluck is destructive in this context
2165
+		foreach ( $form[ 'fields' ] as $field ) {
2166
+			$editable_ids[ ] = $field[ 'id' ]; // wp_list_pluck is destructive in this context
2167 2167
 		}
2168 2168
 		$remove_conditions_rule = array();
2169
-		foreach ( $the_form['fields'] as $field ) {
2170
-			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic['rules'] ) ) {
2171
-				foreach ( $field->conditionalLogic['rules'] as $i => $rule ) {
2172
-					if ( ! in_array( $rule['fieldId'], $editable_ids ) ) {
2169
+		foreach ( $the_form[ 'fields' ] as $field ) {
2170
+			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic[ 'rules' ] ) ) {
2171
+				foreach ( $field->conditionalLogic[ 'rules' ] as $i => $rule ) {
2172
+					if ( ! in_array( $rule[ 'fieldId' ], $editable_ids ) ) {
2173 2173
 						/**
2174 2174
 						 * This conditional field is not editable in this View.
2175 2175
 						 * We need to remove the rule, but only if it matches.
2176 2176
 						 */
2177
-						if ( $_field = GFAPI::get_field( $the_form, $rule['fieldId'] ) ) {
2177
+						if ( $_field = GFAPI::get_field( $the_form, $rule[ 'fieldId' ] ) ) {
2178 2178
 							$value = $_field->get_value_export( $this->entry );
2179
-						} elseif ( isset( $this->entry[ $rule['fieldId'] ] ) ) {
2180
-							$value = $this->entry[ $rule['fieldId'] ];
2179
+						} elseif ( isset( $this->entry[ $rule[ 'fieldId' ] ] ) ) {
2180
+							$value = $this->entry[ $rule[ 'fieldId' ] ];
2181 2181
 						} else {
2182
-							$value = gform_get_meta( $this->entry['id'], $rule['fieldId'] );
2182
+							$value = gform_get_meta( $this->entry[ 'id' ], $rule[ 'fieldId' ] );
2183 2183
 						}
2184 2184
 
2185
-						$match = GFFormsModel::matches_operation( $value, $rule['value'], $rule['operator'] );
2185
+						$match = GFFormsModel::matches_operation( $value, $rule[ 'value' ], $rule[ 'operator' ] );
2186 2186
 
2187 2187
 						if ( $match ) {
2188
-							$remove_conditions_rule[] = array( $field['id'], $i );
2188
+							$remove_conditions_rule[ ] = array( $field[ 'id' ], $i );
2189 2189
 						}
2190 2190
 					}
2191 2191
 				}
@@ -2193,21 +2193,21 @@  discard block
 block discarded – undo
2193 2193
 		}
2194 2194
 
2195 2195
 		if ( $remove_conditions_rule ) {
2196
-			foreach ( $form['fields'] as &$field ) {
2196
+			foreach ( $form[ 'fields' ] as &$field ) {
2197 2197
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2198 2198
 
2199 2199
 				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2200 2200
 
2201
-					if ( $field['id'] == $rule_field_id ) {
2202
-						unset( $field->conditionalLogic['rules'][ $rule_i ] );
2203
-						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field['id'] ) );
2201
+					if ( $field[ 'id' ] == $rule_field_id ) {
2202
+						unset( $field->conditionalLogic[ 'rules' ][ $rule_i ] );
2203
+						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field[ 'id' ] ) );
2204 2204
 					}
2205 2205
 				}
2206 2206
 			}
2207 2207
 		}
2208 2208
 
2209 2209
 		/** Normalize the indices... */
2210
-		$form['fields'] = array_values( $form['fields'] );
2210
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
2211 2211
 
2212 2212
 		/**
2213 2213
 		 * @filter `gravityview/edit_entry/conditional_logic` Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields?
@@ -2217,16 +2217,16 @@  discard block
 block discarded – undo
2217 2217
 		 */
2218 2218
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
2219 2219
 
2220
-		if( $use_conditional_logic ) {
2220
+		if ( $use_conditional_logic ) {
2221 2221
 			return $form;
2222 2222
 		}
2223 2223
 
2224
-		foreach( $form['fields'] as &$field ) {
2224
+		foreach ( $form[ 'fields' ] as &$field ) {
2225 2225
 			/* @var GF_Field $field */
2226 2226
 			$field->conditionalLogic = null;
2227 2227
 		}
2228 2228
 
2229
-		unset( $form['button']['conditionalLogic'] );
2229
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
2230 2230
 
2231 2231
 		return $form;
2232 2232
 
@@ -2243,7 +2243,7 @@  discard block
 block discarded – undo
2243 2243
 	 */
2244 2244
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
2245 2245
 
2246
-		if( ! $this->is_edit_entry() ) {
2246
+		if ( ! $this->is_edit_entry() ) {
2247 2247
 			return $has_conditional_logic;
2248 2248
 		}
2249 2249
 
@@ -2275,44 +2275,44 @@  discard block
 block discarded – undo
2275 2275
 		 *  2. There are two entries embedded using oEmbed
2276 2276
 		 *  3. One of the entries has just been saved
2277 2277
 		 */
2278
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
2278
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
2279 2279
 
2280 2280
 			$error = true;
2281 2281
 
2282 2282
 		}
2283 2283
 
2284
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
2284
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
2285 2285
 
2286 2286
 			$error = true;
2287 2287
 
2288
-		} elseif( ! $this->verify_nonce() ) {
2288
+		} elseif ( ! $this->verify_nonce() ) {
2289 2289
 
2290 2290
 			/**
2291 2291
 			 * If the Entry is embedded, there may be two entries on the same page.
2292 2292
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
2293 2293
 			 */
2294
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2294
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2295 2295
 				$error = true;
2296 2296
 			} else {
2297
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
2297
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
2298 2298
 			}
2299 2299
 
2300 2300
 		}
2301 2301
 
2302
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2303
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
2302
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2303
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
2304 2304
 		}
2305 2305
 
2306
-		if( $this->entry['status'] === 'trash' ) {
2307
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
2306
+		if ( $this->entry[ 'status' ] === 'trash' ) {
2307
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
2308 2308
 		}
2309 2309
 
2310 2310
 		// No errors; everything's fine here!
2311
-		if( empty( $error ) ) {
2311
+		if ( empty( $error ) ) {
2312 2312
 			return true;
2313 2313
 		}
2314 2314
 
2315
-		if( $echo && $error !== true ) {
2315
+		if ( $echo && $error !== true ) {
2316 2316
 
2317 2317
 	        $error = esc_html( $error );
2318 2318
 
@@ -2320,10 +2320,10 @@  discard block
 block discarded – undo
2320 2320
 	         * @since 1.9
2321 2321
 	         */
2322 2322
 	        if ( ! empty( $this->entry ) ) {
2323
-		        $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;" ) );
2323
+		        $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;" ) );
2324 2324
 	        }
2325 2325
 
2326
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2326
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
2327 2327
 		}
2328 2328
 
2329 2329
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2343,17 +2343,17 @@  discard block
 block discarded – undo
2343 2343
 
2344 2344
 		$error = NULL;
2345 2345
 
2346
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2347
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2346
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2347
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2348 2348
 		}
2349 2349
 
2350 2350
 		// No errors; everything's fine here!
2351
-		if( empty( $error ) ) {
2351
+		if ( empty( $error ) ) {
2352 2352
 			return true;
2353 2353
 		}
2354 2354
 
2355
-		if( $echo ) {
2356
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2355
+		if ( $echo ) {
2356
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2357 2357
 		}
2358 2358
 
2359 2359
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2374,14 +2374,14 @@  discard block
 block discarded – undo
2374 2374
 	private function check_user_cap_edit_field( $field ) {
2375 2375
 
2376 2376
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2377
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2377
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2378 2378
 			return true;
2379 2379
 		}
2380 2380
 
2381
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2381
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2382 2382
 
2383
-		if( $field_cap ) {
2384
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2383
+		if ( $field_cap ) {
2384
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2385 2385
 		}
2386 2386
 
2387 2387
 		return false;
@@ -2395,17 +2395,17 @@  discard block
 block discarded – undo
2395 2395
 	public function verify_nonce() {
2396 2396
 
2397 2397
 		// Verify form submitted for editing single
2398
-		if( $this->is_edit_entry_submission() ) {
2398
+		if ( $this->is_edit_entry_submission() ) {
2399 2399
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2400 2400
 		}
2401 2401
 
2402 2402
 		// Verify
2403
-		else if( ! $this->is_edit_entry() ) {
2403
+		else if ( ! $this->is_edit_entry() ) {
2404 2404
 			$valid = false;
2405 2405
 		}
2406 2406
 
2407 2407
 		else {
2408
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2408
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2409 2409
 		}
2410 2410
 
2411 2411
 		/**
Please login to merge, or discard this patch.