Completed
Push — develop ( dae086...f9d8a0 )
by Zack
18:24
created
includes/class-admin-installer.php 2 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function add_admin_menu() {
97 97
 
98
-	    $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
98
+		$menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
99 99
 
100 100
 		$menu_text = sprintf( '<span title="%s">%s</span>', esc_attr__( 'Plugins that extend GravityView and Gravity Forms functionality.', 'gravityview' ), $menu_text );
101 101
 
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	/**
113
-     * When on the Installer page, show a different notice than on the Settings page
114
-     *
113
+	 * When on the Installer page, show a different notice than on the Settings page
114
+	 *
115 115
 	 * @param array $notice
116 116
 	 *
117 117
 	 * @return string License notice
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 	public function maybe_modify_license_notice( $notice = '' ) {
120 120
 
121 121
 		if ( ! gravityview()->request->is_admin( '', 'downloads' ) ) {
122
-            return $notice;
123
-        }
122
+			return $notice;
123
+		}
124 124
 
125
-        return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' );
125
+		return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' );
126 126
 	}
127 127
 
128 128
 	/**
@@ -160,43 +160,43 @@  discard block
 block discarded – undo
160 160
 	 * Get downloads data from transient or from API; save transient after getting data from API
161 161
 	 *
162 162
 	 * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: {
163
-     *   @type array  $info {
164
-     *       @type string $id int 17
165
-     *       @type string $slug Extension slug
166
-     *       @type string $title Extension title
167
-     *       @type string $create_date in '2018-07-19 20:03:10' format
168
-     *       @type string $modified_date
169
-     *       @type string $status
170
-     *       @type string $link URL to public plugin page
171
-     *       @type string $content
172
-     *       @type string $excerpt
173
-     *       @type string $thumbnail URL to thumbnail
174
-     *       @type array  $category Taxonomy details for the plugin's category {
175
-     *         @type int $term_id => int 30
176
-     *         @type string $name => string 'Plugins' (length=7)
177
-     *         @type string $slug => string 'plugins' (length=7)
178
-     *         @type int $term_group => int 0
179
-     *         @type int $term_taxonomy_id => int 30
180
-     *         @type string $taxonomy => string 'download_category' (length=17)
181
-     *         @type string $description => string '' (length=0)
182
-     *         @type int $parent => int 0
183
-     *         @type int $count => int 4
184
-     *         @type string $filter => string 'raw' (length=3)
185
-     *       }
186
-     *       @type array $tags {see $category above}
187
-     *       @type string $textdomain string 'gravityview' (length=11)
188
-     *   }
189
-     *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
190
-     *   @type array $licensing {
191
-     *       @type bool   $enabled Is licensing enabled for the extension
192
-     *       @type string $version Version number
193
-     *       @type string $exp_unit Expiration unit ('years')
194
-     *       @type string $exp_length Expiration length ('1')
195
-     *   }
196
-     *   @type array $files Array of files. Empty if user has no access to the file. {
197
-     *       @type string $file string URL of the file download
198
-     *   }
199
-     * }
163
+	 *   @type array  $info {
164
+	 *       @type string $id int 17
165
+	 *       @type string $slug Extension slug
166
+	 *       @type string $title Extension title
167
+	 *       @type string $create_date in '2018-07-19 20:03:10' format
168
+	 *       @type string $modified_date
169
+	 *       @type string $status
170
+	 *       @type string $link URL to public plugin page
171
+	 *       @type string $content
172
+	 *       @type string $excerpt
173
+	 *       @type string $thumbnail URL to thumbnail
174
+	 *       @type array  $category Taxonomy details for the plugin's category {
175
+	 *         @type int $term_id => int 30
176
+	 *         @type string $name => string 'Plugins' (length=7)
177
+	 *         @type string $slug => string 'plugins' (length=7)
178
+	 *         @type int $term_group => int 0
179
+	 *         @type int $term_taxonomy_id => int 30
180
+	 *         @type string $taxonomy => string 'download_category' (length=17)
181
+	 *         @type string $description => string '' (length=0)
182
+	 *         @type int $parent => int 0
183
+	 *         @type int $count => int 4
184
+	 *         @type string $filter => string 'raw' (length=3)
185
+	 *       }
186
+	 *       @type array $tags {see $category above}
187
+	 *       @type string $textdomain string 'gravityview' (length=11)
188
+	 *   }
189
+	 *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
190
+	 *   @type array $licensing {
191
+	 *       @type bool   $enabled Is licensing enabled for the extension
192
+	 *       @type string $version Version number
193
+	 *       @type string $exp_unit Expiration unit ('years')
194
+	 *       @type string $exp_length Expiration length ('1')
195
+	 *   }
196
+	 *   @type array $files Array of files. Empty if user has no access to the file. {
197
+	 *       @type string $file string URL of the file download
198
+	 *   }
199
+	 * }
200 200
 	 */
201 201
 	public function get_downloads_data() {
202 202
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		) );
225 225
 
226 226
 		if ( is_wp_error( $response ) ) {
227
-		    gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
227
+			gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
228 228
 			return $response;
229 229
 		}
230 230
 
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
                 <div class="gv-admin-installer-notice notice inline error">
278 278
                     <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3>
279 279
                     <?php
280
-                    if ( is_wp_error( $downloads_data ) ) {
281
-	                    echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
282
-                    }
283
-                    ?>
280
+					if ( is_wp_error( $downloads_data ) ) {
281
+						echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
282
+					}
283
+					?>
284 284
                 </div>
285 285
             </div>
286 286
 			<?php
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
 	protected function render_download( $download, $wp_plugins ) {
337 337
 
338 338
 
339
-        $details = $this->get_download_display_details( $download, $wp_plugins );
339
+		$details = $this->get_download_display_details( $download, $wp_plugins );
340 340
 
341
-        $download_info = $details['download_info'];
341
+		$download_info = $details['download_info'];
342 342
 
343 343
 		?>
344 344
         <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
@@ -360,43 +360,43 @@  discard block
 block discarded – undo
360 360
 
361 361
                 <div class="addon-excerpt"><?php
362 362
 
363
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
363
+					$excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
364 364
 
365
-                    // Allow some pure HTML tags, but remove everything else from the excerpt.
366
-                    $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
367
-                    $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
365
+					// Allow some pure HTML tags, but remove everything else from the excerpt.
366
+					$tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
367
+					$replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
368 368
 
369
-                    $excerpt = str_replace( $tags, $replacements, $excerpt );
370
-                    $excerpt = esc_html( strip_tags( $excerpt ) );
369
+					$excerpt = str_replace( $tags, $replacements, $excerpt );
370
+					$excerpt = esc_html( strip_tags( $excerpt ) );
371 371
 					$excerpt = str_replace( $replacements, $tags, $excerpt );
372 372
 
373 373
 					echo wpautop( $excerpt );
374
-                ?></div>
374
+				?></div>
375 375
             </div>
376 376
         </div>
377 377
 		<?php
378 378
 	}
379 379
 
380 380
 	/**
381
-     * Generates details array for the download to keep the render_download() method a bit tidier
382
-     *
381
+	 * Generates details array for the download to keep the render_download() method a bit tidier
382
+	 *
383 383
 	 * @param array $download Single download, as returned by {@see get_downloads_data}
384 384
 	 * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()}
385 385
 	 *
386 386
 	 * @return array {
387
-     *   @type array $download_info
388
-     *   @type string $plugin_path
389
-     *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
390
-     *   @type string $status_label
391
-     *   @type string $button_title Title attribute to show when hovering over the download's button
392
-     *   @type string $button_class CSS class to use for the button
393
-     *   @type string $button_label Text to use for the download's anchor link
394
-     *   @type string $href URL for the download's button
395
-     *   @type bool   $spinner Whether to show the spinner icon
396
-     *   @type string $item_class CSS class for the download container
397
-     *   @type string $required_license The name of the required license for the download ("Galactic" or "Interstellar")
398
-     *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
399
-     * }
387
+	 *   @type array $download_info
388
+	 *   @type string $plugin_path
389
+	 *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
390
+	 *   @type string $status_label
391
+	 *   @type string $button_title Title attribute to show when hovering over the download's button
392
+	 *   @type string $button_class CSS class to use for the button
393
+	 *   @type string $button_label Text to use for the download's anchor link
394
+	 *   @type string $href URL for the download's button
395
+	 *   @type bool   $spinner Whether to show the spinner icon
396
+	 *   @type string $item_class CSS class for the download container
397
+	 *   @type string $required_license The name of the required license for the download ("Galactic" or "Interstellar")
398
+	 *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
399
+	 * }
400 400
 	 */
401 401
 	private function get_download_display_details( $download, $wp_plugins ) {
402 402
 
@@ -487,18 +487,18 @@  discard block
 block discarded – undo
487 487
 		}
488 488
 
489 489
 		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
490
-    }
490
+	}
491 491
 
492 492
 	/**
493
-     * Returns the base price for an extension
494
-     *
493
+	 * Returns the base price for an extension
494
+	 *
495 495
 	 * @param array $download
496 496
 	 *
497 497
 	 * @return float Base price for an extension. If not for sale separately, returns 0
498 498
 	 */
499 499
 	private function get_download_base_price( $download ) {
500 500
 
501
-	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
501
+		$base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
502 502
 		$base_price = \GFCommon::to_number( $base_price );
503 503
 
504 504
 		unset( $download['pricing']['amount'] );
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 		}
510 510
 
511 511
 		return floatval( $base_price );
512
-    }
512
+	}
513 513
 
514 514
 	/**
515 515
 	 * Handle AJAX request to activate extension
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 
528 528
 		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
529 529
 			wp_send_json_error( array(
530
-                'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
531
-            ) );
530
+				'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
531
+			) );
532 532
 		}
533 533
 
534 534
 		wp_send_json_success();
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
 		deactivate_plugins( $data['path'] );
550 550
 
551 551
 		if( is_plugin_active( $data['path'] ) ) {
552
-            wp_send_json_error( array(
553
-                'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
554
-            ) );
555
-        }
552
+			wp_send_json_error( array(
553
+				'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
554
+			) );
555
+		}
556 556
 
557 557
 		wp_send_json_success();
558 558
 	}
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 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
 	}
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
 			return;
71 71
 		}
72 72
 
73
-		add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) {
73
+		add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) {
74 74
 			foreach ( $downloads_data as $extension ) {
75
-				if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) {
75
+				if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) {
76 76
 					continue;
77 77
 				}
78 78
 
79
-				return (object) array(
80
-					'slug'          => $extension['info']['slug'],
81
-					'name'          => $extension['info']['title'],
82
-					'version'       => $extension['licensing']['version'],
83
-					'download_link' => $extension['files'][0]['file'],
79
+				return (object)array(
80
+					'slug'          => $extension[ 'info' ][ 'slug' ],
81
+					'name'          => $extension[ 'info' ][ 'title' ],
82
+					'version'       => $extension[ 'licensing' ][ 'version' ],
83
+					'download_link' => $extension[ 'files' ][ 0 ][ 'file' ],
84 84
 				);
85 85
 			}
86 86
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 
143 143
 		foreach ( $all_plugins as $path => $plugin ) {
144 144
 
145
-			if ( empty( $plugin['TextDomain'] ) ) {
145
+			if ( empty( $plugin[ 'TextDomain' ] ) ) {
146 146
 				continue;
147 147
 			}
148 148
 
149
-			$wp_plugins[ $plugin['TextDomain'] ] = array(
149
+			$wp_plugins[ $plugin[ 'TextDomain' ] ] = array(
150 150
 				'path'      => $path,
151
-				'version'   => $plugin['Version'],
151
+				'version'   => $plugin[ 'Version' ],
152 152
 				'activated' => is_plugin_active( $path )
153 153
 			);
154 154
 		}
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 
231 231
 		$downloads_data = json_decode( wp_remote_retrieve_body( $response ), true );
232 232
 
233
-		if ( empty( $downloads_data['products'] ) ) {
233
+		if ( empty( $downloads_data[ 'products' ] ) ) {
234 234
 			return array();
235 235
 		}
236 236
 
237
-		$this->set_downloads_data( $downloads_data['products'] );
237
+		$this->set_downloads_data( $downloads_data[ 'products' ] );
238 238
 
239
-		return $downloads_data['products'];
239
+		return $downloads_data[ 'products' ];
240 240
 	}
241 241
 
242 242
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
 				foreach ( $downloads_data as $extension ) {
311 311
 
312
-					if ( empty( $extension['info'] ) ) {
312
+					if ( empty( $extension[ 'info' ] ) ) {
313 313
 						continue;
314 314
 					}
315 315
 
@@ -338,29 +338,29 @@  discard block
 block discarded – undo
338 338
 
339 339
         $details = $this->get_download_display_details( $download, $wp_plugins );
340 340
 
341
-        $download_info = $details['download_info'];
341
+        $download_info = $details[ 'download_info' ];
342 342
 
343 343
 		?>
344
-        <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
344
+        <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>">
345 345
             <div class="addon-inner">
346
-                <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>
347
-                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3>
346
+                <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>
347
+                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3>
348 348
                 <div>
349
-                    <?php if( $details['status_label'] ) { ?>
350
-                    <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>">
351
-                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span>
349
+                    <?php if ( $details[ 'status_label' ] ) { ?>
350
+                    <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>">
351
+                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span>
352 352
                     </div>
353 353
 			        <?php } ?>
354 354
 
355
-                    <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'] ); ?>">
356
-                        <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span>
357
-                        <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?>
355
+                    <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' ] ); ?>">
356
+                        <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span>
357
+                        <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?>
358 358
                     </a>
359 359
                 </div>
360 360
 
361 361
                 <div class="addon-excerpt"><?php
362 362
 
363
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
363
+                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] );
364 364
 
365 365
                     // Allow some pure HTML tags, but remove everything else from the excerpt.
366 366
                     $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	 */
401 401
 	private function get_download_display_details( $download, $wp_plugins ) {
402 402
 
403
-		$download_info = wp_parse_args( (array) $download['info'], array(
403
+		$download_info = wp_parse_args( (array)$download[ 'info' ], array(
404 404
 			'thumbnail' => '',
405 405
 			'title' => '',
406 406
 			'textdomain' => '',
@@ -411,9 +411,9 @@  discard block
 block discarded – undo
411 411
 			'installer_excerpt' => null, // May not be defined
412 412
 		) );
413 413
 
414
-		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false );
414
+		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false );
415 415
 
416
-		$has_access = ! empty( $download['files'] );
416
+		$has_access = ! empty( $download[ 'files' ] );
417 417
 		$spinner = true;
418 418
 		$href = $plugin_path = '#';
419 419
 		$status = $item_class = $button_title = $button_class = '';
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 		$required_license = $galactic_only ? __( 'Galactic', 'gravityview' ) : __( 'Interstellar', 'gravityview' );
424 424
 
425 425
 		// The license is not active - no matter what level, this should not work
426
-		if( ! $is_active  && empty( $base_price ) ) {
426
+		if ( ! $is_active && empty( $base_price ) ) {
427 427
 			$spinner      = false;
428 428
 			$button_class = 'disabled disabled-license';
429 429
 			$button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license );
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 			$status_label = '';
436 436
 			$button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price );
437 437
 			$button_class = 'button-primary button-large';
438
-			$href         = $download_info['link'];
438
+			$href         = $download_info[ 'link' ];
439 439
 			$item_class   = 'featured';
440 440
 		}
441 441
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 			$href = add_query_arg(
455 455
 				array(
456 456
 					'action'   => 'install-plugin',
457
-					'plugin'   => $download_info['slug'],
458
-					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ),
457
+					'plugin'   => $download_info[ 'slug' ],
458
+					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ),
459 459
 				),
460 460
 				self_admin_url( 'update.php' )
461 461
 			);
@@ -467,26 +467,26 @@  discard block
 block discarded – undo
467 467
 		}
468 468
 
469 469
 		// Access and the plugin is installed but not active
470
-		else if ( false === $wp_plugin['activated'] ) {
470
+		else if ( false === $wp_plugin[ 'activated' ] ) {
471 471
 
472 472
 			$status = 'inactive';
473 473
 			$status_label = __( 'Inactive', 'gravityview' );
474 474
 			$button_label = __( 'Activate', 'gravityview' );
475
-			$plugin_path = $wp_plugin['path'];
475
+			$plugin_path = $wp_plugin[ 'path' ];
476 476
 
477 477
 		}
478 478
 
479 479
 		// Access and the plugin is installed and active
480 480
 		else {
481 481
 
482
-			$plugin_path = $wp_plugin['path'];
482
+			$plugin_path = $wp_plugin[ 'path' ];
483 483
 			$status = 'active';
484 484
 			$status_label = __( 'Active', 'gravityview' );
485 485
 			$button_label = __( 'Deactivate', 'gravityview' );
486 486
 
487 487
 		}
488 488
 
489
-		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
489
+		return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
490 490
     }
491 491
 
492 492
 	/**
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
 	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
502 502
 		$base_price = \GFCommon::to_number( $base_price );
503 503
 
504
-		unset( $download['pricing']['amount'] );
504
+		unset( $download[ 'pricing' ][ 'amount' ] );
505 505
 
506 506
 		// Price options array, not single price
507
-		if ( ! $base_price && ! empty( $download['pricing'] ) ) {
508
-			$base_price = array_shift( $download['pricing'] );
507
+		if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) {
508
+			$base_price = array_shift( $download[ 'pricing' ] );
509 509
 		}
510 510
 
511 511
 		return floatval( $base_price );
@@ -519,13 +519,13 @@  discard block
 block discarded – undo
519 519
 	public function activate_download() {
520 520
 		$data = \GV\Utils::_POST( 'data', array() );
521 521
 
522
-		if ( empty( $data['path'] ) ) {
522
+		if ( empty( $data[ 'path' ] ) ) {
523 523
 			return;
524 524
 		}
525 525
 
526
-		$result = activate_plugin( $data['path'] );
526
+		$result = activate_plugin( $data[ 'path' ] );
527 527
 
528
-		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
528
+		if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) {
529 529
 			wp_send_json_error( array(
530 530
                 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
531 531
             ) );
@@ -542,13 +542,13 @@  discard block
 block discarded – undo
542 542
 	public function deactivate_download() {
543 543
 		$data = \GV\Utils::_POST( 'data', array() );
544 544
 
545
-		if ( empty( $data['path'] ) ) {
545
+		if ( empty( $data[ 'path' ] ) ) {
546 546
 			return;
547 547
 		}
548 548
 
549
-		deactivate_plugins( $data['path'] );
549
+		deactivate_plugins( $data[ 'path' ] );
550 550
 
551
-		if( is_plugin_active( $data['path'] ) ) {
551
+		if ( is_plugin_active( $data[ 'path' ] ) ) {
552 552
             wp_send_json_error( array(
553 553
                 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
554 554
             ) );
Please login to merge, or discard this patch.