Completed
Pull Request — develop (#1487)
by Zack
14:14 queued 02:44
created
future/includes/class-gv-license-handler.php 1 patch
Spacing   +64 added lines, -64 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,11 +184,11 @@  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
-			do_action('gravityview/admin_installer/delete_downloads_data', true );
191
+			do_action( 'gravityview/admin_installer/delete_downloads_data', true );
192 192
 
193 193
 			if ( $is_check_action_button ) {
194 194
 				delete_transient( self::status_transient_key );
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			// most likely a mistake.
200 200
 			} else if ( $license_data->license !== 'failed' && $update_license ) {
201 201
 
202
-				if ( ! empty( $data['field_id'] ) ) {
202
+				if ( ! empty( $data[ 'field_id' ] ) ) {
203 203
 					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
204 204
 				}
205 205
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		if ( empty( $license_data ) ) {
227 227
 			$message = '';
228 228
 		} else {
229
-			if( ! empty( $license_data->error ) ) {
229
+			if ( ! empty( $license_data->error ) ) {
230 230
 				$class = 'error';
231 231
 				$string_key = $license_data->error;
232 232
 			} else { $class = $license_data->license;
@@ -252,17 +252,17 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function license_details( $response = array() ) {
254 254
 
255
-		$response = (array) $response;
255
+		$response = (array)$response;
256 256
 
257 257
 		$return = '';
258 258
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
259 259
 
260
-		if ( ! empty( $response['license_key'] ) ) {
260
+		if ( ! empty( $response[ 'license_key' ] ) ) {
261 261
 			$return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>';
262 262
 
263 263
 			if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
264
-				$return .= $this->strings( $response['license'], $response );
265
-			} elseif ( ! empty( $response['license_name'] ) ) {
264
+				$return .= $this->strings( $response[ 'license' ], $response );
265
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
266 266
 				$response_keys = array(
267 267
 					'license_name'   => '',
268 268
 					'license_limit'  => '',
@@ -276,21 +276,21 @@  discard block
 block discarded – undo
276 276
 				// Make sure all the keys are set
277 277
 				$response = wp_parse_args( $response, $response_keys );
278 278
 
279
-				$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' ) );
280
-				$local_text    = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
281
-				$license_limit = empty( $response['license_limit'] ) ? __( 'Unlimited', 'gravityview' ) : (int) $response['license_limit'];
279
+				$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' ) );
280
+				$local_text    = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
281
+				$license_limit = empty( $response[ 'license_limit' ] ) ? __( 'Unlimited', 'gravityview' ) : (int)$response[ 'license_limit' ];
282 282
 
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( $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'] ),
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( $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.
includes/load-plugin-and-theme-hooks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
 $plugin_hooks_files = glob( $include_path . 'class-gravityview-plugin-hooks-*.php' );
22 22
 
23 23
 // Load all plugin files automatically
24
-foreach ( (array) $plugin_hooks_files as $plugin_hooks_file ) {
24
+foreach ( (array)$plugin_hooks_files as $plugin_hooks_file ) {
25 25
 	include $plugin_hooks_file;
26 26
 }
27 27
 
28 28
 $theme_hooks_files = glob( $include_path . 'class-gravityview-theme-hooks-*.php' );
29 29
 
30 30
 // Load all theme files automatically
31
-foreach ( (array) $theme_hooks_files as $theme_hooks_file ) {
31
+foreach ( (array)$theme_hooks_files as $theme_hooks_file ) {
32 32
 	include $theme_hooks_file;
33 33
 }
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-wpml.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 		add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) );
66 66
 
67
-		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') );
67
+		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) );
68 68
 	}
69 69
 
70 70
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	function filter_gravityview_back_link( $link ) {
85 85
 		global $wpml_url_filters;
86 86
 
87
-		if( $wpml_url_filters ) {
87
+		if ( $wpml_url_filters ) {
88 88
 			$link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() );
89 89
 		}
90 90
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	private function remove_url_hooks() {
102 102
 		global $wpml_url_filters;
103 103
 
104
-		if( ! $wpml_url_filters ) {
104
+		if ( ! $wpml_url_filters ) {
105 105
 			return;
106 106
 		}
107 107
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	private function add_url_hooks() {
130 130
 		global $wpml_url_filters;
131 131
 
132
-		if( ! $wpml_url_filters ) {
132
+		if ( ! $wpml_url_filters ) {
133 133
 			return;
134 134
 		}
135 135
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 					break;
227 227
 			}
228 228
 
229
-			$languages[ $lang_code ]['url'] = $entry_link;
229
+			$languages[ $lang_code ][ 'url' ] = $entry_link;
230 230
 		}
231 231
 
232 232
 		$this->add_url_hooks();
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 
135 135
 		add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 );
136 136
 
137
-		if( $this->entry_meta_key ) {
137
+		if ( $this->entry_meta_key ) {
138 138
 			add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) );
139 139
 			add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 );
140 140
 		}
141 141
 
142
-		if( $this->_custom_merge_tag ) {
142
+		if ( $this->_custom_merge_tag ) {
143 143
 			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
144 144
 			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
145 145
 		}
146 146
 
147
-		if( 'meta' === $this->group || '' !== $this->default_search_label ) {
147
+		if ( 'meta' === $this->group || '' !== $this->default_search_label ) {
148 148
 			add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 );
149 149
 		}
150 150
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		 * Auto-assign label from Gravity Forms label, if exists
153 153
 		 * @since 1.20
154 154
 		 */
155
-		if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
155
+		if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
156 156
 			$this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() );
157 157
 		}
158 158
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			'type'  => $this->name
180 180
 		);
181 181
 
182
-		$fields["{$this->entry_meta_key}"] = $added_field;
182
+		$fields[ "{$this->entry_meta_key}" ] = $added_field;
183 183
 
184 184
 		return $fields;
185 185
 	}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	function set_default_search_label( $label = '', $gf_field = null, $field = array() ) {
201 201
 
202
-		if( $this->name === $field['field'] && '' === $label ) {
202
+		if ( $this->name === $field[ 'field' ] && '' === $label ) {
203 203
 			$label = esc_html( $this->default_search_label );
204 204
 		}
205 205
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
222 222
 	 */
223
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
223
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
224 224
 
225 225
 		// Is there is field merge tag? Strip whitespace off the ned, too.
226 226
 		preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER );
@@ -253,19 +253,19 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
255 255
 
256
-		foreach( $matches as $match ) {
256
+		foreach ( $matches as $match ) {
257 257
 
258
-			$full_tag = $match[0];
258
+			$full_tag = $match[ 0 ];
259 259
 
260 260
 			// Strip the Merge Tags
261
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
261
+			$tag = str_replace( array( '{', '}' ), '', $full_tag );
262 262
 
263 263
 			// Replace the value from the entry, if exists
264
-			if( isset( $entry[ $tag ] ) ) {
264
+			if ( isset( $entry[ $tag ] ) ) {
265 265
 
266 266
 				$value = $entry[ $tag ];
267 267
 
268
-				if( is_callable( array( $this, 'get_content') ) ) {
268
+				if ( is_callable( array( $this, 'get_content' ) ) ) {
269 269
 					$value = $this->get_content( $value );
270 270
 				}
271 271
 
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
 	 */
339 339
 	public function _filter_sortable_fields( $not_sortable ) {
340 340
 
341
-		if( ! $this->is_sortable ) {
342
-			$not_sortable[] = $this->name;
341
+		if ( ! $this->is_sortable ) {
342
+			$not_sortable[ ] = $this->name;
343 343
 		}
344 344
 
345 345
 		return $not_sortable;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 */
357 357
 	function add_entry_meta( $entry_meta ) {
358 358
 
359
-		if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) {
359
+		if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) {
360 360
 
361 361
 			$added_meta = array(
362 362
 				'label'             => $this->label,
@@ -365,13 +365,13 @@  discard block
 block discarded – undo
365 365
 			);
366 366
 
367 367
 			if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) {
368
-				$added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback;
368
+				$added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback;
369 369
 			}
370 370
 
371
-			$entry_meta["{$this->entry_meta_key}"] = $added_meta;
371
+			$entry_meta[ "{$this->entry_meta_key}" ] = $added_meta;
372 372
 
373 373
 		} else {
374
-			gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' =>  $entry_meta["{$this->entry_meta_key}"] ) );
374
+			gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' =>  $entry_meta[ "{$this->entry_meta_key}" ] ) );
375 375
 		}
376 376
 
377 377
 		return $entry_meta;
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 			'date_display' => array(
401 401
 				'type' => 'text',
402 402
 				'label' => __( 'Override Date Format', 'gravityview' ),
403
-				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ),
403
+				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ),
404 404
 				/**
405 405
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
406 406
 				 * @param[in,out] null|string $date_format Date Format (default: null)
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 
427 427
 		$options = $this->field_support_options();
428 428
 
429
-		if( isset( $options[ $key ] ) ) {
429
+		if ( isset( $options[ $key ] ) ) {
430 430
 			$field_options[ $key ] = $options[ $key ];
431 431
 		}
432 432
 
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 		$connected_form = \GV\Utils::_POST( 'form_id' );
491 491
 
492 492
 		// Otherwise, get the Form ID from the Post page
493
-		if( empty( $connected_form ) ) {
493
+		if ( empty( $connected_form ) ) {
494 494
 			$connected_form = gravityview_get_form_id( get_the_ID() );
495 495
 		}
496 496
 
497
-		if( empty( $connected_form ) ) {
497
+		if ( empty( $connected_form ) ) {
498 498
 			gravityview()->log->error( 'Form not found for form ID "{form_id}"', array( 'form_id' => $connected_form ) );
499 499
 			return false;
500 500
 		}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-time.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 		add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 );
64 64
 
65
-		add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
65
+		add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
66 66
 	}
67 67
 
68 68
 	/**
@@ -103,35 +103,35 @@  discard block
 block discarded – undo
103 103
 	public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) {
104 104
 
105 105
 		// If the search is not being sorted, return early
106
-		if( empty( $criteria['sorting']['key'] ) ) {
106
+		if ( empty( $criteria[ 'sorting' ][ 'key' ] ) ) {
107 107
 			return $criteria;
108 108
 		}
109 109
 
110
-		$pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] );
110
+		$pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] );
111 111
 
112 112
 		/**
113 113
 		 * If the sort key does not match the key set in modify_sort_id(), do not modify the Gravity Forms query SQL
114 114
 		 * @see modify_sort_id()
115 115
 		 */
116
-		if( empty( $pieces[1] ) ) {
116
+		if ( empty( $pieces[ 1 ] ) ) {
117 117
 			return $criteria;
118 118
 		}
119 119
 
120 120
 		// Pass these to the _modify_query_sort_by_time_hack() method
121
-		$this->_time_format = $pieces[1];
122
-		$this->_date_format = $pieces[2];
121
+		$this->_time_format = $pieces[ 1 ];
122
+		$this->_date_format = $pieces[ 2 ];
123 123
 
124 124
 		// Remove fake input IDs (5.1 doesn't exist. Use 5)
125
-		$criteria['sorting']['key'] = floor( $pieces[0] );
125
+		$criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] );
126 126
 
127 127
 		/**
128 128
 		 * Make sure sorting is numeric (# of seconds). IMPORTANT.
129 129
 		 * @see GVCommon::is_field_numeric() is_numeric should also be set here
130 130
 		 */
131
-		$criteria['sorting']['is_numeric'] = true;
131
+		$criteria[ 'sorting' ][ 'is_numeric' ] = true;
132 132
 
133 133
 		// Modify the Gravity Forms WP Query
134
-		add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) );
134
+		add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) );
135 135
 
136 136
 		return $criteria;
137 137
 	}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 		 * then we want to modify the query.
153 153
 		 * @see GFFormsModel::sort_by_field_query()
154 154
 		 */
155
-		if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
155
+		if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
156 156
 
157
-			if( $this->_time_format === '24' ) {
157
+			if ( $this->_time_format === '24' ) {
158 158
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )";
159 159
 			} else {
160 160
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )";
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 		// Set variables
201 201
 		parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id );
202 202
 
203
-		if( 'edit' === $context ) {
203
+		if ( 'edit' === $context ) {
204 204
 			return $field_options;
205 205
 		}
206 206
 
207 207
 		/**
208 208
 		 * Set default date format based on field ID and Form ID
209 209
 		 */
210
-		add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
210
+		add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
211 211
 
212
-		$this->add_field_support('date_display', $field_options );
212
+		$this->add_field_support( 'date_display', $field_options );
213 213
 
214
-		remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
214
+		remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
215 215
 
216 216
 		return $field_options;
217 217
 	}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	private function _get_time_format() {
227 227
 		global $post;
228 228
 
229
-		$current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID );
229
+		$current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID );
230 230
 
231 231
 		return self::_get_time_format_for_field( $this->_field_id, $current_form );
232 232
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		// GF defaults to 12, so should we.
246 246
 		$time_format = '12';
247 247
 
248
-		if( $form_id ) {
248
+		if ( $form_id ) {
249 249
 			$form = GFAPI::get_form( $form_id );
250 250
 
251 251
 			if ( $form ) {
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 		$default = 'h:i A';
293 293
 
294 294
 		// This doesn't take into account 24-hour
295
-		switch( $field_input_id ) {
295
+		switch ( $field_input_id ) {
296 296
 			// Hours
297 297
 			case 1:
298 298
 				return ( $time_format === '12' ) ? 'h' : 'H';
Please login to merge, or discard this patch.
includes/admin/class.render.settings.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$is_table_layout = preg_match( '/table/ism', $template_id );
32 32
 
33
-		if( 'field' === $field_type ) {
33
+		if ( 'field' === $field_type ) {
34 34
 
35 35
 			// Default options - fields
36 36
 			$field_options = array(
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 				'custom_class' => array(
50 50
 					'type' => 'text',
51 51
 					'label' => __( 'Custom CSS Class:', 'gravityview' ),
52
-					'desc' => __( 'This class will be added to the field container', 'gravityview'),
52
+					'desc' => __( 'This class will be added to the field container', 'gravityview' ),
53 53
 					'value' => '',
54 54
 					'merge_tags' => true,
55 55
 					'tooltip' => 'gv_css_merge_tags',
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 			);
71 71
 
72 72
 			// Match Table as well as DataTables
73
-			if( $is_table_layout && 'directory' === $context ) {
74
-				$field_options['width'] = array(
73
+			if ( $is_table_layout && 'directory' === $context ) {
74
+				$field_options[ 'width' ] = array(
75 75
 					'type' => 'number',
76
-					'label' => __('Percent Width', 'gravityview'),
77
-					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'),
76
+					'label' => __( 'Percent Width', 'gravityview' ),
77
+					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ),
78 78
 					'class' => 'code widefat',
79 79
 					'value' => '',
80 80
 				);
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 			'manage_options' => __( 'Administrator', 'gravityview' ),
130 130
 		);
131 131
 
132
-		if( is_multisite() ) {
133
-			$select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' );
132
+		if ( is_multisite() ) {
133
+			$select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' );
134 134
 		}
135 135
 
136 136
 		/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 * @param  string $context     Optional. What context are we in? Example: `single` or `directory`
144 144
 		 * @param  string $input_type  Optional. (textarea, list, select, etc.)
145 145
 		 */
146
-		$select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
146
+		$select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
147 147
 
148 148
 		return $select_cap_choices;
149 149
 	}
@@ -170,27 +170,27 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) {
172 172
 
173
-		if( empty( $uniqid ) ) {
173
+		if ( empty( $uniqid ) ) {
174 174
 			//generate a unique field id
175
-			$uniqid = uniqid('', false);
175
+			$uniqid = uniqid( '', false );
176 176
 		}
177 177
 
178 178
 		// get field/widget options
179 179
 		$options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id );
180 180
 
181 181
 		// two different post arrays, depending of the field type
182
-		$name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']';
182
+		$name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']';
183 183
 
184 184
 		// build output
185 185
 		$output = '';
186
-		$output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">';
187
-		$output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">';
186
+		$output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">';
187
+		$output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">';
188 188
 		if ( $form_id ) {
189
-			$output .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">';
189
+			$output .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">';
190 190
 		}
191 191
 
192 192
 		// If there are no options, return what we got.
193
-		if(empty($options)) {
193
+		if ( empty( $options ) ) {
194 194
 
195 195
 			// This is here for checking if the output is empty in render_label()
196 196
 			$output .= '<!-- No Options -->';
@@ -198,33 +198,33 @@  discard block
 block discarded – undo
198 198
 			return $output;
199 199
 		}
200 200
 
201
-		$output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">';
201
+		$output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">';
202 202
 
203 203
 		/**
204 204
 		 * @since 1.8
205 205
 		 */
206
-		if( !empty( $item['subtitle'] ) ) {
207
-			$output .= '<div class="subtitle">' . $item['subtitle'] . '</div>';
206
+		if ( ! empty( $item[ 'subtitle' ] ) ) {
207
+			$output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>';
208 208
 		}
209 209
 
210
-		foreach( $options as $key => $option ) {
210
+		foreach ( $options as $key => $option ) {
211 211
 
212 212
 			$value = isset( $current[ $key ] ) ? $current[ $key ] : NULL;
213 213
 
214
-			$field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value);
214
+			$field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value );
215 215
 
216 216
 			// The setting is empty
217
-			if( empty( $field_output ) ) {
217
+			if ( empty( $field_output ) ) {
218 218
 				continue;
219 219
 			}
220 220
 
221
-			switch( $option['type'] ) {
221
+			switch ( $option[ 'type' ] ) {
222 222
 				// Hide hidden fields
223 223
 				case 'hidden':
224
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>';
224
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>';
225 225
 					break;
226 226
 				default:
227
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>';
227
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>';
228 228
 			}
229 229
 		}
230 230
 
@@ -253,17 +253,17 @@  discard block
 block discarded – undo
253 253
 		 * @deprecated setting index 'default' was replaced by 'value'
254 254
 		 * @see GravityView_FieldType::get_field_defaults
255 255
 		 */
256
-		if( !empty( $option['default'] ) && empty( $option['value'] ) ) {
257
-			$option['value'] = $option['default'];
258
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' );
256
+		if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) {
257
+			$option[ 'value' ] = $option[ 'default' ];
258
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' );
259 259
 		}
260 260
 
261 261
 		// prepare to render option field type
262
-		if( isset( $option['type'] ) ) {
262
+		if ( isset( $option[ 'type' ] ) ) {
263 263
 
264 264
 			$type_class = self::load_type_class( $option );
265 265
 
266
-			if( class_exists( $type_class ) ) {
266
+			if ( class_exists( $type_class ) ) {
267 267
 
268 268
 				/** @type GravityView_FieldType $render_type */
269 269
 				$render_type = new $type_class( $name, $option, $curr_value );
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 				 * @param[in,out] string $output field class name
281 281
 				 * @param[in] array $option  option field data
282 282
 				 */
283
-				$output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option );
283
+				$output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option );
284 284
 			}
285 285
 
286 286
 		} // isset option[type]
@@ -315,27 +315,27 @@  discard block
 block discarded – undo
315 315
 		 * @deprecated setting index 'name' was replaced by 'label'
316 316
 		 * @see GravityView_FieldType::get_field_defaults
317 317
 		 */
318
-		if( isset( $setting['name'] ) && empty( $setting['label'] ) ) {
319
-			$setting['label'] = $setting['name'];
320
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' );
318
+		if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) {
319
+			$setting[ 'label' ] = $setting[ 'name' ];
320
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' );
321 321
 		}
322 322
 
323 323
 		$name = esc_attr( sprintf( $name, $key ) );
324
-		$setting['id'] = esc_attr( sprintf( $id, $key ) );
325
-		$setting['tooltip'] = 'gv_' . $key;
324
+		$setting[ 'id' ] = esc_attr( sprintf( $id, $key ) );
325
+		$setting[ 'tooltip' ] = 'gv_' . $key;
326 326
 
327 327
 		// Use default if current setting isn't set.
328
-		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value'];
328
+		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ];
329 329
 
330 330
 		// default setting type = text
331
-		$setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type'];
331
+		$setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ];
332 332
 
333 333
 		// merge tags
334
-		if( !isset( $setting['merge_tags'] ) ) {
335
-			if( $setting['type'] === 'text' ) {
336
-				$setting['merge_tags'] = true;
334
+		if ( ! isset( $setting[ 'merge_tags' ] ) ) {
335
+			if ( $setting[ 'type' ] === 'text' ) {
336
+				$setting[ 'merge_tags' ] = true;
337 337
 			} else {
338
-				$setting['merge_tags'] = false;
338
+				$setting[ 'merge_tags' ] = false;
339 339
 			}
340 340
 		}
341 341
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
 		// render the setting
345 345
 		$type_class = self::load_type_class( $setting );
346
-		if( class_exists( $type_class ) ) {
346
+		if ( class_exists( $type_class ) ) {
347 347
 			/** @type GravityView_FieldType $render_type */
348 348
 			$render_type = new $type_class( $name, $setting, $curr_value );
349 349
 			ob_start();
@@ -352,25 +352,25 @@  discard block
 block discarded – undo
352 352
 		}
353 353
 
354 354
 		// Check if setting is specific for a template
355
-		if( !empty( $setting['show_in_template'] ) ) {
356
-			if( !is_array( $setting['show_in_template'] ) ) {
357
-				$setting['show_in_template'] = array( $setting['show_in_template'] );
355
+		if ( ! empty( $setting[ 'show_in_template' ] ) ) {
356
+			if ( ! is_array( $setting[ 'show_in_template' ] ) ) {
357
+				$setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] );
358 358
 			}
359
-			$show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"';
359
+			$show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"';
360 360
 		} else {
361 361
 			$show_if = '';
362 362
 		}
363 363
 
364
-		if( ! empty( $setting['requires'] ) ) {
365
-			$show_if .= sprintf( ' data-requires="%s"', $setting['requires'] );
364
+		if ( ! empty( $setting[ 'requires' ] ) ) {
365
+			$show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] );
366 366
 		}
367 367
 
368
-		if( ! empty( $setting['requires_not'] ) ) {
369
-			$show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] );
368
+		if ( ! empty( $setting[ 'requires_not' ] ) ) {
369
+			$show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] );
370 370
 		}
371 371
 
372 372
 		// output
373
-		echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>';
373
+		echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>';
374 374
 
375 375
 	}
376 376
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public static function load_type_class( $field = NULL ) {
384 384
 
385
-		if( empty( $field['type'] ) ) {
385
+		if ( empty( $field[ 'type' ] ) ) {
386 386
 			return NULL;
387 387
 		}
388 388
 
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
 		 * @param string $class_suffix  field class suffix; `GravityView_FieldType_{$class_suffix}`
392 392
 		 * @param array $field   field data
393 393
 		 */
394
-		$type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field );
394
+		$type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field );
395 395
 
396
-		if( class_exists( $type_class ) ) {
396
+		if ( class_exists( $type_class ) ) {
397 397
 			return $type_class;
398 398
 		}
399 399
 
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 		 * @param string  $field_type_include_path field class file path
403 403
 		 * @param array $field  field data
404 404
 		 */
405
-		$class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field );
405
+		$class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field );
406 406
 
407
-		if( $class_file && file_exists( $class_file ) ) {
407
+		if ( $class_file && file_exists( $class_file ) ) {
408 408
 			require_once( $class_file );
409 409
 		}
410 410
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 
427 427
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' );
428 428
 
429
-		$output  = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">';
430
-		$output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >';
429
+		$output  = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">';
430
+		$output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >';
431 431
 
432 432
 		return $output;
433 433
 	}
@@ -447,22 +447,22 @@  discard block
 block discarded – undo
447 447
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' );
448 448
 
449 449
 		// Show the merge tags if the field is a list view
450
-		$is_list = ( preg_match( '/_list-/ism', $name ));
450
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
451 451
 
452 452
 		// Or is a single entry view
453
-		$is_single = ( preg_match( '/single_/ism', $name ));
453
+		$is_single = ( preg_match( '/single_/ism', $name ) );
454 454
 		$show = ( $is_single || $is_list );
455 455
 
456 456
 		$class = '';
457 457
 		// and $add_merge_tags is not false
458
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
458
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
459 459
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
460 460
 		}
461 461
 
462
-		$class .= !empty( $args['class'] ) ? $args['class'] : 'widefat';
463
-		$type = !empty( $args['type'] ) ? $args['type'] : 'text';
462
+		$class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat';
463
+		$type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text';
464 464
 
465
-		return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">';
465
+		return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">';
466 466
 	}
467 467
 
468 468
 	/**
@@ -479,21 +479,21 @@  discard block
 block discarded – undo
479 479
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' );
480 480
 
481 481
 		// Show the merge tags if the field is a list view
482
-		$is_list = ( preg_match( '/_list-/ism', $name ));
482
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
483 483
 
484 484
 		// Or is a single entry view
485
-		$is_single = ( preg_match( '/single_/ism', $name ));
485
+		$is_single = ( preg_match( '/single_/ism', $name ) );
486 486
 		$show = ( $is_single || $is_list );
487 487
 
488 488
 		$class = '';
489 489
 		// and $add_merge_tags is not false
490
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
490
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
491 491
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
492 492
 		}
493 493
 
494
-		$class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat';
494
+		$class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat';
495 495
 
496
-		return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>';
496
+		return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>';
497 497
 	}
498 498
 
499 499
 	/**
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 
510 510
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' );
511 511
 
512
-		$output = '<select name="'. $name .'" id="'. $id .'">';
513
-		foreach( $choices as $value => $label ) {
514
-			$output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>';
512
+		$output = '<select name="' . $name . '" id="' . $id . '">';
513
+		foreach ( $choices as $value => $label ) {
514
+			$output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>';
515 515
 		}
516 516
 		$output .= '</select>';
517 517
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-total.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total.
52 52
 	 */
53
-	public function add_to_blacklist( $blacklist = array(), $context = NULL  ){
53
+	public function add_to_blacklist( $blacklist = array(), $context = NULL ) {
54 54
 
55
-		if( empty( $context ) || $context !== 'edit' ) {
55
+		if ( empty( $context ) || $context !== 'edit' ) {
56 56
 			return $blacklist;
57 57
 		}
58 58
 
59
-		$blacklist[] = 'total';
59
+		$blacklist[ ] = 'total';
60 60
 
61 61
 		return $blacklist;
62 62
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	function edit_entry_recalculate_totals( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) {
76 76
 
77
-		$original_form = GFAPI::get_form( $form['id'] );
77
+		$original_form = GFAPI::get_form( $form[ 'id' ] );
78 78
 
79 79
 		$total_fields = GFCommon::get_fields_by_type( $original_form, 'total' );
80 80
 
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 
86 86
 			/** @type GF_Field_Total $total_field */
87 87
 			foreach ( $total_fields as $total_field ) {
88
-				$entry["{$total_field->id}"] = GFCommon::get_order_total( $original_form, $entry );
88
+				$entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $original_form, $entry );
89 89
 			}
90 90
 
91 91
 			$return_entry = GFAPI::update_entry( $entry );
92 92
 
93
-			if( is_wp_error( $return_entry ) ) {
93
+			if ( is_wp_error( $return_entry ) ) {
94 94
 				gravityview()->log->error( 'Updating the entry total fields failed', array( 'data' => $return_entry ) );
95 95
 			} else {
96 96
 				gravityview()->log->debug( 'Updating the entry total fields succeeded' );
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-address.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 				continue;
63 63
 			}
64 64
 
65
-			$field_id = intval( floor( $search_field['key'] ) );
66
-			$input_id = gravityview_get_input_id_from_id( $search_field['key'] );
65
+			$field_id = intval( floor( $search_field[ 'key' ] ) );
66
+			$input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] );
67 67
 			$form = GravityView_View::getInstance()->getForm();
68 68
 
69 69
 			/** @type GF_Field_Address $address_field */
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			$choices = array();
73 73
 
74 74
 			$method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id );
75
-			if( method_exists( $this, $method_name ) ) {
75
+			if ( method_exists( $this, $method_name ) ) {
76 76
 				/**
77 77
 				 * @uses GravityView_Field_Address::get_choices_country()
78 78
 				 * @uses GravityView_Field_Address::get_choices_state()
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 				$choices = $this->{$method_name}( $address_field, $form );
81 81
 			}
82 82
 
83
-			if( ! empty( $choices ) ) {
84
-				$search_field['choices'] = $choices;
85
-				$search_field['type'] = \GV\Utils::get( $search_field, 'input');
83
+			if ( ! empty( $choices ) ) {
84
+				$search_field[ 'choices' ] = $choices;
85
+				$search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' );
86 86
 			} else {
87
-				$search_field['type'] = 'text';
88
-				$search_field['input'] = 'input_text';
87
+				$search_field[ 'type' ] = 'text';
88
+				$search_field[ 'input' ] = 'input_text';
89 89
 			}
90 90
 		}
91 91
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		$country_choices = array();
111 111
 
112 112
 		foreach ( $countries as $key => $country ) {
113
-			$country_choices[] = array(
113
+			$country_choices[ ] = array(
114 114
 				'value' => $country,
115 115
 				'text' => $country,
116 116
 			);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	private function get_choices_state( $address_field, $form ) {
137 137
 
138
-		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType;
138
+		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType;
139 139
 
140 140
 		$state_choices = array();
141 141
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 				$states = GFCommon::get_canadian_provinces();
148 148
 				break;
149 149
 			default:
150
-				$address_types = $address_field->get_address_types( $form['id'] );
151
-				$states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states'];
150
+				$address_types = $address_field->get_address_types( $form[ 'id' ] );
151
+				$states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ];
152 152
 				break;
153 153
 		}
154 154
 
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 				$state_subchoices = array();
158 158
 
159 159
 				foreach ( $state as $key => $substate ) {
160
-					$state_subchoices[] = array(
160
+					$state_subchoices[ ] = array(
161 161
 						'value' => is_numeric( $key ) ? $substate : $key,
162 162
 						'text' => $substate,
163 163
 					);
164 164
 				}
165 165
 
166
-				$state_choices[] = array(
166
+				$state_choices[ ] = array(
167 167
 					'text' => $key,
168 168
 					'value' => $state_subchoices,
169 169
 				);
170 170
 
171 171
 			} else {
172
-				$state_choices[] = array(
172
+				$state_choices[ ] = array(
173 173
 					'value' => is_numeric( $key ) ? $state : $key,
174 174
 					'text' => $state,
175 175
 				);
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 		// Use the same inputs as the "text" input type allows
194 194
 		$text_inputs = \GV\Utils::get( $input_types, 'text' );
195 195
 
196
-		$input_types['street'] = $text_inputs;
197
-		$input_types['street2'] = $text_inputs;
198
-		$input_types['city'] = $text_inputs;
196
+		$input_types[ 'street' ] = $text_inputs;
197
+		$input_types[ 'street2' ] = $text_inputs;
198
+		$input_types[ 'city' ] = $text_inputs;
199 199
 
200
-		$input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs;
201
-		$input_types['zip'] = array( 'input_text' );
202
-		$input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs;
200
+		$input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
201
+		$input_types[ 'zip' ] = array( 'input_text' );
202
+		$input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
203 203
 
204 204
 		return $input_types;
205 205
 	}
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
 		// Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)?
221 221
 		$input_id = gravityview_get_input_id_from_id( $field_id );
222 222
 
223
-		if( 'address' !== $field_type && $input_id ) {
223
+		if ( 'address' !== $field_type && $input_id ) {
224 224
 			return $input_type;
225 225
 		}
226 226
 
227 227
 		// If the input ID matches an expected address input, set to that. Otherwise, keep existing input type.
228
-		if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
228
+		if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
229 229
 			$input_type = $address_field_name;
230 230
 		}
231 231
 
@@ -273,20 +273,20 @@  discard block
 block discarded – undo
273 273
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
274 274
 
275 275
 		// If this is NOT the full address field, return default options.
276
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
276
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
277 277
 			return $field_options;
278 278
 		}
279 279
 
280
-		if( 'edit' === $context ) {
280
+		if ( 'edit' === $context ) {
281 281
 			return $field_options;
282 282
 		}
283 283
 
284 284
 		$add_options = array();
285 285
 
286
-		$add_options['show_map_link'] = array(
286
+		$add_options[ 'show_map_link' ] = array(
287 287
 			'type' => 'checkbox',
288 288
 			'label' => __( 'Show Map Link:', 'gravityview' ),
289
-			'desc' => __('Display a "Map It" link below the address', 'gravityview'),
289
+			'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ),
290 290
 			'value' => true,
291 291
 			'merge_tags' => false,
292 292
 		);
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-hidden.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	function edit_entry_fix_hidden_fields( $fields ) {
50 50
 
51 51
 		/** @type GF_Field $field */
52
-		foreach( $fields as &$field ) {
52
+		foreach ( $fields as &$field ) {
53 53
 
54 54
 			if ( 'hidden' === $field->type ) {
55 55
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				 */
63 63
 				$reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', false, $field );
64 64
 
65
-				if( ! $reveal_hidden_field ) {
65
+				if ( ! $reveal_hidden_field ) {
66 66
 					continue;
67 67
 				}
68 68
 
Please login to merge, or discard this patch.