Completed
Pull Request — develop (#1130)
by Zack
15:48
created
includes/class-admin.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@  discard block
 block discarded – undo
4 4
 
5 5
 	function __construct() {
6 6
 
7
-		if( ! is_admin() ) { return; }
7
+		if ( ! is_admin() ) { return; }
8 8
 
9 9
 		// If Gravity Forms isn't active or compatibile, stop loading
10
-		if( false === GravityView_Compatibility::is_valid() ) {
10
+		if ( false === GravityView_Compatibility::is_valid() ) {
11 11
 			return;
12 12
 		}
13 13
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
49 49
 		add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) );
50 50
 
51
-		add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) );
51
+		add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) );
52 52
 
53 53
 		add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 );
54 54
 
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public static function no_views_text() {
66 66
 
67
-		if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) {
67
+		if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) {
68 68
 			return __( 'No Views found in Trash', 'gravityview' );
69
-		} elseif( ! empty( $_GET['s'] ) ) {
69
+		} elseif ( ! empty( $_GET[ 's' ] ) ) {
70 70
 			return __( 'No Views found.', 'gravityview' );
71 71
 		}
72 72
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			$error .= ' ' . esc_html__( 'or select another form.', 'gravityview' );
111 111
 		}
112 112
 
113
-		if( $error ) {
113
+		if ( $error ) {
114 114
 			?>
115 115
 			<div class="wp-dialog notice-warning inline error wp-clearfix">
116 116
 				<?php echo gravityview_get_floaty(); ?>
@@ -129,23 +129,23 @@  discard block
 block discarded – undo
129 129
 	public function backend_actions() {
130 130
 
131 131
 		/** @define "GRAVITYVIEW_DIR" "../" */
132
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' );
133
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' );
134
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' );
135
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' );
136
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' );
137
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' );
138
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' );
139
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-installer.php' );
140
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' );
141
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
132
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' );
133
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' );
134
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' );
135
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' );
136
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' );
137
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' );
138
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' );
139
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-installer.php' );
140
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' );
141
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
142 142
 
143 143
 		/**
144 144
 		 * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded
145 145
 		 *
146 146
 		 * Nice place to insert extensions' backend stuff
147 147
 		 */
148
-		do_action('gravityview_include_backend_actions');
148
+		do_action( 'gravityview_include_backend_actions' );
149 149
 	}
150 150
 
151 151
 	/**
@@ -161,12 +161,12 @@  discard block
 block discarded – undo
161 161
 
162 162
 		$actions = array();
163 163
 
164
-		if( GVCommon::has_cap( 'gravityview_view_settings' ) ) {
165
-			$actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) );
164
+		if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) {
165
+			$actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) );
166 166
 		}
167 167
 
168
-		if( GVCommon::has_cap( 'gravityview_support_port' ) ) {
169
-			$actions[] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>';
168
+		if ( GVCommon::has_cap( 'gravityview_support_port' ) ) {
169
+			$actions[ ] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>';
170 170
 		}
171 171
 
172 172
 		return array_merge( $actions, $links );
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		// By default, there will only be one item being modified.
195 195
 		// When in the `bulk_post_updated_messages` filter, there will be passed a number
196 196
 		// of modified items that will override this array.
197
-		$bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts;
197
+		$bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts;
198 198
 
199 199
 		// If we're starting fresh, a new form was created.
200 200
 		// We should let the user know this is the case.
@@ -202,60 +202,60 @@  discard block
 block discarded – undo
202 202
 
203 203
 		$new_form_text = '';
204 204
 
205
-		if( !empty( $start_fresh ) ) {
205
+		if ( ! empty( $start_fresh ) ) {
206 206
 
207 207
 			// Get the form that was created
208 208
 			$connected_form = gravityview_get_form_id( $post_id );
209 209
 
210
-			if( !empty( $connected_form ) ) {
210
+			if ( ! empty( $connected_form ) ) {
211 211
 				$form = gravityview_get_form( $connected_form );
212
-				$form_name = esc_attr( $form['title'] );
212
+				$form_name = esc_attr( $form[ 'title' ] );
213 213
 				$image = self::get_floaty();
214
-				$new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>';
215
-				$new_form_text .=  sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s
214
+				$new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>';
215
+				$new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s
216 216
 
217 217
 					You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don&rsquo;t forget to %scustomize the form settings%s.
218
-					', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&amp;id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&amp;id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id='.$connected_form ).'">', '</a>');
218
+					', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&amp;id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&amp;id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=' . $connected_form ) . '">', '</a>' );
219 219
 				$new_form_text = wpautop( $new_form_text );
220 220
 
221 221
 				delete_post_meta( $post_id, '_gravityview_start_fresh' );
222 222
 			}
223 223
 		}
224 224
 
225
-		$messages['gravityview'] = array(
225
+		$messages[ 'gravityview' ] = array(
226 226
 			0  => '', // Unused. Messages start at index 1.
227 227
 			/* translators: %s and %s are HTML tags linking to the View on the website */
228
-			1  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
228
+			1  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
229 229
 			/* translators: %s and %s are HTML tags linking to the View on the website */
230
-			2  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
230
+			2  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
231 231
 			3  => __( 'View deleted.', 'gravityview' ),
232 232
 			/* translators: %s and %s are HTML tags linking to the View on the website */
233
-			4  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
233
+			4  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
234 234
 			/* translators: %s: date and time of the revision */
235
-			5  => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
235
+			5  => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false,
236 236
 			/* translators: %s and %s are HTML tags linking to the View on the website */
237
-			6  => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
237
+			6  => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
238 238
 			/* translators: %s and %s are HTML tags linking to the View on the website */
239
-			7  => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
239
+			7  => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
240 240
 			8  => __( 'View submitted.', 'gravityview' ),
241 241
 			9  => sprintf(
242 242
 		        /* translators: Date and time the View is scheduled to be published */
243 243
 				__( 'View scheduled for: %1$s.', 'gravityview' ),
244 244
 				// translators: Publish box date format, see http://php.net/date
245
-				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL )  ) )
245
+				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) )
246 246
 			) . $new_form_text,
247 247
 			/* translators: %s and %s are HTML tags linking to the View on the website */
248
-			10  => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
248
+			10  => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
249 249
 
250 250
 			/**
251 251
 			 * These apply to `bulk_post_updated_messages`
252 252
 			 * @file wp-admin/edit.php
253 253
 			 */
254
-			'updated'   => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ),
255
-			'locked'    => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ),
256
-			'deleted'   => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ),
257
-			'trashed'   => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ),
258
-			'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ),
254
+			'updated'   => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ),
255
+			'locked'    => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ),
256
+			'deleted'   => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ),
257
+			'trashed'   => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ),
258
+			'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ),
259 259
 		);
260 260
 
261 261
 		return $messages;
Please login to merge, or discard this patch.
future/includes/class-gv-license-handler.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		);
101 101
 
102 102
 		if ( ! empty( $action ) ) {
103
-			$settings['edd_action'] = esc_attr( $action );
103
+			$settings[ 'edd_action' ] = esc_attr( $action );
104 104
 		}
105 105
 
106 106
 		return array_map( 'urlencode', $settings );
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			'format' => 'json',
157 157
 		) );
158 158
 
159
-		if ( $is_ajax && empty( $data['license'] ) ) {
159
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
160 160
 			die( -1 );
161 161
 		}
162 162
 
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 
185 185
 			$json = json_encode( $license_data );
186 186
 
187
-			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action');
187
+			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' );
188 188
 
189 189
 			$is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX );
190 190
 
191
-			if ('deactivate_license' === Utils::get( $data, 'edd_action') ) {
192
-				do_action('gravityview/admin_installer/delete_extensions_data', true);
191
+			if ( 'deactivate_license' === Utils::get( $data, 'edd_action' ) ) {
192
+				do_action( 'gravityview/admin_installer/delete_extensions_data', true );
193 193
 			}
194 194
 
195 195
 			if ( $is_check_action_button ) {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			// most likely a mistake.
202 202
 			} else if ( $license_data->license !== 'failed' && $update_license ) {
203 203
 
204
-				if ( ! empty( $data['field_id'] ) ) {
204
+				if ( ! empty( $data[ 'field_id' ] ) ) {
205 205
 					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
206 206
 				}
207 207
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		if ( empty( $license_data ) ) {
229 229
 			$message = '';
230 230
 		} else {
231
-			if( ! empty( $license_data->error ) ) {
231
+			if ( ! empty( $license_data->error ) ) {
232 232
 				$class = 'error';
233 233
 				$string_key = $license_data->error;
234 234
 			} else { $class = $license_data->license;
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public function license_details( $response = array() ) {
256 256
 
257
-		$response = (array) $response;
257
+		$response = (array)$response;
258 258
 
259 259
 		$return = '';
260 260
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
261 261
 
262
-		if ( ! empty( $response['license_key'] ) ) {
262
+		if ( ! empty( $response[ 'license_key' ] ) ) {
263 263
 			$return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>';
264 264
 
265 265
 			if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
266
-				$return .= $this->strings( $response['license'], $response );
267
-			} elseif ( ! empty( $response['license_name'] ) ) {
266
+				$return .= $this->strings( $response[ 'license' ], $response );
267
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
268 268
 				$response_keys = array(
269 269
 					'license_name'   => '',
270 270
 					'license_limit'  => '',
@@ -278,19 +278,19 @@  discard block
 block discarded – undo
278 278
 				// Make sure all the keys are set
279 279
 				$response = wp_parse_args( $response, $response_keys );
280 280
 
281
-				$login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
282
-				$local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
281
+				$login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
282
+				$local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
283 283
 				$details    = array(
284
-					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ),
285
-					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link,
286
-					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text,
287
-					'expires'     => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ),
288
-					'upgrade'     => $this->get_upgrade_html( $response['upgrades'] ),
284
+					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ),
285
+					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link,
286
+					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text,
287
+					'expires'     => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ),
288
+					'upgrade'     => $this->get_upgrade_html( $response[ 'upgrades' ] ),
289 289
 				);
290 290
 
291
-				if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) {
292
-					unset( $details['upgrade'] );
293
-					$details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
291
+				if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) {
292
+					unset( $details[ 'upgrade' ] );
293
+					$details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
294 294
 				}
295 295
 
296 296
 				$return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>';
@@ -316,20 +316,20 @@  discard block
 block discarded – undo
316 316
 		if ( ! empty( $upgrades ) ) {
317 317
 
318 318
 			$locale_parts = explode( '_', get_locale() );
319
-			$is_english = ( 'en' === $locale_parts[0] );
319
+			$is_english = ( 'en' === $locale_parts[ 0 ] );
320 320
 
321 321
 			$output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>';
322 322
 			$output .= '<ul class="ul-disc">';
323 323
 
324 324
 			foreach ( $upgrades as $upgrade_id => $upgrade ) {
325
-				$upgrade = (object) $upgrade;
325
+				$upgrade = (object)$upgrade;
326 326
 
327 327
 				$anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) );
328 328
 
329 329
 				if ( $is_english && isset( $upgrade->description ) ) {
330 330
 					$message = esc_html( $upgrade->description );
331 331
 				} else {
332
-					switch( $upgrade->price_id ) {
332
+					switch ( $upgrade->price_id ) {
333 333
 						// Interstellar
334 334
 						case 1:
335 335
 						default:
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 			'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ),
388 388
 			'missing' => esc_html__( 'Invalid license key.', 'gravityview' ),
389 389
 			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
390
-			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ),
390
+			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ),
391 391
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
392 392
 
393 393
 			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 
411 411
 		if ( ! empty( $license_data->renewal_url ) ) {
412 412
 			$renew_license_url = $license_data->renewal_url;
413
-		} elseif( ! empty( $license_data->license_key ) ) {
413
+		} elseif ( ! empty( $license_data->license_key ) ) {
414 414
 			$renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key );
415 415
 		} else {
416 416
 			$renew_license_url = 'https://gravityview.co/account/';
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	 * @return array|\WP_Error
428 428
 	 */
429 429
 	private function _license_get_remote_response( $data, $license = '' ) {
430
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
430
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
431 431
 
432 432
 		$url = add_query_arg( $api_params, self::url );
433 433
 
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
 	private function license_call_update_settings( $license_data, $data ) {
468 468
 		$settings = array();
469 469
 
470
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
471
-		$settings['license_key_status'] = $license_data->license;
472
-		$settings['license_key_response'] = (array)$license_data;
470
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
471
+		$settings[ 'license_key_status' ] = $license_data->license;
472
+		$settings[ 'license_key_response' ] = (array)$license_data;
473 473
 
474 474
 		$this->settings->set( $settings );
475 475
 	}
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 
485 485
 		if ( ! empty( $key ) ) {
486 486
 			$response = $this->settings->get( 'license_key_response' );
487
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
487
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
488 488
 		} else {
489 489
 			$response = array();
490 490
 		}
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
 
527 527
 		$submit = '<div class="gv-edd-button-wrapper">';
528 528
 		foreach ( $fields as $field ) {
529
-			$field['type'] = 'button';
530
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
531
-			$field['style'] = 'margin-left: 10px;';
532
-			if( $disabled_attribute ) {
533
-				$field['disabled'] = $disabled_attribute;
529
+			$field[ 'type' ] = 'button';
530
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
531
+			$field[ 'style' ] = 'margin-left: 10px;';
532
+			if ( $disabled_attribute ) {
533
+				$field[ 'disabled' ] = $disabled_attribute;
534 534
 			}
535 535
 			$submit .= $this->settings->as_html( $field, $echo );
536 536
 		}
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 				    'url'        => home_url(),
610 610
 				    'site_data'  => $this->get_site_data(),
611 611
 			    ),
612
-			));
612
+			) );
613 613
 
614 614
 			// make sure the response came back okay
615 615
 			if ( is_wp_error( $response ) ) {
@@ -640,45 +640,45 @@  discard block
 block discarded – undo
640 640
 		$theme_data = wp_get_theme();
641 641
 		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
642 642
 
643
-		$data['gv_version']  = Plugin::$version;
644
-		$data['php_version']  = phpversion();
645
-		$data['wp_version']   = get_bloginfo( 'version' );
646
-		$data['gf_version']  = \GFForms::$version;
647
-		$data['server']       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
648
-		$data['multisite']    = is_multisite();
649
-		$data['theme']        = $theme;
650
-		$data['url']          = home_url();
651
-		$data['license_key']  = $this->settings->get( 'license_key' );
652
-		$data['beta']         = $this->settings->get( 'beta' );
643
+		$data[ 'gv_version' ]  = Plugin::$version;
644
+		$data[ 'php_version' ]  = phpversion();
645
+		$data[ 'wp_version' ]   = get_bloginfo( 'version' );
646
+		$data[ 'gf_version' ]  = \GFForms::$version;
647
+		$data[ 'server' ]       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
648
+		$data[ 'multisite' ]    = is_multisite();
649
+		$data[ 'theme' ]        = $theme;
650
+		$data[ 'url' ]          = home_url();
651
+		$data[ 'license_key' ]  = $this->settings->get( 'license_key' );
652
+		$data[ 'beta' ]         = $this->settings->get( 'beta' );
653 653
 
654 654
 		// View Data
655 655
 		$gravityview_posts = wp_count_posts( 'gravityview', 'readable' );
656 656
 
657
-		$data['view_count'] = null;
658
-		$data['view_first'] = null;
659
-		$data['view_latest'] = null;
657
+		$data[ 'view_count' ] = null;
658
+		$data[ 'view_first' ] = null;
659
+		$data[ 'view_latest' ] = null;
660 660
 
661 661
 		if ( $gravityview_posts->publish ) {
662
-			$data['view_count'] = $gravityview_posts->publish;
662
+			$data[ 'view_count' ] = $gravityview_posts->publish;
663 663
 
664 664
 			$first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' );
665 665
 			$latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' );
666 666
 
667 667
 			if ( $first = array_shift( $first ) ) {
668
-				$data['view_first'] = $first->post_date;
668
+				$data[ 'view_first' ] = $first->post_date;
669 669
 			}
670 670
 			if ( $latest = array_pop( $latest ) ) {
671
-				$data['view_latest'] = $latest->post_date;
671
+				$data[ 'view_latest' ] = $latest->post_date;
672 672
 			}
673 673
 		}
674 674
 
675 675
 		// Form counts
676 676
 		if ( class_exists( 'GFFormsModel' ) ) {
677 677
 			$form_data = \GFFormsModel::get_form_count();
678
-			$data['forms_total'] = Utils::get( $form_data, 'total', 0 );
679
-			$data['forms_active'] = Utils::get( $form_data, 'active', 0 );
680
-			$data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 );
681
-			$data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 );
678
+			$data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 );
679
+			$data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 );
680
+			$data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 );
681
+			$data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 );
682 682
 		}
683 683
 
684 684
 		// Retrieve current plugin information
@@ -686,13 +686,13 @@  discard block
 block discarded – undo
686 686
 			include ABSPATH . '/wp-admin/includes/plugin.php';
687 687
 		}
688 688
 
689
-		$data['integrations']     = self::get_related_plugins_and_extensions();
690
-		$data['active_plugins']   = get_option( 'active_plugins', array() );
691
-		$data['inactive_plugins'] = array();
692
-		$data['locale']           = get_locale();
689
+		$data[ 'integrations' ]     = self::get_related_plugins_and_extensions();
690
+		$data[ 'active_plugins' ]   = get_option( 'active_plugins', array() );
691
+		$data[ 'inactive_plugins' ] = array();
692
+		$data[ 'locale' ]           = get_locale();
693 693
 
694 694
 		// Validate request on the GV server
695
-		$data['hash']             = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] );
695
+		$data[ 'hash' ]             = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] );
696 696
 
697 697
 		return $data;
698 698
 	}
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 
723 723
 				$plugin_data = get_plugin_data( $active_plugin );
724 724
 
725
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
725
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
726 726
 			}
727 727
 
728 728
 			if ( ! empty( $extensions ) ) {
Please login to merge, or discard this patch.
includes/class-admin-installer.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -300,7 +300,7 @@
 block discarded – undo
300 300
 						<?php
301 301
 
302 302
 					} else {
303
-					    ?>
303
+						?>
304 304
                         <div class="status active">
305 305
 							<?php esc_html_e( 'Active', 'gravityview' ); ?>
306 306
                         </div>
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 			return;
53 53
 		}
54 54
 
55
-		add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $extensions_data ) {
55
+		add_filter( 'plugins_api', function( $data, $action, $args ) use ( $extensions_data ) {
56 56
 			foreach ( $extensions_data as $extension ) {
57
-				if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) {
57
+				if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) {
58 58
 					continue;
59 59
 				}
60 60
 
61
-				return (object) array(
62
-					'slug'          => $extension['info']['slug'],
63
-					'name'          => $extension['info']['title'],
64
-					'version'       => $extension['licensing']['version'],
65
-					'download_link' => $extension['files'][0]['file'],
61
+				return (object)array(
62
+					'slug'          => $extension[ 'info' ][ 'slug' ],
63
+					'name'          => $extension[ 'info' ][ 'title' ],
64
+					'version'       => $extension[ 'licensing' ][ 'version' ],
65
+					'download_link' => $extension[ 'files' ][ 0 ][ 'file' ],
66 66
 				);
67 67
 			}
68 68
 
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 
104 104
 		foreach ( $all_plugins as $path => $plugin ) {
105 105
 
106
-			if ( empty( $plugin['TextDomain'] ) ) {
106
+			if ( empty( $plugin[ 'TextDomain' ] ) ) {
107 107
 				continue;
108 108
 			}
109 109
 
110
-			$wp_plugins[ $plugin['TextDomain'] ] = array(
110
+			$wp_plugins[ $plugin[ 'TextDomain' ] ] = array(
111 111
 				'path'      => $path,
112
-				'version'   => $plugin['Version'],
112
+				'version'   => $plugin[ 'Version' ],
113 113
 				'activated' => is_plugin_active( $path )
114 114
 			);
115 115
 		}
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 
150 150
 		$extensions_data = json_decode( wp_remote_retrieve_body( $response ), true );
151 151
 
152
-		if ( empty( $extensions_data['products'] ) ) {
152
+		if ( empty( $extensions_data[ 'products' ] ) ) {
153 153
 			return array();
154 154
 		}
155 155
 
156
-		$this->set_extensions_data( $extensions_data['products'] );
156
+		$this->set_extensions_data( $extensions_data[ 'products' ] );
157 157
 
158
-		return $extensions_data['products'];
158
+		return $extensions_data[ 'products' ];
159 159
 	}
160 160
 
161 161
 	/**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 				foreach ( $extensions_data as $extension ) {
229 229
 
230
-					if ( empty( $extension['info'] ) ) {
230
+					if ( empty( $extension[ 'info' ] ) ) {
231 231
 						continue;
232 232
 					}
233 233
 
@@ -249,29 +249,29 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	protected function render_extension( $extension, $wp_plugins ) {
251 251
 
252
-		$extension_info = $extension['info'];
252
+		$extension_info = $extension[ 'info' ];
253 253
 
254 254
 		$install_url = add_query_arg(
255 255
 			array(
256 256
 				'action'   => 'install-plugin',
257
-				'plugin'   => $extension_info['slug'],
258
-				'_wpnonce' => wp_create_nonce( 'install-plugin_' . $extension_info['slug'] ),
257
+				'plugin'   => $extension_info[ 'slug' ],
258
+				'_wpnonce' => wp_create_nonce( 'install-plugin_' . $extension_info[ 'slug' ] ),
259 259
 			),
260 260
 			self_admin_url( 'update.php' )
261 261
 		);
262 262
 
263
-		if ( 'gravityview' === $extension_info['slug'] ) {
263
+		if ( 'gravityview' === $extension_info[ 'slug' ] ) {
264 264
 			return;
265 265
 		}
266 266
 
267
-		$wp_plugin = \GV\Utils::get( $wp_plugins, $extension_info['textdomain'], false );
267
+		$wp_plugin = \GV\Utils::get( $wp_plugins, $extension_info[ 'textdomain' ], false );
268 268
 
269 269
 		?>
270 270
         <div class="item">
271 271
             <div class="addon-inner">
272
-                <img class="thumbnail" src="<?php echo esc_attr( $extension_info['thumbnail'] ); ?>" alt=""/>
272
+                <img class="thumbnail" src="<?php echo esc_attr( $extension_info[ 'thumbnail' ] ); ?>" alt=""/>
273 273
                 <h3>
274
-					<?php echo esc_attr( $extension_info['title'] ); ?>
274
+					<?php echo esc_attr( $extension_info[ 'title' ] ); ?>
275 275
                 </h3>
276 276
                 <div><?php
277 277
 
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
                         </a>
288 288
 						<?php
289 289
 
290
-					} else if ( false === $wp_plugin['activated'] ) {
290
+					} else if ( false === $wp_plugin[ 'activated' ] ) {
291 291
 						?>
292 292
                         <div class="status inactive">
293 293
 							<?php esc_html_e( 'Inactive', 'gravityview' ); ?>
294 294
                         </div>
295
-                        <a data-status="inactive" data-plugin-path="<?php echo esc_attr( $wp_plugin['path'] ); ?>" href="#" class="button">
295
+                        <a data-status="inactive" data-plugin-path="<?php echo esc_attr( $wp_plugin[ 'path' ] ); ?>" href="#" class="button">
296 296
                             <span class="title"><?php esc_html_e( 'Activate', 'gravityview' ); ?></span>
297 297
                             <span class="spinner"></span>
298 298
                         </a>
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
                         <div class="status active">
305 305
 							<?php esc_html_e( 'Active', 'gravityview' ); ?>
306 306
                         </div>
307
-                        <a data-status="active" data-plugin-path="<?php echo esc_attr( $wp_plugin['path'] ); ?>" href="#" class="button">
307
+                        <a data-status="active" data-plugin-path="<?php echo esc_attr( $wp_plugin[ 'path' ] ); ?>" href="#" class="button">
308 308
                             <span class="title"><?php esc_html_e( 'Deactivate', 'gravityview' ); ?></span>
309 309
                             <span class="spinner"></span>
310 310
                         </a>
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                 </div>
317 317
 
318 318
                 <div class="addon-excerpt">
319
-					<?php echo wpautop( esc_html( $extension_info['excerpt'] ) ); ?>
319
+					<?php echo wpautop( esc_html( $extension_info[ 'excerpt' ] ) ); ?>
320 320
                 </div>
321 321
 
322 322
             </div>
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
 	public function activate_extension() {
333 333
 		$data = \GV\Utils::_POST( 'data', array() );
334 334
 
335
-		if ( empty( $data['path'] ) ) {
335
+		if ( empty( $data[ 'path' ] ) ) {
336 336
 			return;
337 337
 		}
338 338
 
339
-		$result = activate_plugin( $data['path'] );
339
+		$result = activate_plugin( $data[ 'path' ] );
340 340
 
341 341
 		if ( is_wp_error( $result ) ) {
342 342
 			wp_send_json_error(
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
 	public function deactivate_extension() {
358 358
 		$data = \GV\Utils::_POST( 'data', array() );
359 359
 
360
-		if ( empty( $data['path'] ) ) {
360
+		if ( empty( $data[ 'path' ] ) ) {
361 361
 			return;
362 362
 		}
363 363
 
364
-		$result = deactivate_plugins( $data['path'] );
364
+		$result = deactivate_plugins( $data[ 'path' ] );
365 365
 
366 366
 		if ( is_wp_error( $result ) ) {
367 367
 			wp_send_json_error(
Please login to merge, or discard this patch.