Completed
Pull Request — master (#1147)
by Gennady
19:40 queued 15:53
created
future/includes/class-gv-license-handler.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		);
101 101
 
102 102
 		if ( ! empty( $action ) ) {
103
-			$settings['edd_action'] = esc_attr( $action );
103
+			$settings[ 'edd_action' ] = esc_attr( $action );
104 104
 		}
105 105
 
106 106
 		return array_map( 'urlencode', $settings );
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			'format' => 'json',
157 157
 		) );
158 158
 
159
-		if ( $is_ajax && empty( $data['license'] ) ) {
159
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
160 160
 			die( -1 );
161 161
 		}
162 162
 
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 
185 185
 			$json = json_encode( $license_data );
186 186
 
187
-			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action');
187
+			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' );
188 188
 
189 189
 			$is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX );
190 190
 
191 191
 			if ( 'deactivate_license' === Utils::get( $data, 'edd_action' ) ) {
192
-				do_action('gravityview/admin_installer/delete_downloads_data', true );
192
+				do_action( 'gravityview/admin_installer/delete_downloads_data', true );
193 193
 			}
194 194
 
195 195
 			if ( $is_check_action_button ) {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			// most likely a mistake.
202 202
 			} else if ( $license_data->license !== 'failed' && $update_license ) {
203 203
 
204
-				if ( ! empty( $data['field_id'] ) ) {
204
+				if ( ! empty( $data[ 'field_id' ] ) ) {
205 205
 					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
206 206
 				}
207 207
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		if ( empty( $license_data ) ) {
229 229
 			$message = '';
230 230
 		} else {
231
-			if( ! empty( $license_data->error ) ) {
231
+			if ( ! empty( $license_data->error ) ) {
232 232
 				$class = 'error';
233 233
 				$string_key = $license_data->error;
234 234
 			} else { $class = $license_data->license;
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public function license_details( $response = array() ) {
256 256
 
257
-		$response = (array) $response;
257
+		$response = (array)$response;
258 258
 
259 259
 		$return = '';
260 260
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
261 261
 
262
-		if ( ! empty( $response['license_key'] ) ) {
262
+		if ( ! empty( $response[ 'license_key' ] ) ) {
263 263
 			$return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>';
264 264
 
265 265
 			if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
266
-				$return .= $this->strings( $response['license'], $response );
267
-			} elseif ( ! empty( $response['license_name'] ) ) {
266
+				$return .= $this->strings( $response[ 'license' ], $response );
267
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
268 268
 				$response_keys = array(
269 269
 					'license_name'   => '',
270 270
 					'license_limit'  => '',
@@ -278,19 +278,19 @@  discard block
 block discarded – undo
278 278
 				// Make sure all the keys are set
279 279
 				$response = wp_parse_args( $response, $response_keys );
280 280
 
281
-				$login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
282
-				$local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
281
+				$login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
282
+				$local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
283 283
 				$details    = array(
284
-					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ),
285
-					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link,
286
-					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text,
287
-					'expires'     => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ),
288
-					'upgrade'     => $this->get_upgrade_html( $response['upgrades'] ),
284
+					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ),
285
+					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link,
286
+					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text,
287
+					'expires'     => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ),
288
+					'upgrade'     => $this->get_upgrade_html( $response[ 'upgrades' ] ),
289 289
 				);
290 290
 
291
-				if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) {
292
-					unset( $details['upgrade'] );
293
-					$details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
291
+				if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) {
292
+					unset( $details[ 'upgrade' ] );
293
+					$details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
294 294
 				}
295 295
 
296 296
 				$return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>';
@@ -316,20 +316,20 @@  discard block
 block discarded – undo
316 316
 		if ( ! empty( $upgrades ) ) {
317 317
 
318 318
 			$locale_parts = explode( '_', get_locale() );
319
-			$is_english = ( 'en' === $locale_parts[0] );
319
+			$is_english = ( 'en' === $locale_parts[ 0 ] );
320 320
 
321 321
 			$output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>';
322 322
 			$output .= '<ul class="ul-disc">';
323 323
 
324 324
 			foreach ( $upgrades as $upgrade_id => $upgrade ) {
325
-				$upgrade = (object) $upgrade;
325
+				$upgrade = (object)$upgrade;
326 326
 
327 327
 				$anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) );
328 328
 
329 329
 				if ( $is_english && isset( $upgrade->description ) ) {
330 330
 					$message = esc_html( $upgrade->description );
331 331
 				} else {
332
-					switch( $upgrade->price_id ) {
332
+					switch ( $upgrade->price_id ) {
333 333
 						// Interstellar
334 334
 						case 1:
335 335
 						default:
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 			'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ),
389 389
 			'missing' => esc_html__( 'Invalid license key.', 'gravityview' ),
390 390
 			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
391
-			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ),
391
+			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ),
392 392
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
393 393
 
394 394
 			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 
418 418
 		if ( ! empty( $license_data->renewal_url ) ) {
419 419
 			$renew_license_url = $license_data->renewal_url;
420
-		} elseif( ! empty( $license_data->license_key ) ) {
420
+		} elseif ( ! empty( $license_data->license_key ) ) {
421 421
 			$renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key );
422 422
 		} else {
423 423
 			$renew_license_url = 'https://gravityview.co/account/';
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	 * @return array|\WP_Error
435 435
 	 */
436 436
 	private function _license_get_remote_response( $data, $license = '' ) {
437
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
437
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
438 438
 
439 439
 		$url = add_query_arg( $api_params, self::url );
440 440
 
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
 	private function license_call_update_settings( $license_data, $data ) {
475 475
 		$settings = array();
476 476
 
477
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
478
-		$settings['license_key_status'] = $license_data->license;
479
-		$settings['license_key_response'] = (array)$license_data;
477
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
478
+		$settings[ 'license_key_status' ] = $license_data->license;
479
+		$settings[ 'license_key_response' ] = (array)$license_data;
480 480
 
481 481
 		$this->settings->set( $settings );
482 482
 	}
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 
492 492
 		if ( ! empty( $key ) ) {
493 493
 			$response = $this->settings->get( 'license_key_response' );
494
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
494
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
495 495
 		} else {
496 496
 			$response = array();
497 497
 		}
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 
534 534
 		$submit = '<div class="gv-edd-button-wrapper">';
535 535
 		foreach ( $fields as $field ) {
536
-			$field['type'] = 'button';
537
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
538
-			$field['style'] = 'margin-left: 10px;';
539
-			if( $disabled_attribute ) {
540
-				$field['disabled'] = $disabled_attribute;
536
+			$field[ 'type' ] = 'button';
537
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
538
+			$field[ 'style' ] = 'margin-left: 10px;';
539
+			if ( $disabled_attribute ) {
540
+				$field[ 'disabled' ] = $disabled_attribute;
541 541
 			}
542 542
 			$submit .= $this->settings->as_html( $field, $echo );
543 543
 		}
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 				    'url'        => home_url(),
617 617
 				    'site_data'  => $this->get_site_data(),
618 618
 			    ),
619
-			));
619
+			) );
620 620
 
621 621
 			// make sure the response came back okay
622 622
 			if ( is_wp_error( $response ) ) {
@@ -647,45 +647,45 @@  discard block
 block discarded – undo
647 647
 		$theme_data = wp_get_theme();
648 648
 		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
649 649
 
650
-		$data['gv_version']  = Plugin::$version;
651
-		$data['php_version']  = phpversion();
652
-		$data['wp_version']   = get_bloginfo( 'version' );
653
-		$data['gf_version']  = \GFForms::$version;
654
-		$data['server']       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
655
-		$data['multisite']    = is_multisite();
656
-		$data['theme']        = $theme;
657
-		$data['url']          = home_url();
658
-		$data['license_key']  = $this->settings->get( 'license_key' );
659
-		$data['beta']         = $this->settings->get( 'beta' );
650
+		$data[ 'gv_version' ]  = Plugin::$version;
651
+		$data[ 'php_version' ]  = phpversion();
652
+		$data[ 'wp_version' ]   = get_bloginfo( 'version' );
653
+		$data[ 'gf_version' ]  = \GFForms::$version;
654
+		$data[ 'server' ]       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
655
+		$data[ 'multisite' ]    = is_multisite();
656
+		$data[ 'theme' ]        = $theme;
657
+		$data[ 'url' ]          = home_url();
658
+		$data[ 'license_key' ]  = $this->settings->get( 'license_key' );
659
+		$data[ 'beta' ]         = $this->settings->get( 'beta' );
660 660
 
661 661
 		// View Data
662 662
 		$gravityview_posts = wp_count_posts( 'gravityview', 'readable' );
663 663
 
664
-		$data['view_count'] = null;
665
-		$data['view_first'] = null;
666
-		$data['view_latest'] = null;
664
+		$data[ 'view_count' ] = null;
665
+		$data[ 'view_first' ] = null;
666
+		$data[ 'view_latest' ] = null;
667 667
 
668 668
 		if ( $gravityview_posts->publish ) {
669
-			$data['view_count'] = $gravityview_posts->publish;
669
+			$data[ 'view_count' ] = $gravityview_posts->publish;
670 670
 
671 671
 			$first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' );
672 672
 			$latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' );
673 673
 
674 674
 			if ( $first = array_shift( $first ) ) {
675
-				$data['view_first'] = $first->post_date;
675
+				$data[ 'view_first' ] = $first->post_date;
676 676
 			}
677 677
 			if ( $latest = array_pop( $latest ) ) {
678
-				$data['view_latest'] = $latest->post_date;
678
+				$data[ 'view_latest' ] = $latest->post_date;
679 679
 			}
680 680
 		}
681 681
 
682 682
 		// Form counts
683 683
 		if ( class_exists( 'GFFormsModel' ) ) {
684 684
 			$form_data = \GFFormsModel::get_form_count();
685
-			$data['forms_total'] = Utils::get( $form_data, 'total', 0 );
686
-			$data['forms_active'] = Utils::get( $form_data, 'active', 0 );
687
-			$data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 );
688
-			$data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 );
685
+			$data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 );
686
+			$data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 );
687
+			$data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 );
688
+			$data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 );
689 689
 		}
690 690
 
691 691
 		// Retrieve current plugin information
@@ -693,13 +693,13 @@  discard block
 block discarded – undo
693 693
 			include ABSPATH . '/wp-admin/includes/plugin.php';
694 694
 		}
695 695
 
696
-		$data['integrations']     = self::get_related_plugins_and_extensions();
697
-		$data['active_plugins']   = get_option( 'active_plugins', array() );
698
-		$data['inactive_plugins'] = array();
699
-		$data['locale']           = get_locale();
696
+		$data[ 'integrations' ]     = self::get_related_plugins_and_extensions();
697
+		$data[ 'active_plugins' ]   = get_option( 'active_plugins', array() );
698
+		$data[ 'inactive_plugins' ] = array();
699
+		$data[ 'locale' ]           = get_locale();
700 700
 
701 701
 		// Validate request on the GV server
702
-		$data['hash']             = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] );
702
+		$data[ 'hash' ]             = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] );
703 703
 
704 704
 		return $data;
705 705
 	}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 
730 730
 				$plugin_data = get_plugin_data( $active_plugin );
731 731
 
732
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
732
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
733 733
 			}
734 734
 
735 735
 			if ( ! empty( $extensions ) ) {
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 		$slug = apply_filters( 'gravityview_slug', 'view' );
210 210
 		$rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' );
211 211
 
212
-		add_filter( 'query_vars', function( $query_vars ) { 
212
+		add_filter( 'query_vars', function( $query_vars ) {
213 213
 			$query_vars[] = 'csv';
214 214
 			return $query_vars;
215 215
 		} );
@@ -254,8 +254,9 @@  discard block
 block discarded – undo
254 254
 		 * Check permissions.
255 255
 		 */
256 256
 		while ( $error = $view->can_render( null, $request ) ) {
257
-			if ( ! is_wp_error( $error ) )
258
-				break;
257
+			if ( ! is_wp_error( $error ) ) {
258
+							break;
259
+			}
259 260
 
260 261
 			switch ( str_replace( 'gravityview/', '', $error->get_error_code() ) ) {
261 262
 				case 'post_password_required':
Please login to merge, or discard this patch.
Spacing   +26 added lines, -27 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$supports = array( 'title', 'revisions' );
109 109
 
110 110
 		if ( $is_hierarchical ) {
111
-			$supports[] = 'page-attributes';
111
+			$supports[ ] = 'page-attributes';
112 112
 		}
113 113
 
114 114
 		/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 		$rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' );
211 211
 
212 212
 		add_filter( 'query_vars', function( $query_vars ) { 
213
-			$query_vars[] = 'csv';
213
+			$query_vars[ ] = 'csv';
214 214
 			return $query_vars;
215 215
 		} );
216 216
 
217
-		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) {
217
+		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) {
218 218
 			call_user_func_array( 'add_rewrite_rule', $rule );
219 219
 		}
220 220
 	}
@@ -278,13 +278,13 @@  discard block
 block discarded – undo
278 278
 			return $content;
279 279
 		}
280 280
 
281
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
281
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
282 282
 
283 283
 		/**
284 284
 		 * Editing a single entry.
285 285
 		 */
286 286
 		if ( $entry = $request->is_edit_entry() ) {
287
-			if ( $entry['status'] != 'active' ) {
287
+			if ( $entry[ 'status' ] != 'active' ) {
288 288
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
289 289
 				return __( 'You are not allowed to view this content.', 'gravityview' );
290 290
 			}
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			}
296 296
 
297 297
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
298
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
298
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
299 299
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
300 300
 					return __( 'You are not allowed to view this content.', 'gravityview' );
301 301
 				}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		 * Viewing a single entry.
309 309
 		 */
310 310
 		} else if ( $entry = $request->is_entry() ) {
311
-			if ( $entry['status'] != 'active' ) {
311
+			if ( $entry[ 'status' ] != 'active' ) {
312 312
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
313 313
 				return __( 'You are not allowed to view this content.', 'gravityview' );
314 314
 			}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 			}
320 320
 
321 321
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
322
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
322
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
323 323
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
324 324
 					return __( 'You are not allowed to view this content.', 'gravityview' );
325 325
 				}
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
 			$error = \GVCommon::check_entry_display( $entry->as_entry() );
329 329
 
330
-			if( is_wp_error( $error ) ) {
330
+			if ( is_wp_error( $error ) ) {
331 331
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) );
332 332
 				return __( 'You are not allowed to view this content.', 'gravityview' );
333 333
 			}
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 			$join_column    = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field( $join_column );
486 486
 			$join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field( $join_on_column );
487 487
 
488
-			$joins [] = new Join( $join, $join_column, $join_on, $join_on_column );
488
+			$joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column );
489 489
 		}
490 490
 
491 491
 		return $joins;
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
 
528 528
 			list( $join, $join_column, $join_on, $join_on_column ) = $meta;
529 529
 
530
-			$forms_ids [] = GF_Form::by_id( $join_on );
530
+			$forms_ids [ ] = GF_Form::by_id( $join_on );
531 531
 		}
532 532
 
533
-		return ( !empty( $forms_ids) ) ? $forms_ids : null;
533
+		return ( ! empty( $forms_ids ) ) ? $forms_ids : null;
534 534
 	}
535 535
 
536 536
 	/**
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 		if ( ! $view->form ) {
562 562
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
563 563
 				'view_id' => $view->ID,
564
-				'form_id' => $view->_gravityview_form_id ? : 0,
564
+				'form_id' => $view->_gravityview_form_id ?: 0,
565 565
 			) );
566 566
 		}
567 567
 
@@ -787,28 +787,27 @@  discard block
 block discarded – undo
787 787
 			 * @todo: Stop using _frontend and use something like $request->get_search_criteria() instead
788 788
 			 */
789 789
 			$parameters = \GravityView_frontend::get_view_entries_parameters( $this->settings->as_atts(), $this->form->ID );
790
-			$parameters['context_view_id'] = $this->ID;
790
+			$parameters[ 'context_view_id' ] = $this->ID;
791 791
 			$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID );
792 792
 
793 793
 			if ( $request instanceof REST\Request ) {
794 794
 				$atts = $this->settings->as_atts();
795 795
 				$paging_parameters = wp_parse_args( $request->get_paging(), array(
796
-						'paging' => array( 'page_size' => $atts['page_size'] ),
796
+						'paging' => array( 'page_size' => $atts[ 'page_size' ] ),
797 797
 					) );
798
-				$parameters['paging'] = $paging_parameters['paging'];
798
+				$parameters[ 'paging' ] = $paging_parameters[ 'paging' ];
799 799
 			}
800 800
 
801
-			$page = Utils::get( $parameters['paging'], 'current_page' ) ?
802
-				: ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );
801
+			$page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
803 802
 
804 803
 			if ( gravityview()->plugin->supports( Plugin::FEATURE_GFQUERY ) ) {
805 804
 				/**
806 805
 				 * New \GF_Query stuff :)
807 806
 				 */
808
-				$query = new \GF_Query( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] );
807
+				$query = new \GF_Query( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] );
809 808
 
810
-				$query->limit( $parameters['paging']['page_size'] )
811
-					->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) );
809
+				$query->limit( $parameters[ 'paging' ][ 'page_size' ] )
810
+					->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) );
812 811
 
813 812
 				/**
814 813
 				 * Any joins?
@@ -848,15 +847,15 @@  discard block
 block discarded – undo
848 847
 				} );
849 848
 			} else {
850 849
 				$entries = $this->form->entries
851
-					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
850
+					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
852 851
 					->offset( $this->settings->get( 'offset' ) )
853
-					->limit( $parameters['paging']['page_size'] )
852
+					->limit( $parameters[ 'paging' ][ 'page_size' ] )
854 853
 					->page( $page );
855 854
 
856
-				if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) {
855
+				if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) {
857 856
 					$field = new \GV\Field();
858
-					$field->ID = $parameters['sorting']['key'];
859
-					$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
857
+					$field->ID = $parameters[ 'sorting' ][ 'key' ];
858
+					$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
860 859
 					$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
861 860
 				}
862 861
 			}
@@ -927,7 +926,7 @@  discard block
 block discarded – undo
927 926
 		$allowed = $headers = array();
928 927
 
929 928
 		foreach ( $view->fields->by_position( "directory_*" )->by_visible()->all() as $field ) {
930
-			$allowed[] = $field->ID;
929
+			$allowed[ ] = $field->ID;
931 930
 		}
932 931
 
933 932
 		$renderer = new Field_Renderer();
Please login to merge, or discard this patch.
future/includes/rest/class-gv-rest-route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 		$format = '(?:\.(?P<format>html|json))?';
134 134
 
135
-		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array(
135
+		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array(
136 136
 			array(
137 137
 				'methods'         => \WP_REST_Server::READABLE,
138 138
 				'callback'        => array( $this, 'get_sub_item' ),
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @return \WP_REST_Response
384 384
 	 */
385 385
 	protected function not_implemented(  ) {
386
-		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' )  );
386
+		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) );
387 387
 		return new \WP_REST_Response( $error, 501 );
388 388
 	}
389 389
 
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@
 block discarded – undo
282 282
 	/**
283 283
 	 * Process edit entry form save
284 284
 	 *
285
-	 * @param array $gv_data The View data.
285
+	 * @param GravityView_View_Data $gv_data The View data.
286 286
 	 */
287 287
 	private function process_save( $gv_data ) {
288 288
 
Please login to merge, or discard this patch.
Indentation   +265 added lines, -265 removed lines patch added patch discarded remove patch
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 
95 95
 	/**
96 96
 	 * ID of the current post. May also be ID of the current View.
97
-     *
98
-     * @since 2.0.13
99
-     * 
100
-     * @var int
97
+	 *
98
+	 * @since 2.0.13
99
+	 * 
100
+	 * @var int
101 101
 	 */
102 102
 	public $post_id;
103 103
 
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171 171
 		if( ! empty( $_POST ) ) {
172
-	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
172
+			gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175 175
 		if( $this->is_edit_entry_submission() ) {
176 176
 			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
177
+			remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	 * When Edit entry view is requested setup the vars
203 203
 	 */
204 204
 	private function setup_vars() {
205
-        global $post;
205
+		global $post;
206 206
 
207 207
 		$gravityview_view = GravityView_View::getInstance();
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+		self::$original_entry = $entries[0];
212
+		$this->entry = $entries[0];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 
334 334
 			GFFormsModel::save_lead( $form, $this->entry );
335 335
 
336
-	        // Delete the values for hidden inputs
337
-	        $this->unset_hidden_field_values();
336
+			// Delete the values for hidden inputs
337
+			$this->unset_hidden_field_values();
338 338
 			
339 339
 			$this->entry['date_created'] = $date_created;
340 340
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			// Perform actions normally performed after updating a lead
345 345
 			$this->after_update();
346 346
 
347
-	        /**
347
+			/**
348 348
 			 * Must be AFTER after_update()!
349 349
 			 * @see https://github.com/gravityview/GravityView/issues/764
350 350
 			 */
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 			/**
354 354
 			 * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry
355
-             * @since 2.1 Added $gv_data parameter
355
+			 * @since 2.1 Added $gv_data parameter
356 356
 			 * @param array $form Gravity Forms form array
357 357
 			 * @param string $entry_id Numeric ID of the entry that was updated
358 358
 			 * @param GravityView_Edit_Entry_Render $this This object
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 * @return void
377 377
 	 */
378 378
 	private function unset_hidden_field_values() {
379
-	    global $wpdb;
379
+		global $wpdb;
380 380
 
381 381
 		/**
382 382
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -398,27 +398,27 @@  discard block
 block discarded – undo
398 398
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
399 399
 		}
400 400
 
401
-	    foreach ( $this->entry as $input_id => $field_value ) {
401
+		foreach ( $this->entry as $input_id => $field_value ) {
402 402
 
403
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
403
+			$field = RGFormsModel::get_field( $this->form, $input_id );
404 404
 
405
-		    // Reset fields that are hidden
406
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
407
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
405
+			// Reset fields that are hidden
406
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
407
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
408 408
 
409
-		        // List fields are stored as empty arrays when empty
410
-			    $empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
409
+				// List fields are stored as empty arrays when empty
410
+				$empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
411 411
 
412
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
412
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
413 413
 
414
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
414
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
415 415
 
416
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
416
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
417 417
 				// after submission
418
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
419
-			    $_POST[ $post_input_id ] = '';
420
-		    }
421
-	    }
418
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
419
+				$_POST[ $post_input_id ] = '';
420
+			}
421
+		}
422 422
 	}
423 423
 
424 424
 	/**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 		$form = $this->form;
514 514
 
515
-	    /** @var GF_Field $field */
515
+		/** @var GF_Field $field */
516 516
 		foreach( $form['fields'] as $k => &$field ) {
517 517
 
518 518
 			/**
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 
529 529
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530 530
 				foreach( $field->inputs as $key => $input ) {
531
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
531
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
532 532
 				}
533 533
 			}
534 534
 		}
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
 			foreach ( $this->fields_with_calculation as $calc_field ) {
550 550
 				$inputs = $calc_field->get_entry_inputs();
551 551
 				if ( is_array( $inputs ) ) {
552
-				    foreach ( $inputs as $input ) {
553
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
554
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
555
-				    }
552
+					foreach ( $inputs as $input ) {
553
+						$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
554
+						$entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
555
+					}
556 556
 				} else {
557
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
558
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
557
+					$input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
558
+					$entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
559 559
 				}
560 560
 			}
561 561
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
604 604
 
605 605
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
606
-	        $ary = stripslashes_deep( $ary );
606
+			$ary = stripslashes_deep( $ary );
607 607
 			$img_url = \GV\Utils::get( $ary, 0 );
608 608
 
609 609
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 	private function maybe_update_post_fields( $form ) {
677 677
 
678 678
 		if( empty( $this->entry['post_id'] ) ) {
679
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
679
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
680 680
 			return;
681 681
 		}
682 682
 
@@ -711,51 +711,51 @@  discard block
 block discarded – undo
711 711
 
712 712
 				switch( $field->type ) {
713 713
 
714
-				    case 'post_title':
715
-				        $post_title = $value;
716
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
717
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
718
-				        }
719
-				        $updated_post->post_title = $post_title;
720
-				        $updated_post->post_name  = $post_title;
721
-				        unset( $post_title );
722
-				        break;
723
-
724
-				    case 'post_content':
725
-				        $post_content = $value;
726
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
727
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
728
-				        }
729
-				        $updated_post->post_content = $post_content;
730
-				        unset( $post_content );
731
-				        break;
732
-				    case 'post_excerpt':
733
-				        $updated_post->post_excerpt = $value;
734
-				        break;
735
-				    case 'post_tags':
736
-				        wp_set_post_tags( $post_id, $value, false );
737
-				        break;
738
-				    case 'post_category':
739
-				        break;
740
-				    case 'post_custom_field':
714
+					case 'post_title':
715
+						$post_title = $value;
716
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
717
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
718
+						}
719
+						$updated_post->post_title = $post_title;
720
+						$updated_post->post_name  = $post_title;
721
+						unset( $post_title );
722
+						break;
723
+
724
+					case 'post_content':
725
+						$post_content = $value;
726
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
727
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
728
+						}
729
+						$updated_post->post_content = $post_content;
730
+						unset( $post_content );
731
+						break;
732
+					case 'post_excerpt':
733
+						$updated_post->post_excerpt = $value;
734
+						break;
735
+					case 'post_tags':
736
+						wp_set_post_tags( $post_id, $value, false );
737
+						break;
738
+					case 'post_category':
739
+						break;
740
+					case 'post_custom_field':
741 741
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
742 742
 							$value = $value[ $field_id ];
743 743
 						}
744 744
 
745
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
746
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
747
-				        }
745
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
746
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
747
+						}
748 748
 
749
-	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
750
-		                    $value = wp_json_encode( $value );
751
-	                    }
749
+						if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
750
+							$value = wp_json_encode( $value );
751
+						}
752 752
 
753
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
754
-				        break;
753
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
754
+						break;
755 755
 
756
-				    case 'post_image':
757
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
758
-				        break;
756
+					case 'post_image':
757
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
758
+						break;
759 759
 
760 760
 				}
761 761
 
@@ -800,20 +800,20 @@  discard block
 block discarded – undo
800 800
 	 */
801 801
 	private function is_field_json_encoded( $field ) {
802 802
 
803
-	    $json_encoded = false;
803
+		$json_encoded = false;
804 804
 
805 805
 		$input_type = RGFormsModel::get_input_type( $field );
806 806
 
807
-	    // Only certain custom field types are supported
808
-	    switch( $input_type ) {
809
-		    case 'fileupload':
810
-		    case 'list':
811
-		    case 'multiselect':
812
-			    $json_encoded = true;
813
-			    break;
814
-	    }
807
+		// Only certain custom field types are supported
808
+		switch( $input_type ) {
809
+			case 'fileupload':
810
+			case 'list':
811
+			case 'multiselect':
812
+				$json_encoded = true;
813
+				break;
814
+		}
815 815
 
816
-	    return $json_encoded;
816
+		return $json_encoded;
817 817
 	}
818 818
 
819 819
 	/**
@@ -903,14 +903,14 @@  discard block
 block discarded – undo
903 903
 			?><h2 class="gv-edit-entry-title">
904 904
 				<span><?php
905 905
 
906
-				    /**
907
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
908
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
909
-				     * @param GravityView_Edit_Entry_Render $this This object
910
-				     */
911
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
906
+					/**
907
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
908
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
909
+					 * @param GravityView_Edit_Entry_Render $this This object
910
+					 */
911
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
912 912
 
913
-				    echo esc_attr( $edit_entry_title );
913
+					echo esc_attr( $edit_entry_title );
914 914
 			?></span>
915 915
 			</h2>
916 916
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 
1020 1020
 		ob_get_clean();
1021 1021
 
1022
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1022
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1023 1023
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1024 1024
 		remove_filter( 'gform_disable_view_counter', '__return_true' );
1025 1025
 		remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 );
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 
1074 1074
 		// for now we don't support Save and Continue feature.
1075 1075
 		if( ! self::$supports_save_and_continue ) {
1076
-	        unset( $form['save'] );
1076
+			unset( $form['save'] );
1077 1077
 		}
1078 1078
 
1079 1079
 		return $form;
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 			|| ! empty( $field_content )
1149 1149
 			|| in_array( $field->type, array( 'honeypot' ) )
1150 1150
 		) {
1151
-	        return $field_content;
1151
+			return $field_content;
1152 1152
 		}
1153 1153
 
1154 1154
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1156,24 +1156,24 @@  discard block
 block discarded – undo
1156 1156
 
1157 1157
 		$field_value = $this->get_field_value( $field );
1158 1158
 
1159
-	    // Prevent any PHP warnings, like undefined index
1160
-	    ob_start();
1159
+		// Prevent any PHP warnings, like undefined index
1160
+		ob_start();
1161 1161
 
1162
-	    $return = null;
1162
+		$return = null;
1163 1163
 
1164 1164
 		/** @var GravityView_Field $gv_field */
1165 1165
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1166 1166
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1167 1167
 		} else {
1168
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1169
-	    }
1168
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1169
+		}
1170 1170
 
1171
-	    // If there was output, it's an error
1172
-	    $warnings = ob_get_clean();
1171
+		// If there was output, it's an error
1172
+		$warnings = ob_get_clean();
1173 1173
 
1174
-	    if( !empty( $warnings ) ) {
1175
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1176
-	    }
1174
+		if( !empty( $warnings ) ) {
1175
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1176
+		}
1177 1177
 
1178 1178
 		return $return;
1179 1179
 	}
@@ -1208,8 +1208,8 @@  discard block
 block discarded – undo
1208 1208
 				$input_id = strval( $input['id'] );
1209 1209
 				
1210 1210
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1211
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1212
-				    $allow_pre_populated = false;
1211
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1212
+					$allow_pre_populated = false;
1213 1213
 				}
1214 1214
 
1215 1215
 			}
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1234 1234
 				$categories = array();
1235 1235
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1236
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1236
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1237 1237
 				}
1238 1238
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1239 1239
 			}
@@ -1243,25 +1243,25 @@  discard block
 block discarded – undo
1243 1243
 		// if value is empty get the default value if defined
1244 1244
 		$field_value = $field->get_value_default_if_empty( $field_value );
1245 1245
 
1246
-	    /**
1247
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1248
-	     * @since 1.11
1249
-	     * @since 1.20 Added third param
1250
-	     * @param mixed $field_value field value used to populate the input
1251
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1252
-	     * @param GravityView_Edit_Entry_Render $this Current object
1253
-	     */
1254
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1255
-
1256
-	    /**
1257
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1258
-	     * @since 1.17
1259
-	     * @since 1.20 Added third param
1260
-	     * @param mixed $field_value field value used to populate the input
1261
-	     * @param GF_Field $field Gravity Forms field object
1262
-	     * @param GravityView_Edit_Entry_Render $this Current object
1263
-	     */
1264
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1246
+		/**
1247
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1248
+		 * @since 1.11
1249
+		 * @since 1.20 Added third param
1250
+		 * @param mixed $field_value field value used to populate the input
1251
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1252
+		 * @param GravityView_Edit_Entry_Render $this Current object
1253
+		 */
1254
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1255
+
1256
+		/**
1257
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1258
+		 * @since 1.17
1259
+		 * @since 1.20 Added third param
1260
+		 * @param mixed $field_value field value used to populate the input
1261
+		 * @param GF_Field $field Gravity Forms field object
1262
+		 * @param GravityView_Edit_Entry_Render $this Current object
1263
+		 */
1264
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1265 1265
 
1266 1266
 		return $field_value;
1267 1267
 	}
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1289 1289
 			// expects certain field array items to be set.
1290 1290
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1291
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1291
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1292 1292
 			}
1293 1293
 
1294 1294
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1302,61 +1302,61 @@  discard block
 block discarded – undo
1302 1302
 				 */
1303 1303
 				case 'fileupload':
1304 1304
 
1305
-				    // Set the previous value
1306
-				    $entry = $this->get_entry();
1305
+					// Set the previous value
1306
+					$entry = $this->get_entry();
1307 1307
 
1308
-				    $input_name = 'input_'.$field->id;
1309
-				    $form_id = $form['id'];
1308
+					$input_name = 'input_'.$field->id;
1309
+					$form_id = $form['id'];
1310 1310
 
1311
-				    $value = NULL;
1311
+					$value = NULL;
1312 1312
 
1313
-				    // Use the previous entry value as the default.
1314
-				    if( isset( $entry[ $field->id ] ) ) {
1315
-				        $value = $entry[ $field->id ];
1316
-				    }
1313
+					// Use the previous entry value as the default.
1314
+					if( isset( $entry[ $field->id ] ) ) {
1315
+						$value = $entry[ $field->id ];
1316
+					}
1317 1317
 
1318
-				    // If this is a single upload file
1319
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1320
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1321
-				        $value = $file_path['url'];
1318
+					// If this is a single upload file
1319
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1320
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1321
+						$value = $file_path['url'];
1322 1322
 
1323
-				    } else {
1323
+					} else {
1324 1324
 
1325
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1326
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1327
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1325
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1326
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1327
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1328 1328
 
1329
-				    }
1329
+					}
1330 1330
 
1331
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1331
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1332 1332
 
1333
-				        // If there are fresh uploads, process and merge them.
1334
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1335
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1336
-				            $value = empty( $value ) ? '[]' : $value;
1337
-				            $value = stripslashes_deep( $value );
1338
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1339
-				        }
1333
+						// If there are fresh uploads, process and merge them.
1334
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1335
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1336
+							$value = empty( $value ) ? '[]' : $value;
1337
+							$value = stripslashes_deep( $value );
1338
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1339
+						}
1340 1340
 
1341
-				    } else {
1341
+					} else {
1342 1342
 
1343
-				        // A file already exists when editing an entry
1344
-				        // We set this to solve issue when file upload fields are required.
1345
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1343
+						// A file already exists when editing an entry
1344
+						// We set this to solve issue when file upload fields are required.
1345
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1346 1346
 
1347
-				    }
1347
+					}
1348 1348
 
1349
-				    $this->entry[ $input_name ] = $value;
1350
-				    $_POST[ $input_name ] = $value;
1349
+					$this->entry[ $input_name ] = $value;
1350
+					$_POST[ $input_name ] = $value;
1351 1351
 
1352
-				    break;
1352
+					break;
1353 1353
 
1354 1354
 				case 'number':
1355
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1356
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1357
-				        $_POST['input_'.$field->id ] = NULL;
1358
-				    }
1359
-				    break;
1355
+					// Fix "undefined index" issue at line 1286 in form_display.php
1356
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1357
+						$_POST['input_'.$field->id ] = NULL;
1358
+					}
1359
+					break;
1360 1360
 			}
1361 1361
 
1362 1362
 		}
@@ -1441,42 +1441,42 @@  discard block
 block discarded – undo
1441 1441
 				case 'fileupload' :
1442 1442
 				case 'post_image':
1443 1443
 
1444
-				    // in case nothing is uploaded but there are already files saved
1445
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1446
-				        $field->failed_validation = false;
1447
-				        unset( $field->validation_message );
1448
-				    }
1444
+					// in case nothing is uploaded but there are already files saved
1445
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1446
+						$field->failed_validation = false;
1447
+						unset( $field->validation_message );
1448
+					}
1449 1449
 
1450
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1451
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1450
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1451
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1452 1452
 
1453
-				        $input_name = 'input_' . $field->id;
1454
-				        //uploaded
1455
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1453
+						$input_name = 'input_' . $field->id;
1454
+						//uploaded
1455
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1456 1456
 
1457
-				        //existent
1458
-				        $entry = $this->get_entry();
1459
-				        $value = NULL;
1460
-				        if( isset( $entry[ $field->id ] ) ) {
1461
-				            $value = json_decode( $entry[ $field->id ], true );
1462
-				        }
1457
+						//existent
1458
+						$entry = $this->get_entry();
1459
+						$value = NULL;
1460
+						if( isset( $entry[ $field->id ] ) ) {
1461
+							$value = json_decode( $entry[ $field->id ], true );
1462
+						}
1463 1463
 
1464
-				        // count uploaded files and existent entry files
1465
-				        $count_files = count( $file_names ) + count( $value );
1464
+						// count uploaded files and existent entry files
1465
+						$count_files = count( $file_names ) + count( $value );
1466 1466
 
1467
-				        if( $count_files > $field->maxFiles ) {
1468
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1469
-				            $field->failed_validation = 1;
1470
-				            $gv_valid = false;
1467
+						if( $count_files > $field->maxFiles ) {
1468
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1469
+							$field->failed_validation = 1;
1470
+							$gv_valid = false;
1471 1471
 
1472
-				            // in case of error make sure the newest upload files are removed from the upload input
1473
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1474
-				        }
1472
+							// in case of error make sure the newest upload files are removed from the upload input
1473
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1474
+						}
1475 1475
 
1476
-				    }
1476
+					}
1477 1477
 
1478 1478
 
1479
-				    break;
1479
+					break;
1480 1480
 
1481 1481
 			}
1482 1482
 
@@ -1487,47 +1487,47 @@  discard block
 block discarded – undo
1487 1487
 
1488 1488
 				switch ( $field_type ) {
1489 1489
 
1490
-				    // Captchas don't need to be re-entered.
1491
-				    case 'captcha':
1490
+					// Captchas don't need to be re-entered.
1491
+					case 'captcha':
1492 1492
 
1493
-				        // Post Image fields aren't editable, so we un-fail them.
1494
-				    case 'post_image':
1495
-				        $field->failed_validation = false;
1496
-				        unset( $field->validation_message );
1497
-				        break;
1493
+						// Post Image fields aren't editable, so we un-fail them.
1494
+					case 'post_image':
1495
+						$field->failed_validation = false;
1496
+						unset( $field->validation_message );
1497
+						break;
1498 1498
 
1499 1499
 				}
1500 1500
 
1501 1501
 				// You can't continue inside a switch, so we do it after.
1502 1502
 				if( empty( $field->failed_validation ) ) {
1503
-				    continue;
1503
+					continue;
1504 1504
 				}
1505 1505
 
1506 1506
 				// checks if the No Duplicates option is not validating entry against itself, since
1507 1507
 				// we're editing a stored entry, it would also assume it's a duplicate.
1508 1508
 				if( !empty( $field->noDuplicates ) ) {
1509 1509
 
1510
-				    $entry = $this->get_entry();
1510
+					$entry = $this->get_entry();
1511 1511
 
1512
-				    // If the value of the entry is the same as the stored value
1513
-				    // Then we can assume it's not a duplicate, it's the same.
1514
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1515
-				        //if value submitted was not changed, then don't validate
1516
-				        $field->failed_validation = false;
1512
+					// If the value of the entry is the same as the stored value
1513
+					// Then we can assume it's not a duplicate, it's the same.
1514
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1515
+						//if value submitted was not changed, then don't validate
1516
+						$field->failed_validation = false;
1517 1517
 
1518
-				        unset( $field->validation_message );
1518
+						unset( $field->validation_message );
1519 1519
 
1520
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1520
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1521 1521
 
1522
-				        continue;
1523
-				    }
1522
+						continue;
1523
+					}
1524 1524
 				}
1525 1525
 
1526 1526
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1527 1527
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1528
-				    unset( $field->validation_message );
1529
-	                $field->validation_message = false;
1530
-				    continue;
1528
+					unset( $field->validation_message );
1529
+					$field->validation_message = false;
1530
+					continue;
1531 1531
 				}
1532 1532
 
1533 1533
 				$gv_valid = false;
@@ -1591,8 +1591,8 @@  discard block
 block discarded – undo
1591 1591
 		// Hide fields depending on admin settings
1592 1592
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1593 1593
 
1594
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1595
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1594
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1595
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1596 1596
 
1597 1597
 		/**
1598 1598
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1652,11 +1652,11 @@  discard block
 block discarded – undo
1652 1652
 		// The edit tab has been configured, so we loop through to configured settings
1653 1653
 		foreach ( $configured_fields as $configured_field ) {
1654 1654
 
1655
-	        /** @var GF_Field $field */
1656
-	        foreach ( $fields as $field ) {
1655
+			/** @var GF_Field $field */
1656
+			foreach ( $fields as $field ) {
1657 1657
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1658
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1659
-				    break;
1658
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1659
+					break;
1660 1660
 				}
1661 1661
 
1662 1662
 			}
@@ -1712,28 +1712,28 @@  discard block
 block discarded – undo
1712 1712
 	 */
1713 1713
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1714 1714
 
1715
-	    /**
1715
+		/**
1716 1716
 		 * @filter `gravityview/edit_entry/use_gf_admin_only_setting` When Edit tab isn't configured, should the Gravity Forms "Admin Only" field settings be used to control field display to non-admins? Default: true
1717
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1718
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1719
-	     * @since 1.9.1
1720
-	     * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
1721
-	     * @param array $form GF Form array
1722
-	     * @param int $view_id View ID
1723
-	     */
1724
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1725
-
1726
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1717
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1718
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1719
+		 * @since 1.9.1
1720
+		 * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
1721
+		 * @param array $form GF Form array
1722
+		 * @param int $view_id View ID
1723
+		 */
1724
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1725
+
1726
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1727 1727
 			foreach( $fields as $k => $field ) {
1728 1728
 				if( $field->adminOnly ) {
1729
-				    unset( $fields[ $k ] );
1729
+					unset( $fields[ $k ] );
1730 1730
 				}
1731 1731
 			}
1732 1732
 			return $fields;
1733 1733
 		}
1734 1734
 
1735
-	    foreach( $fields as &$field ) {
1736
-		    $field->adminOnly = false;
1735
+		foreach( $fields as &$field ) {
1736
+			$field->adminOnly = false;
1737 1737
 		}
1738 1738
 
1739 1739
 		return $fields;
@@ -1766,36 +1766,36 @@  discard block
 block discarded – undo
1766 1766
 
1767 1767
 			if( 'checkbox' === $field->type ) {
1768 1768
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1769
-				    $input_id = $input['id'];
1770
-				    $choice = $field->choices[ $key ];
1771
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1772
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1773
-				    if( $match ) {
1774
-				        $field->choices[ $key ]['isSelected'] = true;
1775
-				    }
1769
+					$input_id = $input['id'];
1770
+					$choice = $field->choices[ $key ];
1771
+					$value = \GV\Utils::get( $this->entry, $input_id );
1772
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1773
+					if( $match ) {
1774
+						$field->choices[ $key ]['isSelected'] = true;
1775
+					}
1776 1776
 				}
1777 1777
 			} else {
1778 1778
 
1779 1779
 				// We need to run through each field to set the default values
1780 1780
 				foreach ( $this->entry as $field_id => $field_value ) {
1781 1781
 
1782
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1782
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1783 1783
 
1784
-				        if( 'list' === $field->type ) {
1785
-				            $list_rows = maybe_unserialize( $field_value );
1784
+						if( 'list' === $field->type ) {
1785
+							$list_rows = maybe_unserialize( $field_value );
1786 1786
 
1787
-				            $list_field_value = array();
1788
-				            foreach ( (array) $list_rows as $row ) {
1789
-				                foreach ( (array) $row as $column ) {
1790
-				                    $list_field_value[] = $column;
1791
-				                }
1792
-				            }
1787
+							$list_field_value = array();
1788
+							foreach ( (array) $list_rows as $row ) {
1789
+								foreach ( (array) $row as $column ) {
1790
+									$list_field_value[] = $column;
1791
+								}
1792
+							}
1793 1793
 
1794
-				            $field->defaultValue = serialize( $list_field_value );
1795
-				        } else {
1796
-				            $field->defaultValue = $field_value;
1797
-				        }
1798
-				    }
1794
+							$field->defaultValue = serialize( $list_field_value );
1795
+						} else {
1796
+							$field->defaultValue = $field_value;
1797
+						}
1798
+					}
1799 1799
 				}
1800 1800
 			}
1801 1801
 		}
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 			return $has_conditional_logic;
1853 1853
 		}
1854 1854
 
1855
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1855
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1856 1856
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
1857 1857
 	}
1858 1858
 
@@ -1919,14 +1919,14 @@  discard block
 block discarded – undo
1919 1919
 
1920 1920
 		if( $echo && $error !== true ) {
1921 1921
 
1922
-	        $error = esc_html( $error );
1922
+			$error = esc_html( $error );
1923 1923
 
1924
-	        /**
1925
-	         * @since 1.9
1926
-	         */
1927
-	        if ( ! empty( $this->entry ) ) {
1928
-		        $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;" ) );
1929
-	        }
1924
+			/**
1925
+			 * @since 1.9
1926
+			 */
1927
+			if ( ! empty( $this->entry ) ) {
1928
+				$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;" ) );
1929
+			}
1930 1930
 
1931 1931
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1932 1932
 		}
Please login to merge, or discard this patch.
Spacing   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 	function load() {
116 116
 
117 117
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
118
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
118
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
119 119
 
120 120
 		// Don't display an embedded form when editing an entry
121 121
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
122 122
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
123 123
 
124 124
 		// Stop Gravity Forms processing what is ours!
125
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
125
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
126 126
 
127
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
127
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
128 128
 
129 129
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
130 130
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
136 136
 
137 137
 		// Add fields expected by GFFormDisplay::validate()
138
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
138
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
139 139
 
140 140
 		// Fix multiselect value for GF 2.2
141 141
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @return void
153 153
 	 */
154 154
 	public function prevent_render_form() {
155
-		if( $this->is_edit_entry() ) {
156
-			if( 'wp_head' === current_filter() ) {
155
+		if ( $this->is_edit_entry() ) {
156
+			if ( 'wp_head' === current_filter() ) {
157 157
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
158 158
 			} else {
159 159
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171
-		if( ! empty( $_POST ) ) {
171
+		if ( ! empty( $_POST ) ) {
172 172
 	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175
-		if( $this->is_edit_entry_submission() ) {
176
-			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
175
+		if ( $this->is_edit_entry_submission() ) {
176
+			remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
177
+	        remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function is_edit_entry() {
186 186
 
187
-		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
187
+		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
188 188
 
189 189
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
190 190
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @return boolean
196 196
 	 */
197 197
 	public function is_edit_entry_submission() {
198
-		return !empty( $_POST[ self::$nonce_field ] );
198
+		return ! empty( $_POST[ self::$nonce_field ] );
199 199
 	}
200 200
 
201 201
 	/**
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+	    self::$original_entry = $entries[ 0 ];
212
+	    $this->entry = $entries[ 0 ];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		$this->view_id = $gravityview_view->getViewId();
218 218
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
219 219
 
220
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
220
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
221 221
 	}
222 222
 
223 223
 
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 	private function print_scripts() {
269 269
 		$gravityview_view = GravityView_View::getInstance();
270 270
 
271
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
271
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
272 272
 
273
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
273
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
274 274
 
275 275
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
276 276
 
@@ -286,19 +286,19 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	private function process_save( $gv_data ) {
288 288
 
289
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
289
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
290 290
 			return;
291 291
 		}
292 292
 
293 293
 		// Make sure the entry, view, and form IDs are all correct
294 294
 		$valid = $this->verify_nonce();
295 295
 
296
-		if ( !$valid ) {
296
+		if ( ! $valid ) {
297 297
 			gravityview()->log->error( 'Nonce validation failed.' );
298 298
 			return;
299 299
 		}
300 300
 
301
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
301
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
302 302
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
303 303
 			return;
304 304
 		}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
 		$this->validate();
311 311
 
312
-		if( $this->is_valid ) {
312
+		if ( $this->is_valid ) {
313 313
 
314 314
 			gravityview()->log->debug( 'Submission is valid.' );
315 315
 
@@ -321,22 +321,22 @@  discard block
 block discarded – undo
321 321
 			/**
322 322
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
323 323
 			 */
324
-			unset( $_GET['page'] );
324
+			unset( $_GET[ 'page' ] );
325 325
 
326
-			$date_created = $this->entry['date_created'];
326
+			$date_created = $this->entry[ 'date_created' ];
327 327
 
328 328
 			/**
329 329
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
330 330
 			 * @since 1.17.2
331 331
 			 */
332
-			unset( $this->entry['date_created'] );
332
+			unset( $this->entry[ 'date_created' ] );
333 333
 
334 334
 			GFFormsModel::save_lead( $form, $this->entry );
335 335
 
336 336
 	        // Delete the values for hidden inputs
337 337
 	        $this->unset_hidden_field_values();
338 338
 			
339
-			$this->entry['date_created'] = $date_created;
339
+			$this->entry[ 'date_created' ] = $date_created;
340 340
 
341 341
 			// Process calculation fields
342 342
 			$this->update_calculation_fields();
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 			 * @param GravityView_Edit_Entry_Render $this This object
359 359
 			 * @param GravityView_View_Data $gv_data The View data
360 360
 			 */
361
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
361
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
362 362
 
363 363
 		} else {
364 364
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -386,16 +386,16 @@  discard block
 block discarded – undo
386 386
 		 */
387 387
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
388 388
 
389
-		if( ! $unset_hidden_field_values ) {
389
+		if ( ! $unset_hidden_field_values ) {
390 390
 			return;
391 391
 		}
392 392
 
393 393
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
394 394
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
395
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
395
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
396 396
 		} else {
397 397
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
398
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
398
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
399 399
 		}
400 400
 
401 401
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		}
477 477
 
478 478
 		/** No file is being uploaded. */
479
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
479
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
480 480
 			/** So return the original upload */
481 481
 			return $entry[ $input_id ];
482 482
 		}
@@ -494,11 +494,11 @@  discard block
 block discarded – undo
494 494
 	 * @return mixed
495 495
 	 */
496 496
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
497
-		if( ! $this->is_edit_entry() ) {
497
+		if ( ! $this->is_edit_entry() ) {
498 498
 			return $plupload_init;
499 499
 		}
500 500
 
501
-		$plupload_init['gf_vars']['max_files'] = 0;
501
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
502 502
 
503 503
 		return $plupload_init;
504 504
 	}
@@ -513,22 +513,22 @@  discard block
 block discarded – undo
513 513
 		$form = $this->form;
514 514
 
515 515
 	    /** @var GF_Field $field */
516
-		foreach( $form['fields'] as $k => &$field ) {
516
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
517 517
 
518 518
 			/**
519 519
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
520 520
 			 * @since 1.16.3
521 521
 			 * @var GF_Field $field
522 522
 			 */
523
-			if( $field->has_calculation() ) {
524
-				unset( $form['fields'][ $k ] );
523
+			if ( $field->has_calculation() ) {
524
+				unset( $form[ 'fields' ][ $k ] );
525 525
 			}
526 526
 
527 527
 			$field->adminOnly = false;
528 528
 
529
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530
-				foreach( $field->inputs as $key => $input ) {
531
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
529
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530
+				foreach ( $field->inputs as $key => $input ) {
531
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
532 532
 				}
533 533
 			}
534 534
 		}
@@ -542,30 +542,30 @@  discard block
 block discarded – undo
542 542
 		$update = false;
543 543
 
544 544
 		// get the most up to date entry values
545
-		$entry = GFAPI::get_entry( $this->entry['id'] );
545
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
546 546
 
547
-		if( !empty( $this->fields_with_calculation ) ) {
547
+		if ( ! empty( $this->fields_with_calculation ) ) {
548 548
 			$update = true;
549 549
 			foreach ( $this->fields_with_calculation as $calc_field ) {
550 550
 				$inputs = $calc_field->get_entry_inputs();
551 551
 				if ( is_array( $inputs ) ) {
552 552
 				    foreach ( $inputs as $input ) {
553
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
554
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
553
+				        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
554
+				        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
555 555
 				    }
556 556
 				} else {
557
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
558
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
557
+				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
558
+				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
559 559
 				}
560 560
 			}
561 561
 
562 562
 		}
563 563
 
564
-		if( $update ) {
564
+		if ( $update ) {
565 565
 
566 566
 			$return_entry = GFAPI::update_entry( $entry );
567 567
 
568
-			if( is_wp_error( $return_entry ) ) {
568
+			if ( is_wp_error( $return_entry ) ) {
569 569
 				gravityview()->log->error( 'Updating the entry calculation fields failed', array( 'data' => $return_entry ) );
570 570
 			} else {
571 571
 				gravityview()->log->debug( 'Updating the entry calculation fields succeeded' );
@@ -596,19 +596,19 @@  discard block
 block discarded – undo
596 596
 
597 597
 		$input_name = 'input_' . $field_id;
598 598
 
599
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
599
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
600 600
 
601 601
 			// We have a new image
602 602
 
603
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
603
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
604 604
 
605 605
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
606 606
 	        $ary = stripslashes_deep( $ary );
607 607
 			$img_url = \GV\Utils::get( $ary, 0 );
608 608
 
609
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
610
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
611
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
609
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
610
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
611
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
612 612
 
613 613
 			$image_meta = array(
614 614
 				'post_excerpt' => $img_caption,
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 
618 618
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
619 619
 			if ( ! empty( $img_title ) ) {
620
-				$image_meta['post_title'] = $img_title;
620
+				$image_meta[ 'post_title' ] = $img_title;
621 621
 			}
622 622
 
623 623
 			/**
@@ -675,15 +675,15 @@  discard block
 block discarded – undo
675 675
 	 */
676 676
 	private function maybe_update_post_fields( $form ) {
677 677
 
678
-		if( empty( $this->entry['post_id'] ) ) {
678
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
679 679
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
680 680
 			return;
681 681
 		}
682 682
 
683
-		$post_id = $this->entry['post_id'];
683
+		$post_id = $this->entry[ 'post_id' ];
684 684
 
685 685
 		// Security check
686
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
686
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
687 687
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
688 688
 			return;
689 689
 		}
@@ -696,25 +696,25 @@  discard block
 block discarded – undo
696 696
 
697 697
 			$field = RGFormsModel::get_field( $form, $field_id );
698 698
 
699
-			if( ! $field ) {
699
+			if ( ! $field ) {
700 700
 				continue;
701 701
 			}
702 702
 
703
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
703
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
704 704
 
705 705
 				// Get the value of the field, including $_POSTed value
706 706
 				$value = RGFormsModel::get_field_value( $field );
707 707
 
708 708
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
709 709
 				$entry_tmp = $this->entry;
710
-				$entry_tmp["{$field_id}"] = $value;
710
+				$entry_tmp[ "{$field_id}" ] = $value;
711 711
 
712
-				switch( $field->type ) {
712
+				switch ( $field->type ) {
713 713
 
714 714
 				    case 'post_title':
715 715
 				        $post_title = $value;
716 716
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
717
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
717
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
718 718
 				        }
719 719
 				        $updated_post->post_title = $post_title;
720 720
 				        $updated_post->post_name  = $post_title;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 				    case 'post_content':
725 725
 				        $post_content = $value;
726 726
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
727
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
727
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
728 728
 				        }
729 729
 				        $updated_post->post_content = $post_content;
730 730
 				        unset( $post_content );
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 							$value = $value[ $field_id ];
743 743
 						}
744 744
 
745
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
745
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
746 746
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
747 747
 				        }
748 748
 
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 				}
761 761
 
762 762
 				// update entry after
763
-				$this->entry["{$field_id}"] = $value;
763
+				$this->entry[ "{$field_id}" ] = $value;
764 764
 
765 765
 				$update_entry = true;
766 766
 
@@ -769,11 +769,11 @@  discard block
 block discarded – undo
769 769
 
770 770
 		}
771 771
 
772
-		if( $update_entry ) {
772
+		if ( $update_entry ) {
773 773
 
774 774
 			$return_entry = GFAPI::update_entry( $this->entry );
775 775
 
776
-			if( is_wp_error( $return_entry ) ) {
776
+			if ( is_wp_error( $return_entry ) ) {
777 777
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
778 778
 			} else {
779 779
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 
784 784
 		$return_post = wp_update_post( $updated_post, true );
785 785
 
786
-		if( is_wp_error( $return_post ) ) {
786
+		if ( is_wp_error( $return_post ) ) {
787 787
 			$return_post->add_data( $updated_post, '$updated_post' );
788 788
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
789 789
 		} else {
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 		$input_type = RGFormsModel::get_input_type( $field );
806 806
 
807 807
 	    // Only certain custom field types are supported
808
-	    switch( $input_type ) {
808
+	    switch ( $input_type ) {
809 809
 		    case 'fileupload':
810 810
 		    case 'list':
811 811
 		    case 'multiselect':
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
843 843
 
844 844
 		// replace conditional shortcodes
845
-		if( $do_shortcode ) {
845
+		if ( $do_shortcode ) {
846 846
 			$output = do_shortcode( $output );
847 847
 		}
848 848
 
@@ -861,19 +861,19 @@  discard block
 block discarded – undo
861 861
 	 */
862 862
 	private function after_update() {
863 863
 
864
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
865
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
864
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
865
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
866 866
 
867 867
 		// Re-define the entry now that we've updated it.
868
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
868
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
869 869
 
870 870
 		$entry = GFFormsModel::set_entry_meta( $entry, $this->form );
871 871
 
872 872
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
873 873
 			// We need to clear the cache because Gravity Forms caches the field values, which
874 874
 			// we have just updated.
875
-			foreach ($this->form['fields'] as $key => $field) {
876
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
875
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
876
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
877 877
 			}
878 878
 		}
879 879
 
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 
893 893
 		<div class="gv-edit-entry-wrapper"><?php
894 894
 
895
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
895
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
896 896
 
897 897
 			/**
898 898
 			 * Fixes weird wpautop() issue
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
909 909
 				     * @param GravityView_Edit_Entry_Render $this This object
910 910
 				     */
911
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
911
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
912 912
 
913 913
 				    echo esc_attr( $edit_entry_title );
914 914
 			?></span>
@@ -958,16 +958,16 @@  discard block
 block discarded – undo
958 958
 
959 959
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
960 960
 
961
-			if( ! $this->is_valid ){
961
+			if ( ! $this->is_valid ) {
962 962
 
963 963
 				// Keeping this compatible with Gravity Forms.
964
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
965
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
964
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
965
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
966 966
 
967
-				echo GVCommon::generate_notice( $message , 'gv-error' );
967
+				echo GVCommon::generate_notice( $message, 'gv-error' );
968 968
 
969 969
 			} else {
970
-				$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
970
+				$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
971 971
 
972 972
 				/**
973 973
 				 * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 				 * @param array $entry Gravity Forms entry array
978 978
 				 * @param string $back_link URL to return to the original entry. @since 1.6
979 979
 				 */
980
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
980
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
981 981
 
982 982
 				echo GVCommon::generate_notice( $message );
983 983
 			}
@@ -1001,21 +1001,21 @@  discard block
 block discarded – undo
1001 1001
 		 */
1002 1002
 		do_action( 'gravityview/edit-entry/render/before', $this );
1003 1003
 
1004
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1005
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1004
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1005
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1006 1006
 		add_filter( 'gform_disable_view_counter', '__return_true' );
1007 1007
 
1008 1008
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
1009 1009
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1010 1010
 
1011 1011
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1012
-		unset( $_GET['page'] );
1012
+		unset( $_GET[ 'page' ] );
1013 1013
 
1014 1014
 		// TODO: Verify multiple-page forms
1015 1015
 
1016 1016
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1017 1017
 
1018
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1018
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1019 1019
 
1020 1020
 		ob_get_clean();
1021 1021
 
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 	 * @return string
1042 1042
 	 */
1043 1043
 	public function render_form_buttons() {
1044
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1044
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1045 1045
 	}
1046 1046
 
1047 1047
 
@@ -1061,10 +1061,10 @@  discard block
 block discarded – undo
1061 1061
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1062 1062
 
1063 1063
 		// In case we have validated the form, use it to inject the validation results into the form render
1064
-		if( isset( $this->form_after_validation ) ) {
1064
+		if ( isset( $this->form_after_validation ) ) {
1065 1065
 			$form = $this->form_after_validation;
1066 1066
 		} else {
1067
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1067
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1068 1068
 		}
1069 1069
 
1070 1070
 		$form = $this->filter_conditional_logic( $form );
@@ -1072,8 +1072,8 @@  discard block
 block discarded – undo
1072 1072
 		$form = $this->prefill_conditional_logic( $form );
1073 1073
 
1074 1074
 		// for now we don't support Save and Continue feature.
1075
-		if( ! self::$supports_save_and_continue ) {
1076
-	        unset( $form['save'] );
1075
+		if ( ! self::$supports_save_and_continue ) {
1076
+	        unset( $form[ 'save' ] );
1077 1077
 		}
1078 1078
 
1079 1079
 		return $form;
@@ -1094,29 +1094,29 @@  discard block
 block discarded – undo
1094 1094
 	 */
1095 1095
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1096 1096
 
1097
-		if( GFCommon::is_post_field( $field ) ) {
1097
+		if ( GFCommon::is_post_field( $field ) ) {
1098 1098
 
1099 1099
 			$message = null;
1100 1100
 
1101 1101
 			// First, make sure they have the capability to edit the post.
1102
-			if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1102
+			if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1103 1103
 
1104 1104
 				/**
1105 1105
 				 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1106 1106
 				 * @param string $message The existing "You don't have permission..." text
1107 1107
 				 */
1108
-				$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1108
+				$message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1109 1109
 
1110
-			} elseif( null === get_post( $this->entry['post_id'] ) ) {
1110
+			} elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1111 1111
 				/**
1112 1112
 				 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1113 1113
 				 * @param string $message The existing "This field is not editable; the post no longer exists." text
1114 1114
 				 */
1115
-				$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1115
+				$message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1116 1116
 			}
1117 1117
 
1118
-			if( $message ) {
1119
-				$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1118
+			if ( $message ) {
1119
+				$field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1120 1120
 			}
1121 1121
 		}
1122 1122
 
@@ -1141,8 +1141,8 @@  discard block
 block discarded – undo
1141 1141
 
1142 1142
 		// If the form has been submitted, then we don't need to pre-fill the values,
1143 1143
 		// Except for fileupload type and when a field input is overridden- run always!!
1144
-		if(
1145
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1144
+		if (
1145
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1146 1146
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1147 1147
 			&& ! GFCommon::is_product_field( $field->type )
1148 1148
 			|| ! empty( $field_content )
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 	    $return = null;
1163 1163
 
1164 1164
 		/** @var GravityView_Field $gv_field */
1165
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1165
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1166 1166
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1167 1167
 		} else {
1168 1168
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 	    // If there was output, it's an error
1172 1172
 	    $warnings = ob_get_clean();
1173 1173
 
1174
-	    if( !empty( $warnings ) ) {
1174
+	    if ( ! empty( $warnings ) ) {
1175 1175
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1176 1176
 	    }
1177 1177
 
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1197 1197
 
1198 1198
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1199
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1199
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1200 1200
 
1201 1201
 			$field_value = array();
1202 1202
 
@@ -1205,10 +1205,10 @@  discard block
 block discarded – undo
1205 1205
 
1206 1206
 			foreach ( (array)$field->inputs as $input ) {
1207 1207
 
1208
-				$input_id = strval( $input['id'] );
1208
+				$input_id = strval( $input[ 'id' ] );
1209 1209
 				
1210 1210
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1211
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1211
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1212 1212
 				    $allow_pre_populated = false;
1213 1213
 				}
1214 1214
 
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 
1217 1217
 			$pre_value = $field->get_value_submission( array(), false );
1218 1218
 
1219
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1219
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1220 1220
 
1221 1221
 		} else {
1222 1222
 
@@ -1227,13 +1227,13 @@  discard block
 block discarded – undo
1227 1227
 
1228 1228
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1229 1229
 			// or pre-populated value if not empty and set to override saved value
1230
-			$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;
1230
+			$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;
1231 1231
 
1232 1232
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1233
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1233
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1234 1234
 				$categories = array();
1235 1235
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1236
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1236
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1237 1237
 				}
1238 1238
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1239 1239
 			}
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
 	     * @param GF_Field $field Gravity Forms field object
1262 1262
 	     * @param GravityView_Edit_Entry_Render $this Current object
1263 1263
 	     */
1264
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1264
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1265 1265
 
1266 1266
 		return $field_value;
1267 1267
 	}
@@ -1278,12 +1278,12 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	public function gform_pre_validation( $form ) {
1280 1280
 
1281
-		if( ! $this->verify_nonce() ) {
1281
+		if ( ! $this->verify_nonce() ) {
1282 1282
 			return $form;
1283 1283
 		}
1284 1284
 
1285 1285
 		// Fix PHP warning regarding undefined index.
1286
-		foreach ( $form['fields'] as &$field) {
1286
+		foreach ( $form[ 'fields' ] as &$field ) {
1287 1287
 
1288 1288
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1289 1289
 			// expects certain field array items to be set.
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1292 1292
 			}
1293 1293
 
1294
-			switch( RGFormsModel::get_input_type( $field ) ) {
1294
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1295 1295
 
1296 1296
 				/**
1297 1297
 				 * 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.
@@ -1305,26 +1305,26 @@  discard block
 block discarded – undo
1305 1305
 				    // Set the previous value
1306 1306
 				    $entry = $this->get_entry();
1307 1307
 
1308
-				    $input_name = 'input_'.$field->id;
1309
-				    $form_id = $form['id'];
1308
+				    $input_name = 'input_' . $field->id;
1309
+				    $form_id = $form[ 'id' ];
1310 1310
 
1311 1311
 				    $value = NULL;
1312 1312
 
1313 1313
 				    // Use the previous entry value as the default.
1314
-				    if( isset( $entry[ $field->id ] ) ) {
1314
+				    if ( isset( $entry[ $field->id ] ) ) {
1315 1315
 				        $value = $entry[ $field->id ];
1316 1316
 				    }
1317 1317
 
1318 1318
 				    // If this is a single upload file
1319
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1320
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1321
-				        $value = $file_path['url'];
1319
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1320
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1321
+				        $value = $file_path[ 'url' ];
1322 1322
 
1323 1323
 				    } else {
1324 1324
 
1325 1325
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1326 1326
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1327
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1327
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1328 1328
 
1329 1329
 				    }
1330 1330
 
@@ -1332,10 +1332,10 @@  discard block
 block discarded – undo
1332 1332
 
1333 1333
 				        // If there are fresh uploads, process and merge them.
1334 1334
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1335
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1335
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1336 1336
 				            $value = empty( $value ) ? '[]' : $value;
1337 1337
 				            $value = stripslashes_deep( $value );
1338
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1338
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1339 1339
 				        }
1340 1340
 
1341 1341
 				    } else {
@@ -1353,8 +1353,8 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
 				case 'number':
1355 1355
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1356
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1357
-				        $_POST['input_'.$field->id ] = NULL;
1356
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1357
+				        $_POST[ 'input_' . $field->id ] = NULL;
1358 1358
 				    }
1359 1359
 				    break;
1360 1360
 			}
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 		 * You can enter whatever you want!
1392 1392
 		 * We try validating, and customize the results using `self::custom_validation()`
1393 1393
 		 */
1394
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1394
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1395 1395
 
1396 1396
 		// Needed by the validate funtion
1397 1397
 		$failed_validation_page = NULL;
@@ -1399,14 +1399,14 @@  discard block
 block discarded – undo
1399 1399
 
1400 1400
 		// Prevent entry limit from running when editing an entry, also
1401 1401
 		// prevent form scheduling from preventing editing
1402
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1402
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1403 1403
 
1404 1404
 		// Hide fields depending on Edit Entry settings
1405
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1405
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1406 1406
 
1407 1407
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1408 1408
 
1409
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1409
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1410 1410
 	}
1411 1411
 
1412 1412
 
@@ -1429,7 +1429,7 @@  discard block
 block discarded – undo
1429 1429
 
1430 1430
 		$gv_valid = true;
1431 1431
 
1432
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1432
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1433 1433
 
1434 1434
 			$value = RGFormsModel::get_field_value( $field );
1435 1435
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1442,35 +1442,35 @@  discard block
 block discarded – undo
1442 1442
 				case 'post_image':
1443 1443
 
1444 1444
 				    // in case nothing is uploaded but there are already files saved
1445
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1445
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1446 1446
 				        $field->failed_validation = false;
1447 1447
 				        unset( $field->validation_message );
1448 1448
 				    }
1449 1449
 
1450 1450
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1451
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1451
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1452 1452
 
1453 1453
 				        $input_name = 'input_' . $field->id;
1454 1454
 				        //uploaded
1455
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1455
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1456 1456
 
1457 1457
 				        //existent
1458 1458
 				        $entry = $this->get_entry();
1459 1459
 				        $value = NULL;
1460
-				        if( isset( $entry[ $field->id ] ) ) {
1460
+				        if ( isset( $entry[ $field->id ] ) ) {
1461 1461
 				            $value = json_decode( $entry[ $field->id ], true );
1462 1462
 				        }
1463 1463
 
1464 1464
 				        // count uploaded files and existent entry files
1465 1465
 				        $count_files = count( $file_names ) + count( $value );
1466 1466
 
1467
-				        if( $count_files > $field->maxFiles ) {
1467
+				        if ( $count_files > $field->maxFiles ) {
1468 1468
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1469 1469
 				            $field->failed_validation = 1;
1470 1470
 				            $gv_valid = false;
1471 1471
 
1472 1472
 				            // in case of error make sure the newest upload files are removed from the upload input
1473
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1473
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1474 1474
 				        }
1475 1475
 
1476 1476
 				    }
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
 			}
1482 1482
 
1483 1483
 			// This field has failed validation.
1484
-			if( !empty( $field->failed_validation ) ) {
1484
+			if ( ! empty( $field->failed_validation ) ) {
1485 1485
 
1486 1486
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1487 1487
 
@@ -1499,19 +1499,19 @@  discard block
 block discarded – undo
1499 1499
 				}
1500 1500
 
1501 1501
 				// You can't continue inside a switch, so we do it after.
1502
-				if( empty( $field->failed_validation ) ) {
1502
+				if ( empty( $field->failed_validation ) ) {
1503 1503
 				    continue;
1504 1504
 				}
1505 1505
 
1506 1506
 				// checks if the No Duplicates option is not validating entry against itself, since
1507 1507
 				// we're editing a stored entry, it would also assume it's a duplicate.
1508
-				if( !empty( $field->noDuplicates ) ) {
1508
+				if ( ! empty( $field->noDuplicates ) ) {
1509 1509
 
1510 1510
 				    $entry = $this->get_entry();
1511 1511
 
1512 1512
 				    // If the value of the entry is the same as the stored value
1513 1513
 				    // Then we can assume it's not a duplicate, it's the same.
1514
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1514
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1515 1515
 				        //if value submitted was not changed, then don't validate
1516 1516
 				        $field->failed_validation = false;
1517 1517
 
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
 				}
1525 1525
 
1526 1526
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1527
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1527
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1528 1528
 				    unset( $field->validation_message );
1529 1529
 	                $field->validation_message = false;
1530 1530
 				    continue;
@@ -1536,12 +1536,12 @@  discard block
 block discarded – undo
1536 1536
 
1537 1537
 		}
1538 1538
 
1539
-		$validation_results['is_valid'] = $gv_valid;
1539
+		$validation_results[ 'is_valid' ] = $gv_valid;
1540 1540
 
1541 1541
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1542 1542
 
1543 1543
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1544
-		$this->form_after_validation = $validation_results['form'];
1544
+		$this->form_after_validation = $validation_results[ 'form' ];
1545 1545
 
1546 1546
 		return $validation_results;
1547 1547
 	}
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
 	 */
1555 1555
 	public function get_entry() {
1556 1556
 
1557
-		if( empty( $this->entry ) ) {
1557
+		if ( empty( $this->entry ) ) {
1558 1558
 			// Get the database value of the entry that's being edited
1559 1559
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1560 1560
 		}
@@ -1586,10 +1586,10 @@  discard block
 block discarded – undo
1586 1586
 		}
1587 1587
 
1588 1588
 		// If edit tab not yet configured, show all fields
1589
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1589
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1590 1590
 
1591 1591
 		// Hide fields depending on admin settings
1592
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1592
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1593 1593
 
1594 1594
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1595 1595
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 	 */
1622 1622
 	private function filter_fields( $fields, $configured_fields ) {
1623 1623
 
1624
-		if( empty( $fields ) || !is_array( $fields ) ) {
1624
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1625 1625
 			return $fields;
1626 1626
 		}
1627 1627
 
@@ -1634,18 +1634,18 @@  discard block
 block discarded – undo
1634 1634
 
1635 1635
 			// Remove the fields that have calculation properties and keep them to be used later
1636 1636
 			// @since 1.16.2
1637
-			if( $field->has_calculation() ) {
1638
-				$this->fields_with_calculation[] = $field;
1637
+			if ( $field->has_calculation() ) {
1638
+				$this->fields_with_calculation[ ] = $field;
1639 1639
 				// don't remove the calculation fields on form render.
1640 1640
 			}
1641 1641
 
1642
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1642
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1643 1643
 				unset( $fields[ $key ] );
1644 1644
 			}
1645 1645
 		}
1646 1646
 
1647 1647
 		// The Edit tab has not been configured, so we return all fields by default.
1648
-		if( empty( $configured_fields ) ) {
1648
+		if ( empty( $configured_fields ) ) {
1649 1649
 			return $fields;
1650 1650
 		}
1651 1651
 
@@ -1654,8 +1654,8 @@  discard block
 block discarded – undo
1654 1654
 
1655 1655
 	        /** @var GF_Field $field */
1656 1656
 	        foreach ( $fields as $field ) {
1657
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1658
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1657
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1658
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1659 1659
 				    break;
1660 1660
 				}
1661 1661
 
@@ -1678,14 +1678,14 @@  discard block
 block discarded – undo
1678 1678
 
1679 1679
 		$return_field = $field;
1680 1680
 
1681
-		if( empty( $field_setting['show_label'] ) ) {
1681
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1682 1682
 			$return_field->label = '';
1683
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1684
-			$return_field->label = $field_setting['custom_label'];
1683
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1684
+			$return_field->label = $field_setting[ 'custom_label' ];
1685 1685
 		}
1686 1686
 
1687
-		if( !empty( $field_setting['custom_class'] ) ) {
1688
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1687
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1688
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1689 1689
 		}
1690 1690
 
1691 1691
 		/**
@@ -1723,16 +1723,16 @@  discard block
 block discarded – undo
1723 1723
 	     */
1724 1724
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1725 1725
 
1726
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1727
-			foreach( $fields as $k => $field ) {
1728
-				if( $field->adminOnly ) {
1726
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1727
+			foreach ( $fields as $k => $field ) {
1728
+				if ( $field->adminOnly ) {
1729 1729
 				    unset( $fields[ $k ] );
1730 1730
 				}
1731 1731
 			}
1732 1732
 			return $fields;
1733 1733
 		}
1734 1734
 
1735
-	    foreach( $fields as &$field ) {
1735
+	    foreach ( $fields as &$field ) {
1736 1736
 		    $field->adminOnly = false;
1737 1737
 		}
1738 1738
 
@@ -1756,22 +1756,22 @@  discard block
 block discarded – undo
1756 1756
 	 */
1757 1757
 	function prefill_conditional_logic( $form ) {
1758 1758
 
1759
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1759
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1760 1760
 			return $form;
1761 1761
 		}
1762 1762
 
1763 1763
 		// Have Conditional Logic pre-fill fields as if the data were default values
1764 1764
 		/** @var GF_Field $field */
1765
-		foreach ( $form['fields'] as &$field ) {
1765
+		foreach ( $form[ 'fields' ] as &$field ) {
1766 1766
 
1767
-			if( 'checkbox' === $field->type ) {
1767
+			if ( 'checkbox' === $field->type ) {
1768 1768
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1769
-				    $input_id = $input['id'];
1769
+				    $input_id = $input[ 'id' ];
1770 1770
 				    $choice = $field->choices[ $key ];
1771 1771
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1772 1772
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1773
-				    if( $match ) {
1774
-				        $field->choices[ $key ]['isSelected'] = true;
1773
+				    if ( $match ) {
1774
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1775 1775
 				    }
1776 1776
 				}
1777 1777
 			} else {
@@ -1779,15 +1779,15 @@  discard block
 block discarded – undo
1779 1779
 				// We need to run through each field to set the default values
1780 1780
 				foreach ( $this->entry as $field_id => $field_value ) {
1781 1781
 
1782
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1782
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1783 1783
 
1784
-				        if( 'list' === $field->type ) {
1784
+				        if ( 'list' === $field->type ) {
1785 1785
 				            $list_rows = maybe_unserialize( $field_value );
1786 1786
 
1787 1787
 				            $list_field_value = array();
1788
-				            foreach ( (array) $list_rows as $row ) {
1789
-				                foreach ( (array) $row as $column ) {
1790
-				                    $list_field_value[] = $column;
1788
+				            foreach ( (array)$list_rows as $row ) {
1789
+				                foreach ( (array)$row as $column ) {
1790
+				                    $list_field_value[ ] = $column;
1791 1791
 				                }
1792 1792
 				            }
1793 1793
 
@@ -1822,16 +1822,16 @@  discard block
 block discarded – undo
1822 1822
 		 */
1823 1823
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1824 1824
 
1825
-		if( $use_conditional_logic ) {
1825
+		if ( $use_conditional_logic ) {
1826 1826
 			return $form;
1827 1827
 		}
1828 1828
 
1829
-		foreach( $form['fields'] as &$field ) {
1829
+		foreach ( $form[ 'fields' ] as &$field ) {
1830 1830
 			/* @var GF_Field $field */
1831 1831
 			$field->conditionalLogic = null;
1832 1832
 		}
1833 1833
 
1834
-		unset( $form['button']['conditionalLogic'] );
1834
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1835 1835
 
1836 1836
 		return $form;
1837 1837
 
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
 	 */
1849 1849
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1850 1850
 
1851
-		if( ! $this->is_edit_entry() ) {
1851
+		if ( ! $this->is_edit_entry() ) {
1852 1852
 			return $has_conditional_logic;
1853 1853
 		}
1854 1854
 
@@ -1880,44 +1880,44 @@  discard block
 block discarded – undo
1880 1880
 		 *  2. There are two entries embedded using oEmbed
1881 1881
 		 *  3. One of the entries has just been saved
1882 1882
 		 */
1883
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1883
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1884 1884
 
1885 1885
 			$error = true;
1886 1886
 
1887 1887
 		}
1888 1888
 
1889
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1889
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1890 1890
 
1891 1891
 			$error = true;
1892 1892
 
1893
-		} elseif( ! $this->verify_nonce() ) {
1893
+		} elseif ( ! $this->verify_nonce() ) {
1894 1894
 
1895 1895
 			/**
1896 1896
 			 * If the Entry is embedded, there may be two entries on the same page.
1897 1897
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1898 1898
 			 */
1899
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1899
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1900 1900
 				$error = true;
1901 1901
 			} else {
1902
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1902
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1903 1903
 			}
1904 1904
 
1905 1905
 		}
1906 1906
 
1907
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1908
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1907
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1908
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1909 1909
 		}
1910 1910
 
1911
-		if( $this->entry['status'] === 'trash' ) {
1912
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1911
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1912
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1913 1913
 		}
1914 1914
 
1915 1915
 		// No errors; everything's fine here!
1916
-		if( empty( $error ) ) {
1916
+		if ( empty( $error ) ) {
1917 1917
 			return true;
1918 1918
 		}
1919 1919
 
1920
-		if( $echo && $error !== true ) {
1920
+		if ( $echo && $error !== true ) {
1921 1921
 
1922 1922
 	        $error = esc_html( $error );
1923 1923
 
@@ -1925,10 +1925,10 @@  discard block
 block discarded – undo
1925 1925
 	         * @since 1.9
1926 1926
 	         */
1927 1927
 	        if ( ! empty( $this->entry ) ) {
1928
-		        $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;" ) );
1928
+		        $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;" ) );
1929 1929
 	        }
1930 1930
 
1931
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1931
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1932 1932
 		}
1933 1933
 
1934 1934
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1948,17 +1948,17 @@  discard block
 block discarded – undo
1948 1948
 
1949 1949
 		$error = NULL;
1950 1950
 
1951
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
1952
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
1951
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
1952
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
1953 1953
 		}
1954 1954
 
1955 1955
 		// No errors; everything's fine here!
1956
-		if( empty( $error ) ) {
1956
+		if ( empty( $error ) ) {
1957 1957
 			return true;
1958 1958
 		}
1959 1959
 
1960
-		if( $echo ) {
1961
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1960
+		if ( $echo ) {
1961
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1962 1962
 		}
1963 1963
 
1964 1964
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1979,14 +1979,14 @@  discard block
 block discarded – undo
1979 1979
 	private function check_user_cap_edit_field( $field ) {
1980 1980
 
1981 1981
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
1982
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1982
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1983 1983
 			return true;
1984 1984
 		}
1985 1985
 
1986
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
1986
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
1987 1987
 
1988
-		if( $field_cap ) {
1989
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
1988
+		if ( $field_cap ) {
1989
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
1990 1990
 		}
1991 1991
 
1992 1992
 		return false;
@@ -2000,17 +2000,17 @@  discard block
 block discarded – undo
2000 2000
 	public function verify_nonce() {
2001 2001
 
2002 2002
 		// Verify form submitted for editing single
2003
-		if( $this->is_edit_entry_submission() ) {
2003
+		if ( $this->is_edit_entry_submission() ) {
2004 2004
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2005 2005
 		}
2006 2006
 
2007 2007
 		// Verify
2008
-		else if( ! $this->is_edit_entry() ) {
2008
+		else if ( ! $this->is_edit_entry() ) {
2009 2009
 			$valid = false;
2010 2010
 		}
2011 2011
 
2012 2012
 		else {
2013
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2013
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2014 2014
 		}
2015 2015
 
2016 2016
 		/**
Please login to merge, or discard this patch.
includes/class-gravityview-shortcode.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		gravityview()->log->debug( '$passed_atts: ', array( 'data' => $passed_atts ) );
49 49
 
50 50
 		// Get details about the current View
51
-		if( !empty( $passed_atts['detail'] ) ) {
52
-			return $this->get_view_detail( $passed_atts['detail'] );
51
+		if ( ! empty( $passed_atts[ 'detail' ] ) ) {
52
+			return $this->get_view_detail( $passed_atts[ 'detail' ] );
53 53
 		}
54 54
 
55 55
 		$atts = $this->parse_and_sanitize_atts( $passed_atts );
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
86 86
 
87 87
 		// Only keep the passed attributes after making sure that they're valid pairs
88
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
88
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
89 89
 
90 90
 		$atts = array();
91 91
 
92
-		foreach( $filtered_atts as $key => $passed_value ) {
92
+		foreach ( $filtered_atts as $key => $passed_value ) {
93 93
 
94 94
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
95 95
 			$passed_value = GravityView_Merge_Tags::replace_variables( $passed_value );
96 96
 
97
-			switch( $defaults[ $key ]['type'] ) {
97
+			switch ( $defaults[ $key ][ 'type' ] ) {
98 98
 
99 99
 				/**
100 100
 				 * Make sure number fields are numeric.
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
103 103
 				 */
104 104
 				case 'number':
105
-					if( is_numeric( $passed_value ) ) {
105
+					if ( is_numeric( $passed_value ) ) {
106 106
 						$atts[ $key ] = ( $passed_value + 0 );
107 107
 					}
108 108
 					break;
109 109
 
110 110
 				/** @since 2.1 */
111 111
 				case 'operator':
112
-					if( GFFormsModel::is_valid_operator( $passed_value ) ) {
112
+					if ( GFFormsModel::is_valid_operator( $passed_value ) ) {
113 113
 						$atts[ $key ] = $passed_value;
114 114
 					}
115 115
 					break;
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 				 */
125 125
 				case 'select':
126 126
 				case 'radio':
127
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
128
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
127
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
128
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
129 129
 						$atts[ $key ] = $passed_value;
130 130
 					}
131 131
 					break;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		$gravityview_view = GravityView_View::getInstance();
155 155
 		$return = '';
156 156
 
157
-		switch( $detail ) {
157
+		switch ( $detail ) {
158 158
 			case 'total_entries':
159 159
 				$return = number_format_i18n( $gravityview_view->getTotalEntries() );
160 160
 				break;
Please login to merge, or discard this patch.
future/includes/class-gv-template-view-list.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,13 +72,13 @@
 block discarded – undo
72 72
 		$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
73 73
 
74 74
 		if ( is_numeric( $field->ID ) ) {
75
-			$extras['field'] = $field->as_configuration();
75
+			$extras[ 'field' ] = $field->as_configuration();
76 76
 		}
77 77
 
78
-		$extras['entry'] = $entry->as_entry();
79
-		$extras['hide_empty'] = $hide_empty;
80
-		$extras['label'] = $label;
81
-		$extras['value'] = $value;
78
+		$extras[ 'entry' ] = $entry->as_entry();
79
+		$extras[ 'hide_empty' ] = $hide_empty;
80
+		$extras[ 'label' ] = $label;
81
+		$extras[ 'value' ] = $value;
82 82
 
83 83
 		return \gravityview_field_output( $extras, $context );
84 84
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-list.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@
 block discarded – undo
57 57
 		$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
58 58
 
59 59
 		if ( is_numeric( $field->ID ) ) {
60
-			$extras['field'] = $field->as_configuration();
60
+			$extras[ 'field' ] = $field->as_configuration();
61 61
 		}
62 62
 
63
-		$extras['entry'] = $this->entry->as_entry();
64
-		$extras['hide_empty'] = $hide_empty;
65
-		$extras['label'] = $label;
66
-		$extras['value'] = $value;
63
+		$extras[ 'entry' ] = $this->entry->as_entry();
64
+		$extras[ 'hide_empty' ] = $hide_empty;
65
+		$extras[ 'label' ] = $label;
66
+		$extras[ 'value' ] = $value;
67 67
 
68 68
 		return \gravityview_field_output( $extras, $context );
69 69
 	}
Please login to merge, or discard this patch.
includes/class-gravityview-entry-approval.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	private function add_hooks() {
40 40
 
41 41
 		// in case entry is edited (on admin or frontend)
42
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
42
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
43 43
 
44 44
 		// when using the User opt-in field, check on entry submission
45 45
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
46 46
 
47 47
 		// process ajax approve entry requests
48
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
48
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
49 49
 
50 50
 		// autounapprove
51 51
 		add_action( 'gravityview/edit_entry/after_update', array( __CLASS__, 'autounapprove' ), 10, 4 );
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 			return;
95 95
 		}
96 96
 
97
-		$form = GFAPI::get_form( $entry['form_id'] );
97
+		$form = GFAPI::get_form( $entry[ 'form_id' ] );
98 98
 
99 99
 		if ( ! $form ) {
100
-			gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry['form_id'], 'entry_id' => $entry_id ) );
100
+			gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $entry_id ) );
101 101
 			return;
102 102
 		}
103 103
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public static function add_approval_notification_events( $notification_events = array(), $form = array() ) {
116 116
 
117
-		$notification_events['gravityview/approve_entries/approved'] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' );
118
-		$notification_events['gravityview/approve_entries/disapproved'] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' );
119
-		$notification_events['gravityview/approve_entries/unapproved'] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' );
120
-		$notification_events['gravityview/approve_entries/updated'] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' );
117
+		$notification_events[ 'gravityview/approve_entries/approved' ] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' );
118
+		$notification_events[ 'gravityview/approve_entries/disapproved' ] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' );
119
+		$notification_events[ 'gravityview/approve_entries/unapproved' ] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' );
120
+		$notification_events[ 'gravityview/approve_entries/updated' ] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' );
121 121
 
122 122
 		return $notification_events;
123 123
 	}
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public static function get_entry_status( $entry, $value_or_label = 'label' ) {
137 137
 
138
-		$entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry, true );
138
+		$entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry, true );
139 139
 
140 140
 		$status = gform_get_meta( $entry_id, self::meta_key );
141 141
 
142 142
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
143 143
 
144
-		if( 'value' === $value_or_label ) {
144
+		if ( 'value' === $value_or_label ) {
145 145
 			return $status;
146 146
 		}
147 147
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		$nonce = \GV\Utils::_POST( 'nonce' );
180 180
 
181 181
 		// Valid status
182
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
182
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
183 183
 
184 184
 			gravityview()->log->error( 'Invalid approval status', array( 'data' => $_POST ) );
185 185
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
212 212
 
213
-			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') );
213
+			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) );
214 214
 
215 215
 		}
216 216
 
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 		}
262 262
 
263 263
 		// Set default
264
-		self::update_approved_meta( $entry['id'], $default_status, $entry['form_id'] );
264
+		self::update_approved_meta( $entry[ 'id' ], $default_status, $entry[ 'form_id' ] );
265 265
 
266 266
 		// Then check for if there is an approval column, and use that value instead
267
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
267
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
268 268
 	}
269 269
 
270 270
 	/**
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
280 280
 
281
-		$approved_column = self::get_approved_column( $form['id'] );
281
+		$approved_column = self::get_approved_column( $form[ 'id' ] );
282 282
 
283 283
 		/**
284 284
 		 * If the form doesn't contain the approve field, don't assume anything.
285 285
 		 */
286
-		if( empty( $approved_column ) ) {
286
+		if ( empty( $approved_column ) ) {
287 287
 			return;
288 288
 		}
289 289
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			$value = GravityView_Entry_Approval_Status::APPROVED;
298 298
 		}
299 299
 
300
-		self::update_approved_meta( $entry_id, $value, $form['id'] );
300
+		self::update_approved_meta( $entry_id, $value, $form[ 'id' ] );
301 301
 	}
302 302
 
303 303
 	/**
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	public static function update_bulk( $entries = array(), $approved, $form_id ) {
317 317
 
318
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
318
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
319 319
 			gravityview()->log->error( 'Entries were empty or malformed.', array( 'data' => $entries ) );
320 320
 			return NULL;
321 321
 		}
322 322
 
323
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
323
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
324 324
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
325 325
 			return NULL;
326 326
 		}
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 		$approved_column_id = self::get_approved_column( $form_id );
336 336
 
337 337
 		$success = true;
338
-		foreach( $entries as $entry_id ) {
338
+		foreach ( $entries as $entry_id ) {
339 339
 			$update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
340 340
 
341
-			if( ! $update_success ) {
341
+			if ( ! $update_success ) {
342 342
 				$success = false;
343 343
 			}
344 344
 		}
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
 	 */
363 363
 	public static function update_approved( $entry_id = 0, $approved = 2, $form_id = 0, $approvedcolumn = 0 ) {
364 364
 
365
-		if( !class_exists( 'GFAPI' ) ) {
365
+		if ( ! class_exists( 'GFAPI' ) ) {
366 366
 			gravityview()->log->error( 'GFAPI does not exist' );
367 367
 			return false;
368 368
 		}
369 369
 
370
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
370
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
371 371
 			gravityview()->log->error( 'Not a valid approval value.' );
372 372
 			return false;
373 373
 		}
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		// If the form has an Approve/Reject field, update that value
385 385
 		$result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn );
386 386
 
387
-		if( is_wp_error( $result ) ) {
387
+		if ( is_wp_error( $result ) ) {
388 388
 			gravityview()->log->error( 'Entry approval not updated: {error}', array( 'error' => $result->get_error_message() ) );
389 389
 			return false;
390 390
 		}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 		// add note to entry if approval field updating worked or there was no approved field
398 398
 		// There's no validation for the meta
399
-		if( true === $result ) {
399
+		if ( true === $result ) {
400 400
 
401 401
 			// Add an entry note
402 402
 			self::add_approval_status_updated_note( $entry_id, $approved );
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 
450 450
 		$note_id = false;
451 451
 
452
-		if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
452
+		if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
453 453
 
454 454
 			$current_user = wp_get_current_user();
455 455
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 */
472 472
 	private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) {
473 473
 
474
-		if( empty( $approvedcolumn ) ) {
474
+		if ( empty( $approvedcolumn ) ) {
475 475
 			$approvedcolumn = self::get_approved_column( $form_id );
476 476
 		}
477 477
 
@@ -494,12 +494,12 @@  discard block
 block discarded – undo
494 494
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
495 495
 
496 496
 		$new_value = '';
497
-		if( GravityView_Entry_Approval_Status::APPROVED === $status ) {
497
+		if ( GravityView_Entry_Approval_Status::APPROVED === $status ) {
498 498
 			$new_value = self::get_approved_column_input_label( $form_id, $approvedcolumn );
499 499
 		}
500 500
 
501 501
 		//update entry
502
-		$entry["{$approvedcolumn}"] = $new_value;
502
+		$entry[ "{$approvedcolumn}" ] = $new_value;
503 503
 
504 504
 		/**
505 505
 		 * Note: GFAPI::update_entry() doesn't trigger `gform_after_update_entry`, so we trigger updating the meta ourselves
@@ -530,12 +530,12 @@  discard block
 block discarded – undo
530 530
 		// If the user has enabled a different value than the label (for some reason), use it.
531 531
 		// This is highly unlikely
532 532
 		if ( is_array( $field->choices ) && ! empty( $field->choices ) ) {
533
-			return isset( $field->choices[0]['value'] ) ? $field->choices[0]['value'] : $field->choices[0]['text'];
533
+			return isset( $field->choices[ 0 ][ 'value' ] ) ? $field->choices[ 0 ][ 'value' ] : $field->choices[ 0 ][ 'text' ];
534 534
 		}
535 535
 
536 536
 		// Otherwise, fall back on the inputs array
537 537
 		if ( is_array( $field->inputs ) && ! empty( $field->inputs ) ) {
538
-			return $field->inputs[0]['label'];
538
+			return $field->inputs[ 0 ][ 'label' ];
539 539
 		}
540 540
 
541 541
 		return null;
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 		 * @since 1.18 Added "unapproved"
588 588
 		 * @param  int $entry_id ID of the Gravity Forms entry
589 589
 		 */
590
-		do_action( 'gravityview/approve_entries/' . $action , $entry_id );
590
+		do_action( 'gravityview/approve_entries/' . $action, $entry_id );
591 591
 	}
592 592
 
593 593
 	/**
@@ -600,11 +600,11 @@  discard block
 block discarded – undo
600 600
 	 */
601 601
 	static public function get_approved_column( $form ) {
602 602
 
603
-		if( empty( $form ) ) {
603
+		if ( empty( $form ) ) {
604 604
 			return null;
605 605
 		}
606 606
 
607
-		if( !is_array( $form ) ) {
607
+		if ( ! is_array( $form ) ) {
608 608
 			$form = GVCommon::get_form( $form );
609 609
 		}
610 610
 
@@ -614,22 +614,22 @@  discard block
 block discarded – undo
614 614
 		 * @var string $key
615 615
 		 * @var GF_Field $field
616 616
 		 */
617
-		foreach( $form['fields'] as $key => $field ) {
617
+		foreach ( $form[ 'fields' ] as $key => $field ) {
618 618
 
619 619
 			$inputs = $field->get_entry_inputs();
620 620
 
621
-			if( !empty( $field->gravityview_approved ) ) {
622
-				if ( ! empty( $inputs ) && !empty( $inputs[0]['id'] ) ) {
623
-					$approved_column_id = $inputs[0]['id'];
621
+			if ( ! empty( $field->gravityview_approved ) ) {
622
+				if ( ! empty( $inputs ) && ! empty( $inputs[ 0 ][ 'id' ] ) ) {
623
+					$approved_column_id = $inputs[ 0 ][ 'id' ];
624 624
 					break;
625 625
 				}
626 626
 			}
627 627
 
628 628
 			// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
629
-			if( 'checkbox' === $field->type && ! empty( $inputs ) ) {
629
+			if ( 'checkbox' === $field->type && ! empty( $inputs ) ) {
630 630
 				foreach ( $inputs as $input ) {
631
-					if ( 'approved' === strtolower( $input['label'] ) ) {
632
-						$approved_column_id = $input['id'];
631
+					if ( 'approved' === strtolower( $input[ 'label' ] ) ) {
632
+						$approved_column_id = $input[ 'id' ];
633 633
 						break;
634 634
 					}
635 635
 				}
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 
656 656
 		$view_keys = array_keys( $gv_data->get_views() );
657 657
 
658
-		$view = \GV\View::by_id( $view_keys[0] );
658
+		$view = \GV\View::by_id( $view_keys[ 0 ] );
659 659
 
660 660
 		if ( ! $view->settings->get( 'unapprove_edit' ) ) {
661 661
 			return;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 			return;
666 666
 		}
667 667
 
668
-		self::update_approved_meta( $entry_id, GravityView_Entry_Approval_Status::UNAPPROVED, $form['id'] );
668
+		self::update_approved_meta( $entry_id, GravityView_Entry_Approval_Status::UNAPPROVED, $form[ 'id' ] );
669 669
 	}
670 670
 
671 671
 }
Please login to merge, or discard this patch.
future/includes/class-gv-request-admin.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 			return true;
31 31
 		}
32 32
 
33
-		$context = $args[1];
33
+		$context = $args[ 1 ];
34 34
 
35 35
 		/**
36 36
 		 * Assume false by default.
37 37
 		 */
38 38
 		$is_page = false;
39 39
 
40
-		if( function_exists( '\get_current_screen' ) ) {
40
+		if ( function_exists( '\get_current_screen' ) ) {
41 41
 			$current_screen = \get_current_screen();
42 42
 		} else {
43 43
 			$current_screen = false;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 				$is_page = 'single';
51 51
 			} else if ( $is_gv_settings = 'gravityview_page_gravityview_settings' === $current_screen->id ) {
52 52
 				$is_page = 'settings';
53
-			} else if( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) {
53
+			} else if ( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) {
54 54
 				$is_page = 'downloads';
55 55
 			}
56 56
 		}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		 * @param[in,out] string|bool $is_page If false, no. If string, the name of the page (`single`, `settings`, or `views`)
61 61
 		 * @param[in] string $hook The name of the page to check against. Is passed to the method.
62 62
 		 */
63
-		$is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $args[0] );
63
+		$is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $args[ 0 ] );
64 64
 
65 65
 		// If the current page is the same as the compared page
66 66
 		if ( ! empty( $context ) ) {
Please login to merge, or discard this patch.