Completed
Push — develop ( c20624...b2ad9c )
by Zack
15:34
created
future/includes/class-gv-license-handler.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		);
107 107
 
108 108
 		if ( ! empty( $action ) ) {
109
-			$settings['edd_action'] = esc_attr( $action );
109
+			$settings[ 'edd_action' ] = esc_attr( $action );
110 110
 		}
111 111
 
112 112
 		return array_map( 'urlencode', $settings );
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		}
127 127
 
128 128
 		// If doing ajax, get outta here.
129
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
129
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) {
130 130
 			return;
131 131
 		}
132 132
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 			'format' => 'json',
174 174
 		) );
175 175
 
176
-		if ( $is_ajax && empty( $data['license'] ) ) {
176
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
177 177
 			die( -1 );
178 178
 		}
179 179
 
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 
202 202
 			$json = json_encode( $license_data );
203 203
 
204
-			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action');
204
+			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' );
205 205
 
206 206
 			$is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX );
207 207
 
208
-			do_action('gravityview/admin_installer/delete_downloads_data', true );
208
+			do_action( 'gravityview/admin_installer/delete_downloads_data', true );
209 209
 
210 210
 			if ( $is_check_action_button ) {
211 211
 				delete_transient( self::status_transient_key );
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 			// most likely a mistake.
217 217
 			} else if ( $license_data->license !== 'failed' && $update_license ) {
218 218
 
219
-				if ( ! empty( $data['field_id'] ) ) {
219
+				if ( ! empty( $data[ 'field_id' ] ) ) {
220 220
 					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
221 221
 				}
222 222
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			$class   = 'hide';
245 245
 			$message = '';
246 246
 		} else {
247
-			if( ! empty( $license_data->error ) ) {
247
+			if ( ! empty( $license_data->error ) ) {
248 248
 				$class = 'error';
249 249
 				$string_key = $license_data->error;
250 250
 			} else { $class = $license_data->license;
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	public function license_details( $response = array() ) {
270 270
 
271
-		$response = (array) $response;
271
+		$response = (array)$response;
272 272
 
273 273
 		$return  = '';
274 274
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
275 275
 
276
-		if ( ! empty( $response['license_key'] ) ) {
276
+		if ( ! empty( $response[ 'license_key' ] ) ) {
277 277
 			$return .= '<h3>' . rtrim( esc_html__( 'License Details:', 'gravityview' ), ':' ) . '</h3>';
278 278
 
279 279
 			if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 				}
283 283
 
284 284
 
285
-				$return .= $this->strings( $response['license'], $response );
286
-			} elseif ( ! empty( $response['license_name'] ) ) {
285
+				$return .= $this->strings( $response[ 'license' ], $response );
286
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
287 287
 				$response_keys = array(
288 288
 					'license_name'   => '',
289 289
 					'license_limit'  => '',
@@ -298,22 +298,22 @@  discard block
 block discarded – undo
298 298
 				$response = wp_parse_args( $response, $response_keys );
299 299
 
300 300
 				$login_link_class = gravityview()->plugin->is_GF_25() ? 'button button-outline outline' : 'text-link';
301
-				$renews_on = ( 'lifetime' === $response['expires'] ) ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) );
302
-				$login_link       = sprintf( '<a href="%s" class="gv-access-account ' . $login_link_class . '" rel="external">%s</a>', esc_url( sprintf( 'https://www.gravitykit.com/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
303
-				$local_text       = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
304
-				$license_limit    = empty( $response['license_limit'] ) ? __( 'Unlimited', 'gravityview' ) : (int) $response['license_limit'];
301
+				$renews_on = ( 'lifetime' === $response[ 'expires' ] ) ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) );
302
+				$login_link       = sprintf( '<a href="%s" class="gv-access-account ' . $login_link_class . '" rel="external">%s</a>', esc_url( sprintf( 'https://www.gravitykit.com/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
303
+				$local_text       = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
304
+				$license_limit    = empty( $response[ 'license_limit' ] ) ? __( 'Unlimited', 'gravityview' ) : (int)$response[ 'license_limit' ];
305 305
 
306 306
 
307 307
 				$details = array(
308
-					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), '<span class="gv-license-detail">' . esc_html( $response['license_name'] ) . '</span>' ),
309
-					'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,
310
-					'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,
311
-					'upgrade'     => $this->get_upgrade_html( $response['upgrades'] ),
308
+					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), '<span class="gv-license-detail">' . esc_html( $response[ 'license_name' ] ) . '</span>' ),
309
+					'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,
310
+					'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,
311
+					'upgrade'     => $this->get_upgrade_html( $response[ 'upgrades' ] ),
312 312
 				);
313 313
 
314
-				if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) {
315
-					unset( $details['upgrade'] );
316
-					$details['licensed_to'] .= '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
314
+				if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) {
315
+					unset( $details[ 'upgrade' ] );
316
+					$details[ 'licensed_to' ] .= '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
317 317
 				}
318 318
 
319 319
 				$return .= '<ul>';
@@ -345,20 +345,20 @@  discard block
 block discarded – undo
345 345
 		if ( ! empty( $upgrades ) ) {
346 346
 
347 347
 			$locale_parts = explode( '_', get_locale() );
348
-			$is_english = ( 'en' === $locale_parts[0] );
348
+			$is_english = ( 'en' === $locale_parts[ 0 ] );
349 349
 
350 350
 			$output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>';
351 351
 			$output .= '<ul>';
352 352
 
353 353
 			foreach ( $upgrades as $upgrade_id => $upgrade ) {
354
-				$upgrade = (object) $upgrade;
354
+				$upgrade = (object)$upgrade;
355 355
 
356 356
 				$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 ) );
357 357
 
358 358
 				if ( $is_english && isset( $upgrade->description ) ) {
359 359
 					$message = esc_html( $upgrade->description );
360 360
 				} else {
361
-					switch( $upgrade->price_id ) {
361
+					switch ( $upgrade->price_id ) {
362 362
 						// Interstellar
363 363
 						case 1:
364 364
 						default:
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 			'invalid_item_id' => esc_html__( 'This license key does not have access to this plugin.', 'gravityview' ),
438 438
 			'missing' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), // Missing is "the license couldn't be found", not "you submitted an empty license"
439 439
 			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
440
-			'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>' ),
440
+			'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>' ),
441 441
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
442 442
 			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
443 443
 			'activate_license' => esc_html__( 'Activate License', 'gravityview' ),
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
 		if ( ! empty( $license_data->renewal_url ) ) {
467 467
 			$renew_license_url = $license_data->renewal_url;
468
-		} elseif( ! empty( $license_data->license_key ) ) {
468
+		} elseif ( ! empty( $license_data->license_key ) ) {
469 469
 			$renew_license_url = sprintf( 'https://www.gravitykit.com/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key );
470 470
 		} else {
471 471
 			$renew_license_url = 'https://www.gravitykit.com/account/';
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	 * @return array|\WP_Error
483 483
 	 */
484 484
 	private function _license_get_remote_response( $data, $license = '' ) {
485
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
485
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
486 486
 
487 487
 		$url = add_query_arg( $api_params, self::url );
488 488
 
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 	private function license_call_update_settings( $license_data, $data ) {
523 523
 		$settings = array();
524 524
 
525
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
526
-		$settings['license_key_status'] = $license_data->license;
527
-		$settings['license_key_response'] = (array)$license_data;
525
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
526
+		$settings[ 'license_key_status' ] = $license_data->license;
527
+		$settings[ 'license_key_response' ] = (array)$license_data;
528 528
 
529 529
 		$this->settings->set( $settings );
530 530
 	}
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
 		$status = trim( $this->settings->get( 'license_key_status' ) );
545 545
 		$key = trim( $this->settings->get( 'license_key' ) );
546 546
 
547
-		if (  !empty( $key ) ) {
547
+		if ( ! empty( $key ) ) {
548 548
 			$response = $this->settings->get( 'license_key_response' );
549
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
549
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
550 550
 		} else {
551 551
 			$response = array();
552 552
 		}
@@ -589,11 +589,11 @@  discard block
 block discarded – undo
589 589
 
590 590
 		$submit = '<div class="gv-edd-button-wrapper">';
591 591
 		foreach ( $fields as $field ) {
592
-			$field['type'] = 'button';
593
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
594
-			$field['style'] = 'margin-left: 10px;';
595
-			if( $disabled_attribute ) {
596
-				$field['disabled'] = $disabled_attribute;
592
+			$field[ 'type' ] = 'button';
593
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
594
+			$field[ 'style' ] = 'margin-left: 10px;';
595
+			if ( $disabled_attribute ) {
596
+				$field[ 'disabled' ] = $disabled_attribute;
597 597
 			}
598 598
 			$submit .= $this->settings->as_html( $field, $echo );
599 599
 		}
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 				    'url'        => home_url(),
672 672
 				    'site_data'  => $this->get_site_data(),
673 673
 			    ),
674
-			));
674
+			) );
675 675
 
676 676
 			// make sure the response came back okay
677 677
 			if ( is_wp_error( $response ) ) {
@@ -701,45 +701,45 @@  discard block
 block discarded – undo
701 701
 		$theme_data = wp_get_theme();
702 702
 		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
703 703
 
704
-		$data['gv_version']  = Plugin::$version;
705
-		$data['php_version']  = phpversion();
706
-		$data['wp_version']   = get_bloginfo( 'version' );
707
-		$data['gf_version']  = \GFForms::$version;
708
-		$data['server']       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
709
-		$data['multisite']    = is_multisite();
710
-		$data['theme']        = $theme;
711
-		$data['url']          = home_url();
712
-		$data['license_key']  = $this->settings->get( 'license_key' );
713
-		$data['beta']         = $this->settings->get( 'beta' );
704
+		$data[ 'gv_version' ]  = Plugin::$version;
705
+		$data[ 'php_version' ]  = phpversion();
706
+		$data[ 'wp_version' ]   = get_bloginfo( 'version' );
707
+		$data[ 'gf_version' ]  = \GFForms::$version;
708
+		$data[ 'server' ]       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
709
+		$data[ 'multisite' ]    = is_multisite();
710
+		$data[ 'theme' ]        = $theme;
711
+		$data[ 'url' ]          = home_url();
712
+		$data[ 'license_key' ]  = $this->settings->get( 'license_key' );
713
+		$data[ 'beta' ]         = $this->settings->get( 'beta' );
714 714
 
715 715
 		// View Data
716 716
 		$gravityview_posts = wp_count_posts( 'gravityview', 'readable' );
717 717
 
718
-		$data['view_count'] = null;
719
-		$data['view_first'] = null;
720
-		$data['view_latest'] = null;
718
+		$data[ 'view_count' ] = null;
719
+		$data[ 'view_first' ] = null;
720
+		$data[ 'view_latest' ] = null;
721 721
 
722 722
 		if ( $gravityview_posts->publish ) {
723
-			$data['view_count'] = $gravityview_posts->publish;
723
+			$data[ 'view_count' ] = $gravityview_posts->publish;
724 724
 
725 725
 			$first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' );
726 726
 			$latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' );
727 727
 
728 728
 			if ( $first = array_shift( $first ) ) {
729
-				$data['view_first'] = $first->post_date;
729
+				$data[ 'view_first' ] = $first->post_date;
730 730
 			}
731 731
 			if ( $latest = array_pop( $latest ) ) {
732
-				$data['view_latest'] = $latest->post_date;
732
+				$data[ 'view_latest' ] = $latest->post_date;
733 733
 			}
734 734
 		}
735 735
 
736 736
 		// Form counts
737 737
 		if ( class_exists( 'GFFormsModel' ) ) {
738 738
 			$form_data = \GFFormsModel::get_form_count();
739
-			$data['forms_total'] = Utils::get( $form_data, 'total', 0 );
740
-			$data['forms_active'] = Utils::get( $form_data, 'active', 0 );
741
-			$data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 );
742
-			$data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 );
739
+			$data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 );
740
+			$data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 );
741
+			$data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 );
742
+			$data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 );
743 743
 		}
744 744
 
745 745
 		// Retrieve current plugin information
@@ -747,13 +747,13 @@  discard block
 block discarded – undo
747 747
 			include ABSPATH . '/wp-admin/includes/plugin.php';
748 748
 		}
749 749
 
750
-		$data['integrations']     = self::get_related_plugins_and_extensions();
751
-		$data['active_plugins']   = get_option( 'active_plugins', array() );
752
-		$data['inactive_plugins'] = array();
753
-		$data['locale']           = get_locale();
750
+		$data[ 'integrations' ]     = self::get_related_plugins_and_extensions();
751
+		$data[ 'active_plugins' ]   = get_option( 'active_plugins', array() );
752
+		$data[ 'inactive_plugins' ] = array();
753
+		$data[ 'locale' ]           = get_locale();
754 754
 
755 755
 		// Validate request on the GV server
756
-		$data['hash']             = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] );
756
+		$data[ 'hash' ]             = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] );
757 757
 
758 758
 		return $data;
759 759
 	}
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 
784 784
 				$plugin_data = get_plugin_data( $active_plugin );
785 785
 
786
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
786
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
787 787
 			}
788 788
 
789 789
 			if ( ! empty( $extensions ) ) {
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/select-template.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -26,52 +26,52 @@
 block discarded – undo
26 26
 
27 27
 <?php // list all the available templates (type= fresh or custom ) ?>
28 28
 <div class="gv-grid">
29
-	<?php foreach( $templates as $id => $template ) {
29
+	<?php foreach ( $templates as $id => $template ) {
30 30
 		$selected     = ( $id == $current_template ) ? ' gv-selected' : '';
31
-		$placeholder  = ! empty( $template['buy_source'] );
32
-		$is_included  = ! empty( $template['included'] );
31
+		$placeholder  = ! empty( $template[ 'buy_source' ] );
32
+		$is_included  = ! empty( $template[ 'included' ] );
33 33
 		$plugin_data  = GravityView_Admin_Installer::get_wp_plugins_data( \GV\Utils::get( $template, 'textdomain', '' ) );
34 34
 		$button_text  = empty( $plugin_data ) ? esc_html__( 'Install Layout', 'gravityview' ) : esc_html__( 'Activate & Select Layout', 'gravityview' );
35 35
 		$button_class = 'gv-layout-' . ( empty( $plugin_data ) ? 'install' : 'activate' );
36
-		$template_path = isset($plugin_data['path']) ? $plugin_data['path'] : '';
36
+		$template_path = isset( $plugin_data[ 'path' ] ) ? $plugin_data[ 'path' ] : '';
37 37
 
38 38
 		?>
39 39
 		<div class="gv-grid-col-1-4">
40
-			<div class="gv-view-types-module<?php echo $selected; if( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>">
40
+			<div class="gv-view-types-module<?php echo $selected; if ( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template[ 'type' ] ); ?>">
41 41
 				<div class="gv-view-types-normal">
42
-					<img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>">
43
-					<h5><?php echo esc_html( $template['label'] ); ?></h5>
44
-					<p class="description"><?php echo esc_html( $template['description'] ); ?></p>
42
+					<img src="<?php echo esc_url( $template[ 'logo' ] ); ?>" alt="<?php echo esc_attr( $template[ 'label' ] ); ?>">
43
+					<h5><?php echo esc_html( $template[ 'label' ] ); ?></h5>
44
+					<p class="description"><?php echo esc_html( $template[ 'description' ] ); ?></p>
45 45
 				</div>
46 46
 				<div class="gv-view-types-hover">
47 47
 					<div>
48 48
 						<?php
49
-						if( $is_included ) {
49
+						if ( $is_included ) {
50 50
 						?>
51 51
 							<p><a href="<?php echo esc_url( admin_url( 'edit.php?post_type=gravityview&page=gv-admin-installer' ) ); ?>" class="button button-secondary button-hero <?php echo $button_class; ?>" rel="internal" data-template-path="<?php echo $template_path; ?>"><?php echo $button_text; ?></a></p>
52
-							<?php if( !empty( $template['license'] ) ) { ?>
53
-								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', '&nbsp;', $template['license'] ) ) ); ?></p>
52
+							<?php if ( ! empty( $template[ 'license' ] ) ) { ?>
53
+								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', '&nbsp;', $template[ 'license' ] ) ) ); ?></p>
54 54
 							<?php } ?>
55 55
 						<?php
56
-						} elseif( $placeholder ) {
57
-							$utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template['license'] ) . '&utm_content=' . urlencode( $template['slug'] );
56
+						} elseif ( $placeholder ) {
57
+							$utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template[ 'license' ] ) . '&utm_content=' . urlencode( $template[ 'slug' ] );
58 58
 							?>
59
-							<p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p>
59
+							<p><a href="<?php echo esc_url( $template[ 'buy_source' ] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview' ); ?></a></p>
60 60
 
61
-							<?php if( !empty( $template['preview'] ) ) { ?>
62
-								<p><a href="<?php echo esc_url( $template['preview'] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview'); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p>
61
+							<?php if ( ! empty( $template[ 'preview' ] ) ) { ?>
62
+								<p><a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview' ); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p>
63 63
 							<?php } ?>
64 64
 
65
-							<?php if( ! empty( $template['license'] ) ) { ?>
66
-								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://www.gravitykit.com/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', '&nbsp;', $template['license'] ) ) . '</a>' ); ?></p>
65
+							<?php if ( ! empty( $template[ 'license' ] ) ) { ?>
66
+								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://www.gravitykit.com/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', '&nbsp;', $template[ 'license' ] ) ) . '</a>' ); ?></p>
67 67
 							<?php } ?>
68 68
 						<?php }
69 69
 
70
-						if ($placeholder || $is_included) { ?> </div><div class="hidden"> <?php } ?>
70
+						if ( $placeholder || $is_included ) { ?> </div><div class="hidden"> <?php } ?>
71 71
 
72
-                        <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p>
73
-                        <?php if( !empty( $template['preview'] ) ) { ?>
74
-                            <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-welcome-view-site" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a>
72
+                        <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview' ); ?></a></p>
73
+                        <?php if ( ! empty( $template[ 'preview' ] ) ) { ?>
74
+                            <a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-welcome-view-site" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview' ); ?>"></i></a>
75 75
                         <?php } ?>
76 76
 					</div>
77 77
 				</div>
Please login to merge, or discard this patch.
includes/class-gravityview-compatibility.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @return GravityView_Compatibility
77 77
 	 */
78 78
 	public static function getInstance() {
79
-		if( self::$instance ) {
79
+		if ( self::$instance ) {
80 80
 			return self::$instance;
81 81
 		}
82 82
 		return new self;
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 		// If Gravity Forms doesn't exist or is outdated, load the admin view class to
139 139
 		// show the notice, but not load any post types or process shortcodes.
140 140
 		// Without Gravity Forms, there is no GravityView. Beautiful, really.
141
-		if( ! self::is_valid() ) {
141
+		if ( ! self::is_valid() ) {
142 142
 
143 143
 			// If the plugin's not loaded, might as well hide the shortcode for people.
144
-			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') );
144
+			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) );
145 145
 
146 146
 		}
147 147
 	}
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) {
169 169
 
170
-		if( ! GVCommon::has_cap( 'activate_plugins' ) ) {
170
+		if ( ! GVCommon::has_cap( 'activate_plugins' ) ) {
171 171
 			return null;
172 172
 		}
173 173
 
174 174
 		$notices = self::get_notices();
175 175
 
176
-		$message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>';
177
-		foreach( (array)$notices as $notice ) {
178
-			$message .= wpautop( $notice['message'] );
176
+		$message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview' ) . '</em></p>';
177
+		foreach ( (array)$notices as $notice ) {
178
+			$message .= wpautop( $notice[ 'message' ] );
179 179
 		}
180 180
 		$message .= '</div>';
181 181
 
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 
196 196
 		if ( ! gravityview()->plugin->is_compatible_php() ) {
197 197
 
198
-			self::$notices['php_version'] = array(
198
+			self::$notices[ 'php_version' ] = array(
199 199
 				'class' => 'error',
200
-				'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ),
200
+				'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ),
201 201
 				'cap' => 'manage_options',
202 202
 				'dismiss' => 'php_version',
203 203
 			);
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 		if ( ! gravityview()->plugin->is_compatible_future_php() ) {
209 209
 
210 210
 			// Show the notice on every update. Yes, annoying, but not as annoying as a plugin breaking.
211
-			$key = sprintf('php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version );
211
+			$key = sprintf( 'php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version );
212 212
 
213 213
 			self::$notices[ $key ] = array(
214 214
 				'class' => 'error',
215
-				'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ),
215
+				'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ),
216 216
 				'cap' => 'manage_options',
217 217
 				'dismiss' => $key,
218 218
 			);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
 		if ( ! gravityview()->plugin->is_compatible_wordpress() ) {
239 239
 
240
-			self::$notices['wp_version'] = array(
240
+			self::$notices[ 'wp_version' ] = array(
241 241
 				'class' => 'error',
242 242
 				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ),
243 243
 			    'cap' => 'update_core',
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
 	public static function check_gravityforms() {
272 272
 
273 273
 		// Bypass other checks: if the class exists
274
-		if( class_exists( 'GFCommon' ) ) {
274
+		if ( class_exists( 'GFCommon' ) ) {
275 275
 
276 276
 			// Does the version meet future requirements?
277
-			if( true === gravityview()->plugin->is_compatible_future_gravityforms() ) {
277
+			if ( true === gravityview()->plugin->is_compatible_future_gravityforms() ) {
278 278
 				return true;
279 279
 			}
280 280
 
281 281
 			// Does it meet minimum requirements?
282 282
 			$meets_minimum = gravityview()->plugin->is_compatible_gravityforms();
283 283
 
284
-			if( $meets_minimum ) {
284
+			if ( $meets_minimum ) {
285 285
 				/* translators: first placeholder is the future required version of Gravity Forms. The second placeholder is the current version of Gravity Forms. */
286 286
 				$title = __( 'In the future, GravityView will require Gravity Forms Version %s or newer.', 'gravityview' );
287 287
 				$version = GV_FUTURE_MIN_GF_VERSION;
@@ -296,14 +296,14 @@  discard block
 block discarded – undo
296 296
 			$message = '<h3>' . esc_html( sprintf( $title, $version ) ) . '</h3>';
297 297
 
298 298
 			/* translators: the placeholder is the current version of Gravity Forms. */
299
-			$message .= '<p>' . sprintf( esc_html__( "You're using Version %s. Please update your Gravity Forms or purchase a license.", 'gravityview' ), '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>' ) . '</p>';
299
+			$message .= '<p>' . sprintf( esc_html__( "You're using Version %s. Please update your Gravity Forms or purchase a license.", 'gravityview' ), '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>' ) . '</p>';
300 300
 
301 301
 			/* translators: In this context, "get" means purchase */
302 302
 			$message .= '<p><a href="https://www.gravitykit.com/gravityforms/" class="button button-secondary button-large button-hero">' . esc_html__( 'Get the Latest Gravity Forms', 'gravityview' ) . '</a></p>';
303 303
 
304 304
 
305 305
 			// Show the notice even if the future version requirements aren't met
306
-			self::$notices['gf_version'] = array(
306
+			self::$notices[ 'gf_version' ] = array(
307 307
 				'class' => $class,
308 308
 				'message' => $message,
309 309
 				'cap' => 'update_plugins',
@@ -321,42 +321,42 @@  discard block
 block discarded – undo
321 321
 		 * OR
322 322
 		 * It's the Network Admin and we just don't know whether the sites have GF activated themselves.
323 323
 		 */
324
-		if( true === $gf_status || is_network_admin() ) {
324
+		if ( true === $gf_status || is_network_admin() ) {
325 325
 			return true;
326 326
 		}
327 327
 
328 328
 		// If GFCommon doesn't exist, assume GF not active
329 329
 		$return = false;
330 330
 
331
-		switch( $gf_status ) {
331
+		switch ( $gf_status ) {
332 332
 			case 'inactive':
333 333
 
334 334
 				// Required for multisite
335
-				if( ! function_exists('wp_create_nonce') ) {
335
+				if ( ! function_exists( 'wp_create_nonce' ) ) {
336 336
 					require_once ABSPATH . WPINC . '/pluggable.php';
337 337
 				}
338 338
 
339 339
 				// Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE"
340
-				if( is_multisite() ) {
340
+				if ( is_multisite() ) {
341 341
 					wp_cookie_constants();
342 342
 				}
343 343
 
344 344
 				$return = false;
345 345
 
346
-				$button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">';
346
+				$button = function_exists( 'is_network_admin' ) && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php' ) . '" class="button button-large">';
347 347
 
348
-				self::$notices['gf_inactive'] = array(
348
+				self::$notices[ 'gf_inactive' ] = array(
349 349
 					'class' => 'error',
350
-					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ),
350
+					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n" . $button, '</a></strong>' ),
351 351
 					'cap' => 'activate_plugins',
352 352
 					'dismiss' => 'gf_inactive',
353 353
 				);
354 354
 
355 355
 				break;
356 356
 			default:
357
-				self::$notices['gf_installed'] = array(
357
+				self::$notices[ 'gf_installed' ] = array(
358 358
 					'class' => 'error',
359
-					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $59%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="https://www.gravitykit.com/gravityforms/" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
359
+					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $59%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="https://www.gravitykit.com/gravityforms/" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ),
360 360
 					'cap' => 'install_plugins',
361 361
 					'dismiss' => 'gf_installed',
362 362
 				);
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
 	 */
374 374
 	private static function check_gf_directory() {
375 375
 
376
-		if( class_exists( 'GFDirectory' ) ) {
377
-			self::$notices['gf_directory'] = array(
376
+		if ( class_exists( 'GFDirectory' ) ) {
377
+			self::$notices[ 'gf_directory' ] = array(
378 378
 				'class' => 'error is-dismissible',
379
-				'title' => __('Potential Conflict', 'gravityview' ),
379
+				'title' => __( 'Potential Conflict', 'gravityview' ),
380 380
 				'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ),
381 381
 				'dismiss' => 'gf_directory',
382 382
 				'cap' => 'activate_plugins',
@@ -394,21 +394,21 @@  discard block
 block discarded – undo
394 394
 	 */
395 395
 	public static function get_plugin_status( $location = '' ) {
396 396
 
397
-		if( ! function_exists('is_plugin_active') ) {
397
+		if ( ! function_exists( 'is_plugin_active' ) ) {
398 398
 			include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
399 399
 		}
400 400
 
401
-		if( is_network_admin() && is_plugin_active_for_network( $location ) ) {
401
+		if ( is_network_admin() && is_plugin_active_for_network( $location ) ) {
402 402
 			return true;
403 403
 		}
404 404
 
405
-		if( ! is_network_admin() && is_plugin_active( $location ) ) {
405
+		if ( ! is_network_admin() && is_plugin_active( $location ) ) {
406 406
 			return true;
407 407
 		}
408 408
 
409
-		if(
410
-			!file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
411
-			!file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
409
+		if (
410
+			! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
411
+			! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
412 412
 		) {
413 413
 			return false;
414 414
 		}
Please login to merge, or discard this patch.
includes/class-admin-installer.php 3 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function add_downloads_data_filters() {
68 68
 
69
-	    $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT );
69
+		$downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT );
70 70
 
71
-	    if ( ! $downloads_data && ! isset( $_GET['cache'] ) ) {
71
+		if ( ! $downloads_data && ! isset( $_GET['cache'] ) ) {
72 72
 			return;
73 73
 		}
74 74
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function add_admin_menu() {
99 99
 
100
-	    $menu_text = _x( 'Manage Add-Ons', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
100
+		$menu_text = _x( 'Manage Add-Ons', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
101 101
 
102 102
 		$menu_text = sprintf( '<span title="%s" style="margin: 0">%s</span>', esc_attr__( 'Plugins that extend GravityView and Gravity Forms functionality.', 'gravityview' ), $menu_text );
103 103
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	}
113 113
 
114 114
 	/**
115
-     * When on the Installer page, show a different notice than on the Settings page
116
-     *
115
+	 * When on the Installer page, show a different notice than on the Settings page
116
+	 *
117 117
 	 * @param array $notice
118 118
 	 *
119 119
 	 * @return string License notice
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 	public function maybe_modify_license_notice( $notice = '' ) {
122 122
 
123 123
 		if ( ! gravityview()->request->is_admin( '', 'downloads' ) ) {
124
-            return $notice;
125
-        }
124
+			return $notice;
125
+		}
126 126
 
127
-        return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' );
127
+		return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' );
128 128
 	}
129 129
 
130 130
 	/**
@@ -167,43 +167,43 @@  discard block
 block discarded – undo
167 167
 	 * Get downloads data from transient or from API; save transient after getting data from API
168 168
 	 *
169 169
 	 * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: {
170
-     *   @type array  $info {
171
-     *       @type string $id int 17
172
-     *       @type string $slug Extension slug
173
-     *       @type string $title Extension title
174
-     *       @type string $create_date in '2018-07-19 20:03:10' format
175
-     *       @type string $modified_date
176
-     *       @type string $status
177
-     *       @type string $link URL to public plugin page
178
-     *       @type string $content
179
-     *       @type string $excerpt
180
-     *       @type string $thumbnail URL to thumbnail
181
-     *       @type array  $category Taxonomy details for the plugin's category {
182
-     *         @type int $term_id => int 30
183
-     *         @type string $name => string 'Plugins' (length=7)
184
-     *         @type string $slug => string 'plugins' (length=7)
185
-     *         @type int $term_group => int 0
186
-     *         @type int $term_taxonomy_id => int 30
187
-     *         @type string $taxonomy => string 'download_category' (length=17)
188
-     *         @type string $description => string '' (length=0)
189
-     *         @type int $parent => int 0
190
-     *         @type int $count => int 4
191
-     *         @type string $filter => string 'raw' (length=3)
192
-     *       }
193
-     *       @type array $tags {see $category above}
194
-     *       @type string $textdomain string 'gravityview' (length=11)
195
-     *   }
196
-     *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
197
-     *   @type array $licensing {
198
-     *       @type bool   $enabled Is licensing enabled for the extension
199
-     *       @type string $version Version number
200
-     *       @type string $exp_unit Expiration unit ('years')
201
-     *       @type string $exp_length Expiration length ('1')
202
-     *   }
203
-     *   @type array $files Array of files. Empty if user has no access to the file. {
204
-     *       @type string $file string URL of the file download
205
-     *   }
206
-     * }
170
+	 *   @type array  $info {
171
+	 *       @type string $id int 17
172
+	 *       @type string $slug Extension slug
173
+	 *       @type string $title Extension title
174
+	 *       @type string $create_date in '2018-07-19 20:03:10' format
175
+	 *       @type string $modified_date
176
+	 *       @type string $status
177
+	 *       @type string $link URL to public plugin page
178
+	 *       @type string $content
179
+	 *       @type string $excerpt
180
+	 *       @type string $thumbnail URL to thumbnail
181
+	 *       @type array  $category Taxonomy details for the plugin's category {
182
+	 *         @type int $term_id => int 30
183
+	 *         @type string $name => string 'Plugins' (length=7)
184
+	 *         @type string $slug => string 'plugins' (length=7)
185
+	 *         @type int $term_group => int 0
186
+	 *         @type int $term_taxonomy_id => int 30
187
+	 *         @type string $taxonomy => string 'download_category' (length=17)
188
+	 *         @type string $description => string '' (length=0)
189
+	 *         @type int $parent => int 0
190
+	 *         @type int $count => int 4
191
+	 *         @type string $filter => string 'raw' (length=3)
192
+	 *       }
193
+	 *       @type array $tags {see $category above}
194
+	 *       @type string $textdomain string 'gravityview' (length=11)
195
+	 *   }
196
+	 *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
197
+	 *   @type array $licensing {
198
+	 *       @type bool   $enabled Is licensing enabled for the extension
199
+	 *       @type string $version Version number
200
+	 *       @type string $exp_unit Expiration unit ('years')
201
+	 *       @type string $exp_length Expiration length ('1')
202
+	 *   }
203
+	 *   @type array $files Array of files. Empty if user has no access to the file. {
204
+	 *       @type string $file string URL of the file download
205
+	 *   }
206
+	 * }
207 207
 	 */
208 208
 	public function get_downloads_data() {
209 209
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		) );
236 236
 
237 237
 		if ( is_wp_error( $response ) ) {
238
-		    gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
238
+			gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
239 239
 			return $response;
240 240
 		}
241 241
 
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
                 <div class="gv-admin-installer-notice notice inline error">
289 289
                     <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3>
290 290
                     <?php
291
-                    if ( is_wp_error( $downloads_data ) ) {
292
-	                    echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
293
-                    }
294
-                    ?>
291
+					if ( is_wp_error( $downloads_data ) ) {
292
+						echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
293
+					}
294
+					?>
295 295
                 </div>
296 296
             </div>
297 297
 			<?php
@@ -381,9 +381,9 @@  discard block
 block discarded – undo
381 381
 	 */
382 382
 	protected function render_download( $download, $wp_plugins ) {
383 383
 
384
-        $details = $this->get_download_display_details( $download, $wp_plugins );
384
+		$details = $this->get_download_display_details( $download, $wp_plugins );
385 385
 
386
-        $download_info = $details['download_info'];
386
+		$download_info = $details['download_info'];
387 387
 
388 388
 		?>
389 389
         <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
@@ -407,45 +407,45 @@  discard block
 block discarded – undo
407 407
 
408 408
                 <div class="addon-excerpt"><?php
409 409
 
410
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
410
+					$excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
411 411
 
412
-                    // Allow some pure HTML tags, but remove everything else from the excerpt.
413
-                    $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
414
-                    $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
412
+					// Allow some pure HTML tags, but remove everything else from the excerpt.
413
+					$tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
414
+					$replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
415 415
 
416
-                    $excerpt = str_replace( $tags, $replacements, $excerpt );
417
-                    $excerpt = esc_html( strip_tags( $excerpt ) );
416
+					$excerpt = str_replace( $tags, $replacements, $excerpt );
417
+					$excerpt = esc_html( strip_tags( $excerpt ) );
418 418
 					$excerpt = str_replace( $replacements, $tags, $excerpt );
419 419
 
420 420
 					echo wpautop( $excerpt );
421
-                ?></div>
421
+				?></div>
422 422
             </div>
423 423
         </div>
424 424
 		<?php
425 425
 	}
426 426
 
427 427
 	/**
428
-     * Generates details array for the download to keep the render_download() method a bit tidier
429
-     *
428
+	 * Generates details array for the download to keep the render_download() method a bit tidier
429
+	 *
430 430
 	 * @since 2.10 Allow managing installed add-ons whether or not the user's license shows they have access.
431 431
 	 *
432 432
 	 * @param array $download Single download, as returned by {@see get_downloads_data}
433 433
 	 * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()}
434 434
 	 *
435 435
 	 * @return array {
436
-     *   @type array $download_info
437
-     *   @type string $plugin_path
438
-     *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
439
-     *   @type string $status_label
440
-     *   @type string $button_title Title attribute to show when hovering over the download's button
441
-     *   @type string $button_class CSS class to use for the button
442
-     *   @type string $button_label Text to use for the download's anchor link
443
-     *   @type string $href URL for the download's button
444
-     *   @type bool   $spinner Whether to show the spinner icon
445
-     *   @type string $item_class CSS class for the download container
446
-     *   @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions")
447
-     *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
448
-     * }
436
+	 *   @type array $download_info
437
+	 *   @type string $plugin_path
438
+	 *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
439
+	 *   @type string $status_label
440
+	 *   @type string $button_title Title attribute to show when hovering over the download's button
441
+	 *   @type string $button_class CSS class to use for the button
442
+	 *   @type string $button_label Text to use for the download's anchor link
443
+	 *   @type string $href URL for the download's button
444
+	 *   @type bool   $spinner Whether to show the spinner icon
445
+	 *   @type string $item_class CSS class for the download container
446
+	 *   @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions")
447
+	 *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
448
+	 * }
449 449
 	 */
450 450
 	private function get_download_display_details( $download, $wp_plugins ) {
451 451
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			'slug' => '',
457 457
 			'excerpt' => '',
458 458
 			'link' => '',
459
-            'coming_soon' => false,
459
+			'coming_soon' => false,
460 460
 			'installer_title' => null, // May not be defined
461 461
 			'installer_excerpt' => null, // May not be defined
462 462
 		) );
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
 			$href         = 'https://www.gravitykit.com/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
501 501
 		}
502 502
 
503
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
504
-	        $spinner      = false;
505
-	        $status       = 'notinstalled';
506
-	        $status_label = __( 'Coming Soon', 'gravityview' );
507
-	        $button_label = __( 'Learn More', 'gravityview' );
508
-	        $button_class = 'button-primary button-large';
509
-	        $href         = \GV\Utils::get( $download_info, 'link', 'https://www.gravitykit.com/extensions/' );
510
-        }
503
+		elseif ( ! empty( $download_info['coming_soon'] ) ) {
504
+			$spinner      = false;
505
+			$status       = 'notinstalled';
506
+			$status_label = __( 'Coming Soon', 'gravityview' );
507
+			$button_label = __( 'Learn More', 'gravityview' );
508
+			$button_class = 'button-primary button-large';
509
+			$href         = \GV\Utils::get( $download_info, 'link', 'https://www.gravitykit.com/extensions/' );
510
+		}
511 511
 
512 512
 		// Access but the plugin is not installed
513 513
 		elseif ( ! $wp_plugin ) {
@@ -553,18 +553,18 @@  discard block
 block discarded – undo
553 553
 		$download_info['link'] = add_query_arg( array( 'license_key' => $license_key ), $download_info['link'] );
554 554
 
555 555
 		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
556
-    }
556
+	}
557 557
 
558 558
 	/**
559
-     * Returns the base price for an extension
560
-     *
559
+	 * Returns the base price for an extension
560
+	 *
561 561
 	 * @param array $download
562 562
 	 *
563 563
 	 * @return float Base price for an extension. If not for sale separately, returns 0
564 564
 	 */
565 565
 	private function get_download_base_price( $download ) {
566 566
 
567
-	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
567
+		$base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
568 568
 		$base_price = \GFCommon::to_number( $base_price );
569 569
 
570 570
 		unset( $download['pricing']['amount'] );
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		}
576 576
 
577 577
 		return floatval( $base_price );
578
-    }
578
+	}
579 579
 
580 580
 	/**
581 581
 	 * Handle AJAX request to activate extension
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
 
594 594
 		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
595 595
 			wp_send_json_error( array(
596
-                'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
597
-            ) );
596
+				'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
597
+			) );
598 598
 		}
599 599
 
600 600
 		wp_send_json_success();
@@ -615,10 +615,10 @@  discard block
 block discarded – undo
615 615
 		deactivate_plugins( $data['path'] );
616 616
 
617 617
 		if( is_plugin_active( $data['path'] ) ) {
618
-            wp_send_json_error( array(
619
-                'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
620
-            ) );
621
-        }
618
+			wp_send_json_error( array(
619
+				'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
620
+			) );
621
+		}
622 622
 
623 623
 		wp_send_json_success();
624 624
 	}
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function register_noconflict( $items ) {
55 55
 
56
-		$items[] = 'gravityview-admin-installer';
56
+		$items[ ] = 'gravityview-admin-installer';
57 57
 
58 58
 		return $items;
59 59
 	}
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 
69 69
 	    $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT );
70 70
 
71
-	    if ( ! $downloads_data && ! isset( $_GET['cache'] ) ) {
71
+	    if ( ! $downloads_data && ! isset( $_GET[ 'cache' ] ) ) {
72 72
 			return;
73 73
 		}
74 74
 
75
-		add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) {
75
+		add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) {
76 76
 			foreach ( $downloads_data as $extension ) {
77
-				if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) {
77
+				if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) {
78 78
 					continue;
79 79
 				}
80 80
 
81
-				return (object) array(
82
-					'slug'          => $extension['info']['slug'],
83
-					'name'          => $extension['info']['title'],
84
-					'version'       => $extension['licensing']['version'],
85
-					'download_link' => $extension['files'][0]['file'],
81
+				return (object)array(
82
+					'slug'          => $extension[ 'info' ][ 'slug' ],
83
+					'name'          => $extension[ 'info' ][ 'title' ],
84
+					'version'       => $extension[ 'licensing' ][ 'version' ],
85
+					'download_link' => $extension[ 'files' ][ 0 ][ 'file' ],
86 86
 				);
87 87
 			}
88 88
 
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 
150 150
 		foreach ( $all_plugins as $path => $plugin ) {
151 151
 
152
-			if ( empty( $plugin['TextDomain'] ) ) {
152
+			if ( empty( $plugin[ 'TextDomain' ] ) ) {
153 153
 				continue;
154 154
 			}
155 155
 
156
-			$wp_plugins[ $plugin['TextDomain'] ] = array(
156
+			$wp_plugins[ $plugin[ 'TextDomain' ] ] = array(
157 157
 				'path'      => $path,
158
-				'version'   => $plugin['Version'],
158
+				'version'   => $plugin[ 'Version' ],
159 159
 				'activated' => is_plugin_active( $path )
160 160
 			);
161 161
 		}
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 
210 210
 		$downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT );
211 211
 
212
-		if ( $downloads_data && ! isset( $_GET['cache'] ) ) {
212
+		if ( $downloads_data && ! isset( $_GET[ 'cache' ] ) ) {
213 213
 			return $downloads_data;
214 214
 		}
215 215
 
216
-		if( \GV\Plugin::is_network_activated() ) {
216
+		if ( \GV\Plugin::is_network_activated() ) {
217 217
 			$home_url = network_home_url();
218 218
 		} else {
219 219
 			$home_url = home_url();
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 
242 242
 		$downloads_data = json_decode( wp_remote_retrieve_body( $response ), true );
243 243
 
244
-		if ( empty( $downloads_data['products'] ) ) {
244
+		if ( empty( $downloads_data[ 'products' ] ) ) {
245 245
 			return array();
246 246
 		}
247 247
 
248
-		$this->set_downloads_data( $downloads_data['products'] );
248
+		$this->set_downloads_data( $downloads_data[ 'products' ] );
249 249
 
250
-		return $downloads_data['products'];
250
+		return $downloads_data[ 'products' ];
251 251
 	}
252 252
 
253 253
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
             <h2><?php esc_html_e( 'The following plugins extend GravityView and Gravity Forms functionality:', 'gravityview' ); ?></h2>
309 309
 
310
-			<a class="button button-secondary gv-admin-installer-refresh-link" href="<?php echo add_query_arg(array( 'cache' => 1 ) ); ?>"><i class="dashicons dashicons-update" style="margin-top: .2em"></i> <?php esc_html_e( 'Refresh', 'gravityview' ); ?></a>
310
+			<a class="button button-secondary gv-admin-installer-refresh-link" href="<?php echo add_query_arg( array( 'cache' => 1 ) ); ?>"><i class="dashicons dashicons-update" style="margin-top: .2em"></i> <?php esc_html_e( 'Refresh', 'gravityview' ); ?></a>
311 311
 
312 312
 			<hr class="wp-header-end" />
313 313
 
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 
325 325
 				$this->render_section( 'extensions', esc_html__( 'GravityView Extensions', 'gravityview' ), $downloads_data, $wp_plugins );
326 326
 
327
-				$this->render_section(  'plugins', esc_html__( 'Gravity Forms Add-Ons', 'gravityview' ), $downloads_data, $wp_plugins );
327
+				$this->render_section( 'plugins', esc_html__( 'Gravity Forms Add-Ons', 'gravityview' ), $downloads_data, $wp_plugins );
328 328
 
329
-				$this->render_section(  'labs', esc_html__( 'GravityView Labs', 'gravityview' ), $downloads_data, $wp_plugins );
329
+				$this->render_section( 'labs', esc_html__( 'GravityView Labs', 'gravityview' ), $downloads_data, $wp_plugins );
330 330
 
331
-				$this->render_section(  'friends', esc_html__( 'Friends of GravityView', 'gravityview' ), $downloads_data, $wp_plugins );
331
+				$this->render_section( 'friends', esc_html__( 'Friends of GravityView', 'gravityview' ), $downloads_data, $wp_plugins );
332 332
 				?>
333 333
             </div>
334 334
         </div>
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 				continue;
356 356
 			}
357 357
 
358
-			if ( empty( $download['info'] ) ) {
358
+			if ( empty( $download[ 'info' ] ) ) {
359 359
 				continue;
360 360
 			}
361 361
 
@@ -383,31 +383,31 @@  discard block
 block discarded – undo
383 383
 
384 384
         $details = $this->get_download_display_details( $download, $wp_plugins );
385 385
 
386
-        $download_info = $details['download_info'];
386
+        $download_info = $details[ 'download_info' ];
387 387
 
388 388
 		?>
389
-        <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
389
+        <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>">
390 390
             <div class="addon-inner">
391
-                <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a>
392
-                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3>
391
+                <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a>
392
+                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3>
393 393
                 <div>
394
-                    <?php if( ! empty( $details['status_label'] ) ) { ?>
395
-                    <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>">
396
-                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span>
394
+                    <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?>
395
+                    <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>">
396
+                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span>
397 397
                     </div>
398 398
 			        <?php } ?>
399 399
 
400
-					<?php if ( 'gravityview' !== $download_info['slug'] ) { ?>
401
-                    <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>">
402
-                        <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span>
403
-                        <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?>
400
+					<?php if ( 'gravityview' !== $download_info[ 'slug' ] ) { ?>
401
+                    <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>">
402
+                        <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span>
403
+                        <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?>
404 404
                     </a>
405 405
 					<?php } ?>
406 406
                 </div>
407 407
 
408 408
                 <div class="addon-excerpt"><?php
409 409
 
410
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
410
+                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] );
411 411
 
412 412
                     // Allow some pure HTML tags, but remove everything else from the excerpt.
413 413
                     $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 	 */
450 450
 	private function get_download_display_details( $download, $wp_plugins ) {
451 451
 
452
-		$download_info = wp_parse_args( (array) $download['info'], array(
452
+		$download_info = wp_parse_args( (array)$download[ 'info' ], array(
453 453
 			'thumbnail' => '',
454 454
 			'title' => '',
455 455
 			'textdomain' => '',
@@ -461,9 +461,9 @@  discard block
 block discarded – undo
461 461
 			'installer_excerpt' => null, // May not be defined
462 462
 		) );
463 463
 
464
-		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false );
464
+		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false );
465 465
 
466
-		$has_access = ! empty( $download['files'] );
466
+		$has_access = ! empty( $download[ 'files' ] );
467 467
 		$spinner = true;
468 468
 		$href = $plugin_path = '#';
469 469
 		$status = $item_class = $button_title = $button_class = '';
@@ -473,11 +473,11 @@  discard block
 block discarded – undo
473 473
 		$required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' );
474 474
 
475 475
 		// The license is not active - no matter what level, this should not work
476
-		if( ! $is_active  && empty( $base_price ) ) {
476
+		if ( ! $is_active && empty( $base_price ) ) {
477 477
 			$spinner      = false;
478 478
 			$status_label = '';
479 479
 			$button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license );
480
-			$href         = $download_info['link'];
480
+			$href         = $download_info[ 'link' ];
481 481
 			$button_class = 'button-primary';
482 482
 		}
483 483
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 			$status_label = '';
488 488
 			$button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price );
489 489
 			$button_class = 'button-primary button-large';
490
-			$href         = $download_info['link'];
490
+			$href         = $download_info[ 'link' ];
491 491
 			$item_class   = 'featured';
492 492
 		}
493 493
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 			$href         = 'https://www.gravitykit.com/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
501 501
 		}
502 502
 
503
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
503
+        elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) {
504 504
 	        $spinner      = false;
505 505
 	        $status       = 'notinstalled';
506 506
 	        $status_label = __( 'Coming Soon', 'gravityview' );
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 			$href = add_query_arg(
516 516
 				array(
517 517
 					'action'   => 'install-plugin',
518
-					'plugin'   => $download_info['slug'],
519
-					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ),
518
+					'plugin'   => $download_info[ 'slug' ],
519
+					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ),
520 520
 				),
521 521
 				self_admin_url( 'update.php' )
522 522
 			);
@@ -532,12 +532,12 @@  discard block
 block discarded – undo
532 532
 			$status = 'inactive';
533 533
 			$status_label = __( 'Inactive', 'gravityview' );
534 534
 			$button_label = __( 'Activate', 'gravityview' );
535
-			$plugin_path = $wp_plugin['path'];
535
+			$plugin_path = $wp_plugin[ 'path' ];
536 536
 			$button_class = 'button-secondary';
537 537
 		}
538 538
 		// The plugin is installed and active
539
-		elseif ( ! empty( $wp_plugin['path'] ) ) {
540
-			$plugin_path = $wp_plugin['path'];
539
+		elseif ( ! empty( $wp_plugin[ 'path' ] ) ) {
540
+			$plugin_path = $wp_plugin[ 'path' ];
541 541
 			$status = 'active';
542 542
 			$status_label = __( 'Active', 'gravityview' );
543 543
 			$button_label = __( 'Deactivate', 'gravityview' );
@@ -550,9 +550,9 @@  discard block
 block discarded – undo
550 550
 			$href = add_query_arg( array( 'license_key' => $license_key ), $href );
551 551
 		}
552 552
 
553
-		$download_info['link'] = add_query_arg( array( 'license_key' => $license_key ), $download_info['link'] );
553
+		$download_info[ 'link' ] = add_query_arg( array( 'license_key' => $license_key ), $download_info[ 'link' ] );
554 554
 
555
-		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
555
+		return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
556 556
     }
557 557
 
558 558
 	/**
@@ -567,11 +567,11 @@  discard block
 block discarded – undo
567 567
 	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
568 568
 		$base_price = \GFCommon::to_number( $base_price );
569 569
 
570
-		unset( $download['pricing']['amount'] );
570
+		unset( $download[ 'pricing' ][ 'amount' ] );
571 571
 
572 572
 		// Price options array, not single price
573
-		if ( ! $base_price && ! empty( $download['pricing'] ) ) {
574
-			$base_price = array_shift( $download['pricing'] );
573
+		if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) {
574
+			$base_price = array_shift( $download[ 'pricing' ] );
575 575
 		}
576 576
 
577 577
 		return floatval( $base_price );
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
 	public function activate_download() {
586 586
 		$data = \GV\Utils::_POST( 'data', array() );
587 587
 
588
-		if ( empty( $data['path'] ) ) {
588
+		if ( empty( $data[ 'path' ] ) ) {
589 589
 			return;
590 590
 		}
591 591
 
592
-		$result = activate_plugin( $data['path'] );
592
+		$result = activate_plugin( $data[ 'path' ] );
593 593
 
594
-		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
594
+		if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) {
595 595
 			wp_send_json_error( array(
596 596
                 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
597 597
             ) );
@@ -608,13 +608,13 @@  discard block
 block discarded – undo
608 608
 	public function deactivate_download() {
609 609
 		$data = \GV\Utils::_POST( 'data', array() );
610 610
 
611
-		if ( empty( $data['path'] ) ) {
611
+		if ( empty( $data[ 'path' ] ) ) {
612 612
 			return;
613 613
 		}
614 614
 
615
-		deactivate_plugins( $data['path'] );
615
+		deactivate_plugins( $data[ 'path' ] );
616 616
 
617
-		if( is_plugin_active( $data['path'] ) ) {
617
+		if ( is_plugin_active( $data[ 'path' ] ) ) {
618 618
             wp_send_json_error( array(
619 619
                 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
620 620
             ) );
Please login to merge, or discard this patch.
Braces   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -498,9 +498,7 @@
 block discarded – undo
498 498
 			$button_label = sprintf( __( 'Upgrade to %s for Access', 'gravityview' ), $required_license );
499 499
 			$button_class = 'button-primary button-large';
500 500
 			$href         = 'https://www.gravitykit.com/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
501
-		}
502
-
503
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
501
+		} elseif ( ! empty( $download_info['coming_soon'] ) ) {
504 502
 	        $spinner      = false;
505 503
 	        $status       = 'notinstalled';
506 504
 	        $status_label = __( 'Coming Soon', 'gravityview' );
Please login to merge, or discard this patch.
includes/presets/register-default-templates.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 		'GravityView_DataTables_Template' => array(
60 60
 			'slug' => 'dt_placeholder',
61 61
 			'label' =>  __( 'DataTables Table', 'gv-datatables', 'gravityview' ),
62
-			'description' => __('Display items in a dynamic table powered by DataTables.', 'gravityview'),
63
-			'logo' => plugins_url('assets/images/templates/logo-datatables.png', GRAVITYVIEW_FILE ),
62
+			'description' => __( 'Display items in a dynamic table powered by DataTables.', 'gravityview' ),
63
+			'logo' => plugins_url( 'assets/images/templates/logo-datatables.png', GRAVITYVIEW_FILE ),
64 64
 			'buy_source' => 'https://www.gravitykit.com/pricing/?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=datatables',
65 65
 			'preview' => 'https://try.gravityview.co/demo/view/datatables/?utm_source=plugin&utm_medium=try_demo&utm_campaign=view_type&utm_term=datatables',
66 66
 			'license' => esc_html__( 'All Access', 'gravityview' ),
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 				continue;
103 103
 			}
104 104
 
105
-			$license_price_id = (int) \GV\Utils::get( $license, 'price_id', 0 );
106
-			$placeholder_price_id = (int) \GV\Utils::get( $placeholder, 'price_id' );
105
+			$license_price_id = (int)\GV\Utils::get( $license, 'price_id', 0 );
106
+			$placeholder_price_id = (int)\GV\Utils::get( $placeholder, 'price_id' );
107 107
 
108
-			$placeholder['type']     = 'custom';
109
-			$placeholder['included'] = ( $license_price_id >= $placeholder_price_id );
108
+			$placeholder[ 'type' ]     = 'custom';
109
+			$placeholder[ 'included' ] = ( $license_price_id >= $placeholder_price_id );
110 110
 
111
-			new GravityView_Placeholder_Template( $placeholder['slug'], $placeholder );
111
+			new GravityView_Placeholder_Template( $placeholder[ 'slug' ], $placeholder );
112 112
 		}
113 113
 
114 114
 	} catch ( Exception $exception ) {
Please login to merge, or discard this patch.