Completed
Push — develop ( aa0816...918969 )
by Zack
06:41
created
future/includes/class-gv-settings-addon.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @return array
103 103
 	 */
104 104
 	public function modify_app_settings_menu_title( $setting_tabs ) {
105
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' );
105
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
106 106
 		return $setting_tabs;
107 107
 	}
108 108
 
@@ -308,15 +308,15 @@  discard block
 block discarded – undo
308 308
             </ul>
309 309
             <div class="gv-followup widefat">
310 310
                 <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p>
311
-                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea>
311
+                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea>
312 312
             </div>
313 313
             <div class="scale-description">
314 314
                 <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p>
315 315
                 <ul class="inline">
316 316
 					<?php
317 317
 					$i = 0;
318
-					while( $i < 11 ) {
319
-						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>';
318
+					while ( $i < 11 ) {
319
+						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
320 320
 						$i++;
321 321
 					}
322 322
 					?>
@@ -538,15 +538,15 @@  discard block
 block discarded – undo
538 538
 	 * @return string The HTML
539 539
 	 */
540 540
 	public function as_html( $field, $echo = true ) {
541
-		$field['type']  = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit';
541
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
542 542
 
543 543
 		$attributes    = $this->get_field_attributes( $field );
544 544
 		$default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) );
545
-		$value         = $this->get( $field['name'], $default_value );
545
+		$value         = $this->get( $field[ 'name' ], $default_value );
546 546
 
547 547
 
548
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton';
549
-		$name    = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name'];
548
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton';
549
+		$name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
550 550
 
551 551
 		if ( empty( $value ) ) {
552 552
 			$value = __( 'Update Settings', 'gravityview' );
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 		$attributes = $this->get_field_attributes( $field );
556 556
 
557 557
 		$html = '<input
558
-                    type="' . $field['type'] . '"
558
+                    type="' . $field[ 'type' ] . '"
559 559
                     name="' . esc_attr( $name ) . '"
560 560
                     value="' . $value . '" ' .
561 561
 		        implode( ' ', $attributes ) .
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 	 * @return bool
587 587
 	 */
588 588
 	public function is_save_postback() {
589
-		return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] );
589
+		return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] );
590 590
 	}
591 591
 
592 592
 	/**
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	 */
597 597
 	public function license_key_notice() {
598 598
 
599
-	    if( $this->is_save_postback() ) {
599
+	    if ( $this->is_save_postback() ) {
600 600
 		    $settings = $this->get_posted_settings();
601 601
 		    $license_key = \GV\Utils::get( $settings, 'license_key' );
602 602
 		    $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 		 * but didn't want to mess up the translation strings for the translators.
618 618
 		 */
619 619
 		$message = mb_substr( $message, 0, mb_strlen( $message ) - 1 );
620
-		$title = __( 'Inactive License', 'gravityview');
620
+		$title = __( 'Inactive License', 'gravityview' );
621 621
 		$status = '';
622 622
 		$update_below = false;
623 623
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 				$update_below = __( 'Activate your license key below.', 'gravityview' );
648 648
 				break;
649 649
 		}
650
-		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice';
650
+		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice';
651 651
 
652 652
 		// Show a different notice on settings page for inactive licenses (hide the buttons)
653 653
 		if ( $update_below && gravityview()->request->is_admin( '', 'settings' ) ) {
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	public function scripts() {
692 692
 		$scripts = parent::scripts();
693 693
 
694
-		$scripts[] = array(
694
+		$scripts[ ] = array(
695 695
 			'handle'  => 'gform_tooltip_init',
696 696
 			'enqueue' => array(
697 697
                 array(
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	public function styles() {
711 711
 		$styles = parent::styles();
712 712
 
713
-		$styles[] = array(
713
+		$styles[ ] = array(
714 714
 			'handle'  => 'gravityview_settings',
715 715
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
716 716
 			'version' => Plugin::$version,
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 		 * If multisite and not network admin, we don't want the settings to show.
742 742
 		 * @since 1.7.6
743 743
 		 */
744
-		$show_submenu = ( ! is_multisite() ) ||  is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
744
+		$show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
745 745
 
746 746
 		/**
747 747
 		 * Override whether to show the Settings menu on a per-blog basis.
@@ -789,26 +789,26 @@  discard block
 block discarded – undo
789 789
 				'label' => __( 'License Key', 'gravityview' ),
790 790
 				'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ),
791 791
 				'type' => 'edd_license',
792
-				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' )  && GRAVITYVIEW_LICENSE_KEY ),
792
+				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ),
793 793
 				'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
794
-				'default_value' => $default_settings['license_key'],
794
+				'default_value' => $default_settings[ 'license_key' ],
795 795
 				'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
796 796
 			),
797 797
 			array(
798 798
 				'name' => 'license_key_response',
799
-				'default_value' => $default_settings['license_key_response'],
799
+				'default_value' => $default_settings[ 'license_key_response' ],
800 800
 				'type' => 'hidden',
801 801
 			),
802 802
 			array(
803 803
 				'name' => 'license_key_status',
804
-				'default_value' => $default_settings['license_key_status'],
804
+				'default_value' => $default_settings[ 'license_key_status' ],
805 805
 				'type' => 'hidden',
806 806
 			),
807 807
 			array(
808 808
 				'name' => 'support-email',
809 809
 				'type' => 'text',
810 810
 				'validate' => 'email',
811
-				'default_value' => $default_settings['support-email'],
811
+				'default_value' => $default_settings[ 'support-email' ],
812 812
 				'label' => __( 'Support Email', 'gravityview' ),
813 813
 				'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
814 814
 				'class' => 'code regular-text',
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 				'name' => 'support_port',
821 821
 				'type' => 'radio',
822 822
 				'label' => __( 'Show Support Port?', 'gravityview' ),
823
-				'default_value' => $default_settings['support_port'],
823
+				'default_value' => $default_settings[ 'support_port' ],
824 824
 				'horizontal' => 1,
825 825
 				'choices' => array(
826 826
 					array(
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 				'name' => 'no-conflict-mode',
840 840
 				'type' => 'radio',
841 841
 				'label' => __( 'No-Conflict Mode', 'gravityview' ),
842
-				'default_value' => $default_settings['no-conflict-mode'],
842
+				'default_value' => $default_settings[ 'no-conflict-mode' ],
843 843
 				'horizontal' => 1,
844 844
 				'choices' => array(
845 845
 					array(
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 					'name' => 'rest_api',
862 862
 					'type' => 'radio',
863 863
 					'label' => __( 'REST API', 'gravityview' ),
864
-					'default_value' => $default_settings['rest_api'],
864
+					'default_value' => $default_settings[ 'rest_api' ],
865 865
 					'horizontal' => 1,
866 866
 					'choices' => array(
867 867
 						array(
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 				'name' => 'beta',
881 881
 				'type' => 'checkbox',
882 882
 				'label' => __( 'Become a Beta Tester', 'gravityview' ),
883
-				'default_value' => $default_settings['beta'],
883
+				'default_value' => $default_settings[ 'beta' ],
884 884
 				'horizontal' => 1,
885 885
 				'choices' => array(
886 886
 					array(
@@ -913,17 +913,17 @@  discard block
 block discarded – undo
913 913
 		 * @since 1.7.4
914 914
 		 */
915 915
 		foreach ( $fields as &$field ) {
916
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' );
917
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' );
918
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' );
919
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' );
916
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' );
917
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' );
918
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' );
919
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' );
920 920
 
921 921
 			if ( $disabled_attribute ) {
922
-				$field['disabled']  = $disabled_attribute;
922
+				$field[ 'disabled' ] = $disabled_attribute;
923 923
 			}
924 924
 
925
-			if ( empty( $field['disabled'] ) ) {
926
-				unset( $field['disabled'] );
925
+			if ( empty( $field[ 'disabled' ] ) ) {
926
+				unset( $field[ 'disabled' ] );
927 927
             }
928 928
 		}
929 929
 
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
         );
942 942
 
943 943
 		if ( $disabled_attribute ) {
944
-			$button['disabled'] = $disabled_attribute;
944
+			$button[ 'disabled' ] = $disabled_attribute;
945 945
 		}
946 946
 
947 947
         /**
@@ -960,20 +960,20 @@  discard block
 block discarded – undo
960 960
 		// If there are extensions, add a section for them
961 961
 		if ( ! empty( $extension_sections ) ) {
962 962
 
963
-			if( $disabled_attribute ) {
963
+			if ( $disabled_attribute ) {
964 964
 				foreach ( $extension_sections as &$section ) {
965
-					foreach ( $section['fields'] as &$field ) {
966
-						$field['disabled'] = $disabled_attribute;
965
+					foreach ( $section[ 'fields' ] as &$field ) {
966
+						$field[ 'disabled' ] = $disabled_attribute;
967 967
 					}
968 968
 				}
969 969
 			}
970 970
 
971
-            $k = count( $extension_sections ) - 1 ;
972
-            $extension_sections[ $k ]['fields'][] = $button;
971
+            $k = count( $extension_sections ) - 1;
972
+            $extension_sections[ $k ][ 'fields' ][ ] = $button;
973 973
 			$sections = array_merge( $sections, $extension_sections );
974 974
 		} else {
975 975
             // add the 'update settings' button to the general section
976
-            $sections[0]['fields'][] = $button;
976
+            $sections[ 0 ][ 'fields' ][ ] = $button;
977 977
         }
978 978
 
979 979
 		return $sections;
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 	protected function settings_edd_license( $field, $echo = true ) {
1030 1030
 
1031 1031
 	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1032
-		    $field['input_type'] = 'password';
1032
+		    $field[ 'input_type' ] = 'password';
1033 1033
         }
1034 1034
 
1035 1035
 		$text = $this->settings_text( $field, false );
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 	public function single_setting_row_html( $field ) {
1079 1079
 		?>
1080 1080
 
1081
-        <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
1081
+        <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>">
1082 1082
             <td colspan="2">
1083 1083
 				<?php $this->single_setting( $field ); ?>
1084 1084
             </td>
@@ -1096,10 +1096,10 @@  discard block
 block discarded – undo
1096 1096
 	 * @return string
1097 1097
 	 */
1098 1098
 	public function settings_save( $field, $echo = true ) {
1099
-		$field['type']  = 'submit';
1100
-		$field['name']  = 'gform-settings-save';
1101
-		$field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton';
1102
-		$field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1099
+		$field[ 'type' ]  = 'submit';
1100
+		$field[ 'name' ]  = 'gform-settings-save';
1101
+		$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton';
1102
+		$field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1103 1103
 
1104 1104
 		$output = $this->settings_submit( $field, false );
1105 1105
 
@@ -1130,8 +1130,8 @@  discard block
 block discarded – undo
1130 1130
      * @return void
1131 1131
 	 */
1132 1132
 	public function single_setting_row( $field ) {
1133
-		$field['gv_description'] = Utils::get( $field, 'description' );
1134
-		$field['description']    = Utils::get( $field, 'subtitle' );
1133
+		$field[ 'gv_description' ] = Utils::get( $field, 'description' );
1134
+		$field[ 'description' ]    = Utils::get( $field, 'subtitle' );
1135 1135
 		parent::single_setting_row( $field );
1136 1136
 	}
1137 1137
 
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
 	public function single_setting_label( $field ) {
1144 1144
 		parent::single_setting_label( $field );
1145 1145
 		if ( $description = Utils::get( $field, 'gv_description' ) ) {
1146
-			echo '<span class="description">'. $description .'</span>';
1146
+			echo '<span class="description">' . $description . '</span>';
1147 1147
 		}
1148 1148
 	}
1149 1149
 
@@ -1183,10 +1183,10 @@  discard block
 block discarded – undo
1183 1183
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
1184 1184
 		if ( ! $added_message && ( $local_key !== $response_key ) ) {
1185 1185
 
1186
-			unset( $posted_settings['license_key_response'] );
1187
-			unset( $posted_settings['license_key_status'] );
1186
+			unset( $posted_settings[ 'license_key_response' ] );
1187
+			unset( $posted_settings[ 'license_key_status' ] );
1188 1188
 
1189
-			\GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1189
+			\GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1190 1190
 
1191 1191
 			$added_message = true;
1192 1192
 		}
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( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
100
+		$menu_text = _x( 'Extensions', '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
 	/**
@@ -162,43 +162,43 @@  discard block
 block discarded – undo
162 162
 	 * Get downloads data from transient or from API; save transient after getting data from API
163 163
 	 *
164 164
 	 * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: {
165
-     *   @type array  $info {
166
-     *       @type string $id int 17
167
-     *       @type string $slug Extension slug
168
-     *       @type string $title Extension title
169
-     *       @type string $create_date in '2018-07-19 20:03:10' format
170
-     *       @type string $modified_date
171
-     *       @type string $status
172
-     *       @type string $link URL to public plugin page
173
-     *       @type string $content
174
-     *       @type string $excerpt
175
-     *       @type string $thumbnail URL to thumbnail
176
-     *       @type array  $category Taxonomy details for the plugin's category {
177
-     *         @type int $term_id => int 30
178
-     *         @type string $name => string 'Plugins' (length=7)
179
-     *         @type string $slug => string 'plugins' (length=7)
180
-     *         @type int $term_group => int 0
181
-     *         @type int $term_taxonomy_id => int 30
182
-     *         @type string $taxonomy => string 'download_category' (length=17)
183
-     *         @type string $description => string '' (length=0)
184
-     *         @type int $parent => int 0
185
-     *         @type int $count => int 4
186
-     *         @type string $filter => string 'raw' (length=3)
187
-     *       }
188
-     *       @type array $tags {see $category above}
189
-     *       @type string $textdomain string 'gravityview' (length=11)
190
-     *   }
191
-     *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
192
-     *   @type array $licensing {
193
-     *       @type bool   $enabled Is licensing enabled for the extension
194
-     *       @type string $version Version number
195
-     *       @type string $exp_unit Expiration unit ('years')
196
-     *       @type string $exp_length Expiration length ('1')
197
-     *   }
198
-     *   @type array $files Array of files. Empty if user has no access to the file. {
199
-     *       @type string $file string URL of the file download
200
-     *   }
201
-     * }
165
+	 *   @type array  $info {
166
+	 *       @type string $id int 17
167
+	 *       @type string $slug Extension slug
168
+	 *       @type string $title Extension title
169
+	 *       @type string $create_date in '2018-07-19 20:03:10' format
170
+	 *       @type string $modified_date
171
+	 *       @type string $status
172
+	 *       @type string $link URL to public plugin page
173
+	 *       @type string $content
174
+	 *       @type string $excerpt
175
+	 *       @type string $thumbnail URL to thumbnail
176
+	 *       @type array  $category Taxonomy details for the plugin's category {
177
+	 *         @type int $term_id => int 30
178
+	 *         @type string $name => string 'Plugins' (length=7)
179
+	 *         @type string $slug => string 'plugins' (length=7)
180
+	 *         @type int $term_group => int 0
181
+	 *         @type int $term_taxonomy_id => int 30
182
+	 *         @type string $taxonomy => string 'download_category' (length=17)
183
+	 *         @type string $description => string '' (length=0)
184
+	 *         @type int $parent => int 0
185
+	 *         @type int $count => int 4
186
+	 *         @type string $filter => string 'raw' (length=3)
187
+	 *       }
188
+	 *       @type array $tags {see $category above}
189
+	 *       @type string $textdomain string 'gravityview' (length=11)
190
+	 *   }
191
+	 *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
192
+	 *   @type array $licensing {
193
+	 *       @type bool   $enabled Is licensing enabled for the extension
194
+	 *       @type string $version Version number
195
+	 *       @type string $exp_unit Expiration unit ('years')
196
+	 *       @type string $exp_length Expiration length ('1')
197
+	 *   }
198
+	 *   @type array $files Array of files. Empty if user has no access to the file. {
199
+	 *       @type string $file string URL of the file download
200
+	 *   }
201
+	 * }
202 202
 	 */
203 203
 	public function get_downloads_data() {
204 204
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		) );
231 231
 
232 232
 		if ( is_wp_error( $response ) ) {
233
-		    gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
233
+			gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
234 234
 			return $response;
235 235
 		}
236 236
 
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
                 <div class="gv-admin-installer-notice notice inline error">
284 284
                     <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3>
285 285
                     <?php
286
-                    if ( is_wp_error( $downloads_data ) ) {
287
-	                    echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
288
-                    }
289
-                    ?>
286
+					if ( is_wp_error( $downloads_data ) ) {
287
+						echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
288
+					}
289
+					?>
290 290
                 </div>
291 291
             </div>
292 292
 			<?php
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
 	protected function render_download( $download, $wp_plugins ) {
343 343
 
344 344
 
345
-        $details = $this->get_download_display_details( $download, $wp_plugins );
345
+		$details = $this->get_download_display_details( $download, $wp_plugins );
346 346
 
347
-        $download_info = $details['download_info'];
347
+		$download_info = $details['download_info'];
348 348
 
349 349
 		?>
350 350
         <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
@@ -366,43 +366,43 @@  discard block
 block discarded – undo
366 366
 
367 367
                 <div class="addon-excerpt"><?php
368 368
 
369
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
369
+					$excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
370 370
 
371
-                    // Allow some pure HTML tags, but remove everything else from the excerpt.
372
-                    $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
373
-                    $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
371
+					// Allow some pure HTML tags, but remove everything else from the excerpt.
372
+					$tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
373
+					$replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
374 374
 
375
-                    $excerpt = str_replace( $tags, $replacements, $excerpt );
376
-                    $excerpt = esc_html( strip_tags( $excerpt ) );
375
+					$excerpt = str_replace( $tags, $replacements, $excerpt );
376
+					$excerpt = esc_html( strip_tags( $excerpt ) );
377 377
 					$excerpt = str_replace( $replacements, $tags, $excerpt );
378 378
 
379 379
 					echo wpautop( $excerpt );
380
-                ?></div>
380
+				?></div>
381 381
             </div>
382 382
         </div>
383 383
 		<?php
384 384
 	}
385 385
 
386 386
 	/**
387
-     * Generates details array for the download to keep the render_download() method a bit tidier
388
-     *
387
+	 * Generates details array for the download to keep the render_download() method a bit tidier
388
+	 *
389 389
 	 * @param array $download Single download, as returned by {@see get_downloads_data}
390 390
 	 * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()}
391 391
 	 *
392 392
 	 * @return array {
393
-     *   @type array $download_info
394
-     *   @type string $plugin_path
395
-     *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
396
-     *   @type string $status_label
397
-     *   @type string $button_title Title attribute to show when hovering over the download's button
398
-     *   @type string $button_class CSS class to use for the button
399
-     *   @type string $button_label Text to use for the download's anchor link
400
-     *   @type string $href URL for the download's button
401
-     *   @type bool   $spinner Whether to show the spinner icon
402
-     *   @type string $item_class CSS class for the download container
403
-     *   @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions")
404
-     *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
405
-     * }
393
+	 *   @type array $download_info
394
+	 *   @type string $plugin_path
395
+	 *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
396
+	 *   @type string $status_label
397
+	 *   @type string $button_title Title attribute to show when hovering over the download's button
398
+	 *   @type string $button_class CSS class to use for the button
399
+	 *   @type string $button_label Text to use for the download's anchor link
400
+	 *   @type string $href URL for the download's button
401
+	 *   @type bool   $spinner Whether to show the spinner icon
402
+	 *   @type string $item_class CSS class for the download container
403
+	 *   @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions")
404
+	 *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
405
+	 * }
406 406
 	 */
407 407
 	private function get_download_display_details( $download, $wp_plugins ) {
408 408
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			'slug' => '',
414 414
 			'excerpt' => '',
415 415
 			'link' => '',
416
-            'coming_soon' => false,
416
+			'coming_soon' => false,
417 417
 			'installer_title' => null, // May not be defined
418 418
 			'installer_excerpt' => null, // May not be defined
419 419
 		) );
@@ -456,14 +456,14 @@  discard block
 block discarded – undo
456 456
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
457 457
 		}
458 458
 
459
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
460
-	        $spinner      = false;
461
-	        $status       = 'notinstalled';
462
-	        $status_label = __( 'Coming Soon', 'gravityview' );
463
-	        $button_label = __( 'Learn More', 'gravityview' );
464
-	        $button_class = 'button-primary button-large';
465
-	        $href         = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' );
466
-        }
459
+		elseif ( ! empty( $download_info['coming_soon'] ) ) {
460
+			$spinner      = false;
461
+			$status       = 'notinstalled';
462
+			$status_label = __( 'Coming Soon', 'gravityview' );
463
+			$button_label = __( 'Learn More', 'gravityview' );
464
+			$button_class = 'button-primary button-large';
465
+			$href         = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' );
466
+		}
467 467
 
468 468
 		// Access but the plugin is not installed
469 469
 		elseif ( ! $wp_plugin ) {
@@ -503,18 +503,18 @@  discard block
 block discarded – undo
503 503
 		}
504 504
 
505 505
 		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
506
-    }
506
+	}
507 507
 
508 508
 	/**
509
-     * Returns the base price for an extension
510
-     *
509
+	 * Returns the base price for an extension
510
+	 *
511 511
 	 * @param array $download
512 512
 	 *
513 513
 	 * @return float Base price for an extension. If not for sale separately, returns 0
514 514
 	 */
515 515
 	private function get_download_base_price( $download ) {
516 516
 
517
-	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
517
+		$base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
518 518
 		$base_price = \GFCommon::to_number( $base_price );
519 519
 
520 520
 		unset( $download['pricing']['amount'] );
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		}
526 526
 
527 527
 		return floatval( $base_price );
528
-    }
528
+	}
529 529
 
530 530
 	/**
531 531
 	 * Handle AJAX request to activate extension
@@ -543,8 +543,8 @@  discard block
 block discarded – undo
543 543
 
544 544
 		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
545 545
 			wp_send_json_error( array(
546
-                'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
547
-            ) );
546
+				'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
547
+			) );
548 548
 		}
549 549
 
550 550
 		wp_send_json_success();
@@ -565,10 +565,10 @@  discard block
 block discarded – undo
565 565
 		deactivate_plugins( $data['path'] );
566 566
 
567 567
 		if( is_plugin_active( $data['path'] ) ) {
568
-            wp_send_json_error( array(
569
-                'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
570
-            ) );
571
-        }
568
+			wp_send_json_error( array(
569
+				'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
570
+			) );
571
+		}
572 572
 
573 573
 		wp_send_json_success();
574 574
 	}
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 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
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 
145 145
 		foreach ( $all_plugins as $path => $plugin ) {
146 146
 
147
-			if ( empty( $plugin['TextDomain'] ) ) {
147
+			if ( empty( $plugin[ 'TextDomain' ] ) ) {
148 148
 				continue;
149 149
 			}
150 150
 
151
-			$wp_plugins[ $plugin['TextDomain'] ] = array(
151
+			$wp_plugins[ $plugin[ 'TextDomain' ] ] = array(
152 152
 				'path'      => $path,
153
-				'version'   => $plugin['Version'],
153
+				'version'   => $plugin[ 'Version' ],
154 154
 				'activated' => is_plugin_active( $path )
155 155
 			);
156 156
 		}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			return $downloads_data;
209 209
 		}
210 210
 
211
-		if( \GV\Plugin::is_network_activated() ) {
211
+		if ( \GV\Plugin::is_network_activated() ) {
212 212
 			$home_url = network_home_url();
213 213
 		} else {
214 214
 			$home_url = home_url();
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$downloads_data = json_decode( wp_remote_retrieve_body( $response ), true );
238 238
 
239
-		if ( empty( $downloads_data['products'] ) ) {
239
+		if ( empty( $downloads_data[ 'products' ] ) ) {
240 240
 			return array();
241 241
 		}
242 242
 
243
-		$this->set_downloads_data( $downloads_data['products'] );
243
+		$this->set_downloads_data( $downloads_data[ 'products' ] );
244 244
 
245
-		return $downloads_data['products'];
245
+		return $downloads_data[ 'products' ];
246 246
 	}
247 247
 
248 248
 	/**
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 				foreach ( $downloads_data as $extension ) {
317 317
 
318
-					if ( empty( $extension['info'] ) ) {
318
+					if ( empty( $extension[ 'info' ] ) ) {
319 319
 						continue;
320 320
 					}
321 321
 
@@ -344,29 +344,29 @@  discard block
 block discarded – undo
344 344
 
345 345
         $details = $this->get_download_display_details( $download, $wp_plugins );
346 346
 
347
-        $download_info = $details['download_info'];
347
+        $download_info = $details[ 'download_info' ];
348 348
 
349 349
 		?>
350
-        <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
350
+        <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>">
351 351
             <div class="addon-inner">
352
-                <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>
353
-                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3>
352
+                <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>
353
+                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3>
354 354
                 <div>
355
-                    <?php if( ! empty( $details['status_label'] ) ) { ?>
356
-                    <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>">
357
-                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span>
355
+                    <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?>
356
+                    <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>">
357
+                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span>
358 358
                     </div>
359 359
 			        <?php } ?>
360 360
 
361
-                    <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'] ); ?>">
362
-                        <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span>
363
-                        <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?>
361
+                    <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' ] ); ?>">
362
+                        <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span>
363
+                        <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?>
364 364
                     </a>
365 365
                 </div>
366 366
 
367 367
                 <div class="addon-excerpt"><?php
368 368
 
369
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
369
+                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] );
370 370
 
371 371
                     // Allow some pure HTML tags, but remove everything else from the excerpt.
372 372
                     $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	 */
407 407
 	private function get_download_display_details( $download, $wp_plugins ) {
408 408
 
409
-		$download_info = wp_parse_args( (array) $download['info'], array(
409
+		$download_info = wp_parse_args( (array)$download[ 'info' ], array(
410 410
 			'thumbnail' => '',
411 411
 			'title' => '',
412 412
 			'textdomain' => '',
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
 			'installer_excerpt' => null, // May not be defined
419 419
 		) );
420 420
 
421
-		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false );
421
+		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false );
422 422
 
423
-		$has_access = ! empty( $download['files'] );
423
+		$has_access = ! empty( $download[ 'files' ] );
424 424
 		$spinner = true;
425 425
 		$href = $plugin_path = '#';
426 426
 		$status = $item_class = $button_title = $button_class = '';
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 		$required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' );
431 431
 
432 432
 		// The license is not active - no matter what level, this should not work
433
-		if( ! $is_active  && empty( $base_price ) ) {
433
+		if ( ! $is_active && empty( $base_price ) ) {
434 434
 			$spinner      = false;
435 435
 			$status_label = '';
436 436
 			$button_class = 'disabled disabled-license';
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 			$status_label = '';
444 444
 			$button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price );
445 445
 			$button_class = 'button-primary button-large';
446
-			$href         = $download_info['link'];
446
+			$href         = $download_info[ 'link' ];
447 447
 			$item_class   = 'featured';
448 448
 		}
449 449
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
457 457
 		}
458 458
 
459
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
459
+        elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) {
460 460
 	        $spinner      = false;
461 461
 	        $status       = 'notinstalled';
462 462
 	        $status_label = __( 'Coming Soon', 'gravityview' );
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 			$href = add_query_arg(
472 472
 				array(
473 473
 					'action'   => 'install-plugin',
474
-					'plugin'   => $download_info['slug'],
475
-					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ),
474
+					'plugin'   => $download_info[ 'slug' ],
475
+					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ),
476 476
 				),
477 477
 				self_admin_url( 'update.php' )
478 478
 			);
@@ -484,25 +484,25 @@  discard block
 block discarded – undo
484 484
 		}
485 485
 
486 486
 		// Access and the plugin is installed but not active
487
-		elseif ( false === $wp_plugin['activated'] ) {
487
+		elseif ( false === $wp_plugin[ 'activated' ] ) {
488 488
 			$status = 'inactive';
489 489
 			$status_label = __( 'Inactive', 'gravityview' );
490 490
 			$button_label = __( 'Activate', 'gravityview' );
491
-			$plugin_path = $wp_plugin['path'];
491
+			$plugin_path = $wp_plugin[ 'path' ];
492 492
 
493 493
 		}
494 494
 
495 495
 		// Access and the plugin is installed and active
496 496
 		else {
497 497
 
498
-			$plugin_path = $wp_plugin['path'];
498
+			$plugin_path = $wp_plugin[ 'path' ];
499 499
 			$status = 'active';
500 500
 			$status_label = __( 'Active', 'gravityview' );
501 501
 			$button_label = __( 'Deactivate', 'gravityview' );
502 502
 
503 503
 		}
504 504
 
505
-		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
505
+		return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
506 506
     }
507 507
 
508 508
 	/**
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
 	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
518 518
 		$base_price = \GFCommon::to_number( $base_price );
519 519
 
520
-		unset( $download['pricing']['amount'] );
520
+		unset( $download[ 'pricing' ][ 'amount' ] );
521 521
 
522 522
 		// Price options array, not single price
523
-		if ( ! $base_price && ! empty( $download['pricing'] ) ) {
524
-			$base_price = array_shift( $download['pricing'] );
523
+		if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) {
524
+			$base_price = array_shift( $download[ 'pricing' ] );
525 525
 		}
526 526
 
527 527
 		return floatval( $base_price );
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
 	public function activate_download() {
536 536
 		$data = \GV\Utils::_POST( 'data', array() );
537 537
 
538
-		if ( empty( $data['path'] ) ) {
538
+		if ( empty( $data[ 'path' ] ) ) {
539 539
 			return;
540 540
 		}
541 541
 
542
-		$result = activate_plugin( $data['path'] );
542
+		$result = activate_plugin( $data[ 'path' ] );
543 543
 
544
-		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
544
+		if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) {
545 545
 			wp_send_json_error( array(
546 546
                 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
547 547
             ) );
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 	public function deactivate_download() {
559 559
 		$data = \GV\Utils::_POST( 'data', array() );
560 560
 
561
-		if ( empty( $data['path'] ) ) {
561
+		if ( empty( $data[ 'path' ] ) ) {
562 562
 			return;
563 563
 		}
564 564
 
565
-		deactivate_plugins( $data['path'] );
565
+		deactivate_plugins( $data[ 'path' ] );
566 566
 
567
-		if( is_plugin_active( $data['path'] ) ) {
567
+		if ( is_plugin_active( $data[ 'path' ] ) ) {
568 568
             wp_send_json_error( array(
569 569
                 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
570 570
             ) );
Please login to merge, or discard this patch.