Completed
Push — develop ( 077778...eda652 )
by Zack
17:30
created
includes/presets/register-default-templates.php 1 patch
Spacing   +5 added lines, -5 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://gravityview.co/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,10 +102,10 @@  discard block
 block discarded – undo
102 102
 				continue;
103 103
 			}
104 104
 
105
-			$placeholder['type']     = 'custom';
106
-			$placeholder['included'] = ( (int) $license['price_id'] >= $placeholder['price_id'] );
105
+			$placeholder[ 'type' ]     = 'custom';
106
+			$placeholder[ 'included' ] = ( (int)$license[ 'price_id' ] >= $placeholder[ 'price_id' ] );
107 107
 
108
-			new GravityView_Placeholder_Template( $placeholder['slug'], $placeholder );
108
+			new GravityView_Placeholder_Template( $placeholder[ 'slug' ], $placeholder );
109 109
 		}
110 110
 
111 111
 	} catch ( Exception $exception ) {
Please login to merge, or discard this patch.
includes/class-admin-installer.php 2 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
@@ -379,9 +379,9 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	protected function render_download( $download, $wp_plugins ) {
381 381
 
382
-        $details = $this->get_download_display_details( $download, $wp_plugins );
382
+		$details = $this->get_download_display_details( $download, $wp_plugins );
383 383
 
384
-        $download_info = $details['download_info'];
384
+		$download_info = $details['download_info'];
385 385
 
386 386
 		?>
387 387
         <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
@@ -405,45 +405,45 @@  discard block
 block discarded – undo
405 405
 
406 406
                 <div class="addon-excerpt"><?php
407 407
 
408
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
408
+					$excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
409 409
 
410
-                    // Allow some pure HTML tags, but remove everything else from the excerpt.
411
-                    $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
412
-                    $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
410
+					// Allow some pure HTML tags, but remove everything else from the excerpt.
411
+					$tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
412
+					$replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
413 413
 
414
-                    $excerpt = str_replace( $tags, $replacements, $excerpt );
415
-                    $excerpt = esc_html( strip_tags( $excerpt ) );
414
+					$excerpt = str_replace( $tags, $replacements, $excerpt );
415
+					$excerpt = esc_html( strip_tags( $excerpt ) );
416 416
 					$excerpt = str_replace( $replacements, $tags, $excerpt );
417 417
 
418 418
 					echo wpautop( $excerpt );
419
-                ?></div>
419
+				?></div>
420 420
             </div>
421 421
         </div>
422 422
 		<?php
423 423
 	}
424 424
 
425 425
 	/**
426
-     * Generates details array for the download to keep the render_download() method a bit tidier
427
-     *
426
+	 * Generates details array for the download to keep the render_download() method a bit tidier
427
+	 *
428 428
 	 * @since 2.10 Allow managing installed add-ons whether or not the user's license shows they have access.
429 429
 	 *
430 430
 	 * @param array $download Single download, as returned by {@see get_downloads_data}
431 431
 	 * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()}
432 432
 	 *
433 433
 	 * @return array {
434
-     *   @type array $download_info
435
-     *   @type string $plugin_path
436
-     *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
437
-     *   @type string $status_label
438
-     *   @type string $button_title Title attribute to show when hovering over the download's button
439
-     *   @type string $button_class CSS class to use for the button
440
-     *   @type string $button_label Text to use for the download's anchor link
441
-     *   @type string $href URL for the download's button
442
-     *   @type bool   $spinner Whether to show the spinner icon
443
-     *   @type string $item_class CSS class for the download container
444
-     *   @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions")
445
-     *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
446
-     * }
434
+	 *   @type array $download_info
435
+	 *   @type string $plugin_path
436
+	 *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
437
+	 *   @type string $status_label
438
+	 *   @type string $button_title Title attribute to show when hovering over the download's button
439
+	 *   @type string $button_class CSS class to use for the button
440
+	 *   @type string $button_label Text to use for the download's anchor link
441
+	 *   @type string $href URL for the download's button
442
+	 *   @type bool   $spinner Whether to show the spinner icon
443
+	 *   @type string $item_class CSS class for the download container
444
+	 *   @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions")
445
+	 *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
446
+	 * }
447 447
 	 */
448 448
 	private function get_download_display_details( $download, $wp_plugins ) {
449 449
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 			'slug' => '',
455 455
 			'excerpt' => '',
456 456
 			'link' => '',
457
-            'coming_soon' => false,
457
+			'coming_soon' => false,
458 458
 			'installer_title' => null, // May not be defined
459 459
 			'installer_excerpt' => null, // May not be defined
460 460
 		) );
@@ -496,14 +496,14 @@  discard block
 block discarded – undo
496 496
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
497 497
 		}
498 498
 
499
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
500
-	        $spinner      = false;
501
-	        $status       = 'notinstalled';
502
-	        $status_label = __( 'Coming Soon', 'gravityview' );
503
-	        $button_label = __( 'Learn More', 'gravityview' );
504
-	        $button_class = 'button-primary button-large';
505
-	        $href         = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' );
506
-        }
499
+		elseif ( ! empty( $download_info['coming_soon'] ) ) {
500
+			$spinner      = false;
501
+			$status       = 'notinstalled';
502
+			$status_label = __( 'Coming Soon', 'gravityview' );
503
+			$button_label = __( 'Learn More', 'gravityview' );
504
+			$button_class = 'button-primary button-large';
505
+			$href         = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' );
506
+		}
507 507
 
508 508
 		// Access but the plugin is not installed
509 509
 		elseif ( ! $wp_plugin ) {
@@ -547,18 +547,18 @@  discard block
 block discarded – undo
547 547
 		$download_info['link'] = add_query_arg( array( 'license_key' => $license_key ), $download_info['link'] );
548 548
 
549 549
 		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
550
-    }
550
+	}
551 551
 
552 552
 	/**
553
-     * Returns the base price for an extension
554
-     *
553
+	 * Returns the base price for an extension
554
+	 *
555 555
 	 * @param array $download
556 556
 	 *
557 557
 	 * @return float Base price for an extension. If not for sale separately, returns 0
558 558
 	 */
559 559
 	private function get_download_base_price( $download ) {
560 560
 
561
-	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
561
+		$base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
562 562
 		$base_price = \GFCommon::to_number( $base_price );
563 563
 
564 564
 		unset( $download['pricing']['amount'] );
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 		}
570 570
 
571 571
 		return floatval( $base_price );
572
-    }
572
+	}
573 573
 
574 574
 	/**
575 575
 	 * Handle AJAX request to activate extension
@@ -587,8 +587,8 @@  discard block
 block discarded – undo
587 587
 
588 588
 		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
589 589
 			wp_send_json_error( array(
590
-                'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
591
-            ) );
590
+				'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
591
+			) );
592 592
 		}
593 593
 
594 594
 		wp_send_json_success();
@@ -609,10 +609,10 @@  discard block
 block discarded – undo
609 609
 		deactivate_plugins( $data['path'] );
610 610
 
611 611
 		if( is_plugin_active( $data['path'] ) ) {
612
-            wp_send_json_error( array(
613
-                'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
614
-            ) );
615
-        }
612
+			wp_send_json_error( array(
613
+				'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
614
+			) );
615
+		}
616 616
 
617 617
 		wp_send_json_success();
618 618
 	}
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 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,9 +324,9 @@  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(  'friends', esc_html__( 'Friends of GravityView', 'gravityview' ), $downloads_data, $wp_plugins );
329
+				$this->render_section( 'friends', esc_html__( 'Friends of GravityView', 'gravityview' ), $downloads_data, $wp_plugins );
330 330
 				?>
331 331
             </div>
332 332
         </div>
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 				continue;
354 354
 			}
355 355
 
356
-			if ( empty( $download['info'] ) ) {
356
+			if ( empty( $download[ 'info' ] ) ) {
357 357
 				continue;
358 358
 			}
359 359
 
@@ -381,31 +381,31 @@  discard block
 block discarded – undo
381 381
 
382 382
         $details = $this->get_download_display_details( $download, $wp_plugins );
383 383
 
384
-        $download_info = $details['download_info'];
384
+        $download_info = $details[ 'download_info' ];
385 385
 
386 386
 		?>
387
-        <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
387
+        <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>">
388 388
             <div class="addon-inner">
389
-                <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>
390
-                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3>
389
+                <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>
390
+                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3>
391 391
                 <div>
392
-                    <?php if( ! empty( $details['status_label'] ) ) { ?>
393
-                    <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>">
394
-                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span>
392
+                    <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?>
393
+                    <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>">
394
+                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span>
395 395
                     </div>
396 396
 			        <?php } ?>
397 397
 
398
-					<?php if ( 'gravityview' !== $download_info['slug'] ) { ?>
399
-                    <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'] ); ?>">
400
-                        <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span>
401
-                        <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?>
398
+					<?php if ( 'gravityview' !== $download_info[ 'slug' ] ) { ?>
399
+                    <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' ] ); ?>">
400
+                        <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span>
401
+                        <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?>
402 402
                     </a>
403 403
 					<?php } ?>
404 404
                 </div>
405 405
 
406 406
                 <div class="addon-excerpt"><?php
407 407
 
408
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
408
+                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] );
409 409
 
410 410
                     // Allow some pure HTML tags, but remove everything else from the excerpt.
411 411
                     $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	private function get_download_display_details( $download, $wp_plugins ) {
449 449
 
450
-		$download_info = wp_parse_args( (array) $download['info'], array(
450
+		$download_info = wp_parse_args( (array)$download[ 'info' ], array(
451 451
 			'thumbnail' => '',
452 452
 			'title' => '',
453 453
 			'textdomain' => '',
@@ -459,9 +459,9 @@  discard block
 block discarded – undo
459 459
 			'installer_excerpt' => null, // May not be defined
460 460
 		) );
461 461
 
462
-		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false );
462
+		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false );
463 463
 
464
-		$has_access = ! empty( $download['files'] );
464
+		$has_access = ! empty( $download[ 'files' ] );
465 465
 		$spinner = true;
466 466
 		$href = $plugin_path = '#';
467 467
 		$status = $item_class = $button_title = $button_class = '';
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 		$required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' );
472 472
 
473 473
 		// The license is not active - no matter what level, this should not work
474
-		if( ! $is_active  && empty( $base_price ) ) {
474
+		if ( ! $is_active && empty( $base_price ) ) {
475 475
 			$spinner      = false;
476 476
 			$status_label = '';
477 477
 			$button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license );
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 			$status_label = '';
484 484
 			$button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price );
485 485
 			$button_class = 'button-primary button-large';
486
-			$href         = $download_info['link'];
486
+			$href         = $download_info[ 'link' ];
487 487
 			$item_class   = 'featured';
488 488
 		}
489 489
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
497 497
 		}
498 498
 
499
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
499
+        elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) {
500 500
 	        $spinner      = false;
501 501
 	        $status       = 'notinstalled';
502 502
 	        $status_label = __( 'Coming Soon', 'gravityview' );
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
 			$href = add_query_arg(
512 512
 				array(
513 513
 					'action'   => 'install-plugin',
514
-					'plugin'   => $download_info['slug'],
515
-					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ),
514
+					'plugin'   => $download_info[ 'slug' ],
515
+					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ),
516 516
 				),
517 517
 				self_admin_url( 'update.php' )
518 518
 			);
@@ -528,11 +528,11 @@  discard block
 block discarded – undo
528 528
 			$status = 'inactive';
529 529
 			$status_label = __( 'Inactive', 'gravityview' );
530 530
 			$button_label = __( 'Activate', 'gravityview' );
531
-			$plugin_path = $wp_plugin['path'];
531
+			$plugin_path = $wp_plugin[ 'path' ];
532 532
 		}
533 533
 		// The plugin is installed and active
534
-		elseif ( ! empty( $wp_plugin['path'] ) ) {
535
-			$plugin_path = $wp_plugin['path'];
534
+		elseif ( ! empty( $wp_plugin[ 'path' ] ) ) {
535
+			$plugin_path = $wp_plugin[ 'path' ];
536 536
 			$status = 'active';
537 537
 			$status_label = __( 'Active', 'gravityview' );
538 538
 			$button_label = __( 'Deactivate', 'gravityview' );
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
 			$href = add_query_arg( array( 'license_key' => $license_key ), $href );
545 545
 		}
546 546
 
547
-		$download_info['link'] = add_query_arg( array( 'license_key' => $license_key ), $download_info['link'] );
547
+		$download_info[ 'link' ] = add_query_arg( array( 'license_key' => $license_key ), $download_info[ 'link' ] );
548 548
 
549
-		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
549
+		return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
550 550
     }
551 551
 
552 552
 	/**
@@ -561,11 +561,11 @@  discard block
 block discarded – undo
561 561
 	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
562 562
 		$base_price = \GFCommon::to_number( $base_price );
563 563
 
564
-		unset( $download['pricing']['amount'] );
564
+		unset( $download[ 'pricing' ][ 'amount' ] );
565 565
 
566 566
 		// Price options array, not single price
567
-		if ( ! $base_price && ! empty( $download['pricing'] ) ) {
568
-			$base_price = array_shift( $download['pricing'] );
567
+		if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) {
568
+			$base_price = array_shift( $download[ 'pricing' ] );
569 569
 		}
570 570
 
571 571
 		return floatval( $base_price );
@@ -579,13 +579,13 @@  discard block
 block discarded – undo
579 579
 	public function activate_download() {
580 580
 		$data = \GV\Utils::_POST( 'data', array() );
581 581
 
582
-		if ( empty( $data['path'] ) ) {
582
+		if ( empty( $data[ 'path' ] ) ) {
583 583
 			return;
584 584
 		}
585 585
 
586
-		$result = activate_plugin( $data['path'] );
586
+		$result = activate_plugin( $data[ 'path' ] );
587 587
 
588
-		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
588
+		if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) {
589 589
 			wp_send_json_error( array(
590 590
                 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
591 591
             ) );
@@ -602,13 +602,13 @@  discard block
 block discarded – undo
602 602
 	public function deactivate_download() {
603 603
 		$data = \GV\Utils::_POST( 'data', array() );
604 604
 
605
-		if ( empty( $data['path'] ) ) {
605
+		if ( empty( $data[ 'path' ] ) ) {
606 606
 			return;
607 607
 		}
608 608
 
609
-		deactivate_plugins( $data['path'] );
609
+		deactivate_plugins( $data[ 'path' ] );
610 610
 
611
-		if( is_plugin_active( $data['path'] ) ) {
611
+		if ( is_plugin_active( $data[ 'path' ] ) ) {
612 612
             wp_send_json_error( array(
613 613
                 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
614 614
             ) );
Please login to merge, or discard this patch.