Completed
Pull Request — develop (#1491)
by Zack
07:40
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.