Completed
Push — develop ( 9832a5...da647e )
by Zack
19:37
created
includes/admin/class-gravityview-support-port.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function maybe_add_article_to_tooltip( $tooltip = '', $article = array(), $url = '', $atts = '', $css_class = '', $anchor_text = '' ) {
55 55
 
56
-		if ( empty( $article['id'] ) ) {
56
+		if ( empty( $article[ 'id' ] ) ) {
57 57
 			return $tooltip;
58 58
 		}
59 59
 
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 
70 70
 		$css_class .= ' gv_tooltip';
71 71
 
72
-		if ( ! empty( $article['type'] ) ) {
73
-			$atts = sprintf( 'data-beacon-article-%s="%s"', $article['type'], $article['id'] );
72
+		if ( ! empty( $article[ 'type' ] ) ) {
73
+			$atts = sprintf( 'data-beacon-article-%s="%s"', $article[ 'type' ], $article[ 'id' ] );
74 74
 		} else {
75
-			$atts = sprintf( 'data-beacon-article="%s"', $article['id'] );
75
+			$atts = sprintf( 'data-beacon-article="%s"', $article[ 'id' ] );
76 76
 		}
77 77
 
78 78
 		$url = \GV\Utils::get( $article, 'url', '#' );
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 		) );
173 173
 
174 174
 		// This is just HTML we don't need.
175
-		unset( $response['message'] );
175
+		unset( $response[ 'message' ] );
176 176
 
177
-		switch ( intval( $response['price_id'] ) ) {
177
+		switch ( intval( $response[ 'price_id' ] ) ) {
178 178
 			default:
179 179
 			case 1:
180 180
 				$package = 'Core';
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 			'signature'             => hash_hmac( 'sha256', $current_user->user_email, self::beacon_key ),
203 203
 			'affiliate_id'			=> gravityview()->plugin->settings->get( 'affiliate_id' ),
204 204
 			'is_super_admin'		=> is_super_admin(),
205
-			'License Key'           => $response['license_key'] . ' (' . ucwords( $response['license'] ) . ')',
205
+			'License Key'           => $response[ 'license_key' ] . ' (' . ucwords( $response[ 'license' ] ) . ')',
206 206
 			'License Level'         => $package,
207 207
 			'Alt Emails'            => sprintf( "Admin: %s, GV Support: %s", get_bloginfo( 'admin_email' ), gravityview()->plugin->settings->get( 'support-email' ) ),
208
-			'Payment Details'       => $response['customer_name'] . ' ' . $response['customer_email'],
208
+			'Payment Details'       => $response[ 'customer_name' ] . ' ' . $response[ 'customer_email' ],
209 209
 			'WordPress Version'     => get_bloginfo( 'version', 'display' ),
210
-			'PHP Version'           => phpversion() . ' on ' . esc_html( $_SERVER['SERVER_SOFTWARE'] ),
210
+			'PHP Version'           => phpversion() . ' on ' . esc_html( $_SERVER[ 'SERVER_SOFTWARE' ] ),
211 211
 			'No-Conflict Mode'      => empty( $no_conflict_mode ) ? 'Disabled' : 'Enabled',
212 212
 			'GravityView Version'   => \GV\Plugin::$version,
213 213
 			'Gravity Forms Version' => GFForms::$version,
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		ob_get_clean();
218 218
 
219 219
 		// Help Scout length limit is 200 characters
220
-		foreach( $data as $key => $value ) {
220
+		foreach ( $data as $key => $value ) {
221 221
 			if ( ! is_string( $value ) ) {
222 222
                 continue;
223 223
 			}
Please login to merge, or discard this patch.
future/includes/class-gv-license-handler.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		);
103 103
 
104 104
 		if ( ! empty( $action ) ) {
105
-			$settings['edd_action'] = esc_attr( $action );
105
+			$settings[ 'edd_action' ] = esc_attr( $action );
106 106
 		}
107 107
 
108 108
 		return array_map( 'urlencode', $settings );
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			'format' => 'json',
159 159
 		) );
160 160
 
161
-		if ( $is_ajax && empty( $data['license'] ) ) {
161
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
162 162
 			die( -1 );
163 163
 		}
164 164
 
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 
187 187
 			$json = json_encode( $license_data );
188 188
 
189
-			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action');
189
+			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' );
190 190
 
191 191
 			$is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX );
192 192
 
193
-			do_action('gravityview/admin_installer/delete_downloads_data', true );
193
+			do_action( 'gravityview/admin_installer/delete_downloads_data', true );
194 194
 
195 195
 			if ( $is_check_action_button ) {
196 196
 				delete_transient( self::status_transient_key );
@@ -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
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			$class   = 'hide';
230 230
 			$message = '';
231 231
 		} else {
232
-			if( ! empty( $license_data->error ) ) {
232
+			if ( ! empty( $license_data->error ) ) {
233 233
 				$class = 'error';
234 234
 				$string_key = $license_data->error;
235 235
 			} else { $class = $license_data->license;
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	public function license_details( $response = array() ) {
255 255
 
256
-		$response = (array) $response;
256
+		$response = (array)$response;
257 257
 
258 258
 		$return  = '';
259 259
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
260 260
 
261
-		if ( ! empty( $response['license_key'] ) ) {
261
+		if ( ! empty( $response[ 'license_key' ] ) ) {
262 262
 			$return .= '<h3>' . rtrim( esc_html__( 'License Details:', 'gravityview' ), ':' ) . '</h3>';
263 263
 
264 264
 			if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
 					return sprintf( $wrapper, '' ); // Do not show redundant information - invalid/deactivated notice will be displayed by generate_license_box()
267 267
 				}
268 268
 
269
-				$return .= $this->strings( $response['license'], $response );
270
-			} elseif ( ! empty( $response['license_name'] ) ) {
269
+				$return .= $this->strings( $response[ 'license' ], $response );
270
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
271 271
 				$response_keys = array(
272 272
 					'license_name'   => '',
273 273
 					'license_limit'  => '',
@@ -282,22 +282,22 @@  discard block
 block discarded – undo
282 282
 				$response = wp_parse_args( $response, $response_keys );
283 283
 
284 284
 				$login_link_class = gravityview()->plugin->is_GF_25() ? 'button button-outline outline' : 'text-link';
285
-				$renews_on = ( 'lifetime' === $response['expires'] ) ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) );
286
-				$login_link       = sprintf( '<a href="%s" class="gv-access-account ' . $login_link_class . '" 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' ) );
287
-				$local_text       = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
288
-				$license_limit    = empty( $response['license_limit'] ) ? __( 'Unlimited', 'gravityview' ) : (int) $response['license_limit'];
285
+				$renews_on = ( 'lifetime' === $response[ 'expires' ] ) ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) );
286
+				$login_link       = sprintf( '<a href="%s" class="gv-access-account ' . $login_link_class . '" 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' ) );
287
+				$local_text       = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
288
+				$license_limit    = empty( $response[ 'license_limit' ] ) ? __( 'Unlimited', 'gravityview' ) : (int)$response[ 'license_limit' ];
289 289
 
290 290
 
291 291
 				$details = array(
292
-					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), '<span class="gv-license-detail">' . esc_html( $response['license_name'] ) . '</span>' ),
293
-					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), '<span class="gv-license-detail">' . esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . '</span>' . $renews_on . $login_link,
294
-					'activations' => sprintf( str_replace( '%d', '%s', esc_html__( 'Activations: %d of %s sites', 'gravityview' ) ), '<span class="gv-license-detail">' . intval( $response['site_count'] ), esc_html( $license_limit ) ) . '</span>' . $local_text,
295
-					'upgrade'     => $this->get_upgrade_html( $response['upgrades'] ),
292
+					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), '<span class="gv-license-detail">' . esc_html( $response[ 'license_name' ] ) . '</span>' ),
293
+					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), '<span class="gv-license-detail">' . esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . '</span>' . $renews_on . $login_link,
294
+					'activations' => sprintf( str_replace( '%d', '%s', esc_html__( 'Activations: %d of %s sites', 'gravityview' ) ), '<span class="gv-license-detail">' . intval( $response[ 'site_count' ] ), esc_html( $license_limit ) ) . '</span>' . $local_text,
295
+					'upgrade'     => $this->get_upgrade_html( $response[ 'upgrades' ] ),
296 296
 				);
297 297
 
298
-				if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) {
299
-					unset( $details['upgrade'] );
300
-					$details['licensed_to'] .= '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
298
+				if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) {
299
+					unset( $details[ 'upgrade' ] );
300
+					$details[ 'licensed_to' ] .= '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
301 301
 				}
302 302
 
303 303
 				$return .= '<ul>';
@@ -329,20 +329,20 @@  discard block
 block discarded – undo
329 329
 		if ( ! empty( $upgrades ) ) {
330 330
 
331 331
 			$locale_parts = explode( '_', get_locale() );
332
-			$is_english = ( 'en' === $locale_parts[0] );
332
+			$is_english = ( 'en' === $locale_parts[ 0 ] );
333 333
 
334 334
 			$output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>';
335 335
 			$output .= '<ul>';
336 336
 
337 337
 			foreach ( $upgrades as $upgrade_id => $upgrade ) {
338
-				$upgrade = (object) $upgrade;
338
+				$upgrade = (object)$upgrade;
339 339
 
340 340
 				$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 ) );
341 341
 
342 342
 				if ( $is_english && isset( $upgrade->description ) ) {
343 343
 					$message = esc_html( $upgrade->description );
344 344
 				} else {
345
-					switch( $upgrade->price_id ) {
345
+					switch ( $upgrade->price_id ) {
346 346
 						// Interstellar
347 347
 						case 1:
348 348
 						default:
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 			'invalid_item_id' => esc_html__( 'This license key does not have access to this plugin.', 'gravityview' ),
422 422
 			'missing' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), // Missing is "the license couldn't be found", not "you submitted an empty license"
423 423
 			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
424
-			'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>' ),
424
+			'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>' ),
425 425
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
426 426
 			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
427 427
 			'activate_license' => esc_html__( 'Activate License', 'gravityview' ),
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 
450 450
 		if ( ! empty( $license_data->renewal_url ) ) {
451 451
 			$renew_license_url = $license_data->renewal_url;
452
-		} elseif( ! empty( $license_data->license_key ) ) {
452
+		} elseif ( ! empty( $license_data->license_key ) ) {
453 453
 			$renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key );
454 454
 		} else {
455 455
 			$renew_license_url = 'https://gravityview.co/account/';
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 * @return array|\WP_Error
467 467
 	 */
468 468
 	private function _license_get_remote_response( $data, $license = '' ) {
469
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
469
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
470 470
 
471 471
 		$url = add_query_arg( $api_params, self::url );
472 472
 
@@ -506,9 +506,9 @@  discard block
 block discarded – undo
506 506
 	private function license_call_update_settings( $license_data, $data ) {
507 507
 		$settings = array();
508 508
 
509
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
510
-		$settings['license_key_status'] = $license_data->license;
511
-		$settings['license_key_response'] = (array)$license_data;
509
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
510
+		$settings[ 'license_key_status' ] = $license_data->license;
511
+		$settings[ 'license_key_response' ] = (array)$license_data;
512 512
 
513 513
 		$this->settings->set( $settings );
514 514
 	}
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
 		$status = trim( $this->settings->get( 'license_key_status' ) );
529 529
 		$key = trim( $this->settings->get( 'license_key' ) );
530 530
 
531
-		if (  !empty( $key ) ) {
531
+		if ( ! empty( $key ) ) {
532 532
 			$response = $this->settings->get( 'license_key_response' );
533
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
533
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
534 534
 		} else {
535 535
 			$response = array();
536 536
 		}
@@ -573,11 +573,11 @@  discard block
 block discarded – undo
573 573
 
574 574
 		$submit = '<div class="gv-edd-button-wrapper">';
575 575
 		foreach ( $fields as $field ) {
576
-			$field['type'] = 'button';
577
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
578
-			$field['style'] = 'margin-left: 10px;';
579
-			if( $disabled_attribute ) {
580
-				$field['disabled'] = $disabled_attribute;
576
+			$field[ 'type' ] = 'button';
577
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
578
+			$field[ 'style' ] = 'margin-left: 10px;';
579
+			if ( $disabled_attribute ) {
580
+				$field[ 'disabled' ] = $disabled_attribute;
581 581
 			}
582 582
 			$submit .= $this->settings->as_html( $field, $echo );
583 583
 		}
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 				    'url'        => home_url(),
657 657
 				    'site_data'  => $this->get_site_data(),
658 658
 			    ),
659
-			));
659
+			) );
660 660
 
661 661
 			// make sure the response came back okay
662 662
 			if ( is_wp_error( $response ) ) {
@@ -686,45 +686,45 @@  discard block
 block discarded – undo
686 686
 		$theme_data = wp_get_theme();
687 687
 		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
688 688
 
689
-		$data['gv_version']  = Plugin::$version;
690
-		$data['php_version']  = phpversion();
691
-		$data['wp_version']   = get_bloginfo( 'version' );
692
-		$data['gf_version']  = \GFForms::$version;
693
-		$data['server']       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
694
-		$data['multisite']    = is_multisite();
695
-		$data['theme']        = $theme;
696
-		$data['url']          = home_url();
697
-		$data['license_key']  = $this->settings->get( 'license_key' );
698
-		$data['beta']         = $this->settings->get( 'beta' );
689
+		$data[ 'gv_version' ]  = Plugin::$version;
690
+		$data[ 'php_version' ]  = phpversion();
691
+		$data[ 'wp_version' ]   = get_bloginfo( 'version' );
692
+		$data[ 'gf_version' ]  = \GFForms::$version;
693
+		$data[ 'server' ]       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
694
+		$data[ 'multisite' ]    = is_multisite();
695
+		$data[ 'theme' ]        = $theme;
696
+		$data[ 'url' ]          = home_url();
697
+		$data[ 'license_key' ]  = $this->settings->get( 'license_key' );
698
+		$data[ 'beta' ]         = $this->settings->get( 'beta' );
699 699
 
700 700
 		// View Data
701 701
 		$gravityview_posts = wp_count_posts( 'gravityview', 'readable' );
702 702
 
703
-		$data['view_count'] = null;
704
-		$data['view_first'] = null;
705
-		$data['view_latest'] = null;
703
+		$data[ 'view_count' ] = null;
704
+		$data[ 'view_first' ] = null;
705
+		$data[ 'view_latest' ] = null;
706 706
 
707 707
 		if ( $gravityview_posts->publish ) {
708
-			$data['view_count'] = $gravityview_posts->publish;
708
+			$data[ 'view_count' ] = $gravityview_posts->publish;
709 709
 
710 710
 			$first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' );
711 711
 			$latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' );
712 712
 
713 713
 			if ( $first = array_shift( $first ) ) {
714
-				$data['view_first'] = $first->post_date;
714
+				$data[ 'view_first' ] = $first->post_date;
715 715
 			}
716 716
 			if ( $latest = array_pop( $latest ) ) {
717
-				$data['view_latest'] = $latest->post_date;
717
+				$data[ 'view_latest' ] = $latest->post_date;
718 718
 			}
719 719
 		}
720 720
 
721 721
 		// Form counts
722 722
 		if ( class_exists( 'GFFormsModel' ) ) {
723 723
 			$form_data = \GFFormsModel::get_form_count();
724
-			$data['forms_total'] = Utils::get( $form_data, 'total', 0 );
725
-			$data['forms_active'] = Utils::get( $form_data, 'active', 0 );
726
-			$data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 );
727
-			$data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 );
724
+			$data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 );
725
+			$data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 );
726
+			$data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 );
727
+			$data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 );
728 728
 		}
729 729
 
730 730
 		// Retrieve current plugin information
@@ -732,13 +732,13 @@  discard block
 block discarded – undo
732 732
 			include ABSPATH . '/wp-admin/includes/plugin.php';
733 733
 		}
734 734
 
735
-		$data['integrations']     = self::get_related_plugins_and_extensions();
736
-		$data['active_plugins']   = get_option( 'active_plugins', array() );
737
-		$data['inactive_plugins'] = array();
738
-		$data['locale']           = get_locale();
735
+		$data[ 'integrations' ]     = self::get_related_plugins_and_extensions();
736
+		$data[ 'active_plugins' ]   = get_option( 'active_plugins', array() );
737
+		$data[ 'inactive_plugins' ] = array();
738
+		$data[ 'locale' ]           = get_locale();
739 739
 
740 740
 		// Validate request on the GV server
741
-		$data['hash']             = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] );
741
+		$data[ 'hash' ]             = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] );
742 742
 
743 743
 		return $data;
744 744
 	}
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 
769 769
 				$plugin_data = get_plugin_data( $active_plugin );
770 770
 
771
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
771
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
772 772
 			}
773 773
 
774 774
 			if ( ! empty( $extensions ) ) {
Please login to merge, or discard this patch.