Completed
Pull Request — master (#991)
by Zack
12:50 queued 09:33
created
includes/class-gv-license-handler.php 4 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -295,7 +295,8 @@  discard block
 block discarded – undo
295 295
 			if ( empty( $license_data ) ) {
296 296
 				if ( $is_ajax ) {
297 297
 					exit( json_encode( array() ) );
298
-				} else { // Non-ajax call
298
+				} else {
299
+// Non-ajax call
299 300
 					return json_encode( array() );
300 301
 				}
301 302
 			}
@@ -325,7 +326,8 @@  discard block
 block discarded – undo
325 326
 
326 327
 		if ( $is_ajax ) {
327 328
 			exit( $json );
328
-		} else { // Non-ajax call
329
+		} else {
330
+// Non-ajax call
329 331
 			return ( rgget('format', $data ) === 'object' ) ? $license_data : $json;
330 332
 		}
331 333
 	}
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,6 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @since 1.19.3
88 88
 	 *
89
-	 * @param bool $force Whether to force checking license, even if AJAX
90 89
 	 *
91 90
 	 * @return void
92 91
 	 */
@@ -272,6 +271,9 @@  discard block
 block discarded – undo
272 271
 		return $implode ? implode( $implode, $extensions ) : $extensions;
273 272
 	}
274 273
 
274
+	/**
275
+	 * @param boolean $echo
276
+	 */
275 277
 	function settings_edd_license_activation( $field, $echo ) {
276 278
 
277 279
 		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
@@ -464,7 +466,7 @@  discard block
 block discarded – undo
464 466
 	 * Generate the status message box HTML based on the current status
465 467
 	 *
466 468
 	 * @since 1.7.4
467
-	 * @param $message
469
+	 * @param string $message
468 470
 	 * @param string $class
469 471
 	 *
470 472
 	 * @return string
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 			// Call the custom API.
117 117
 			$response = wp_remote_post( self::url, array(
118 118
 				'timeout'   => 15,
119
-			    'sslverify' => false,
120
-			    'body'      =>  array(
121
-				    'edd_action' => 'check_license',
122
-				    'license'    => trim( $this->Addon->get_app_setting( 'license_key' ) ),
123
-				    'item_name'  => self::name,
124
-				    'url'        => home_url(),
125
-				    'site_data'  => $this->get_site_data(),
126
-			    ),
119
+				'sslverify' => false,
120
+				'body'      =>  array(
121
+					'edd_action' => 'check_license',
122
+					'license'    => trim( $this->Addon->get_app_setting( 'license_key' ) ),
123
+					'item_name'  => self::name,
124
+					'url'        => home_url(),
125
+					'site_data'  => $this->get_site_data(),
126
+				),
127 127
 			));
128 128
 
129 129
 			// make sure the response came back okay
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 			'author'    => self::author,
386 386
 			'language'  => get_locale(),
387 387
 			'url'       => home_url(),
388
-		    'beta'      => $this->Addon->get_app_setting( 'beta' ),
388
+			'beta'      => $this->Addon->get_app_setting( 'beta' ),
389 389
 		);
390 390
 
391 391
 		if( !empty( $action ) ) {
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		// Update option with passed data license
679 679
 		$settings = $this->Addon->get_app_settings();
680 680
 
681
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
681
+		$settings['license_key'] = $license_data->license_key = trim( $data['license'] );
682 682
 		$settings['license_key_status'] = $license_data->license;
683 683
 		$settings['license_key_response'] = (array)$license_data;
684 684
 
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @return GV_License_Handler
48 48
 	 */
49 49
 	public static function get_instance( GravityView_Settings $GFAddOn ) {
50
-		if( empty( self::$instance ) ) {
50
+		if ( empty( self::$instance ) ) {
51 51
 			self::$instance = new self( $GFAddOn );
52 52
 		}
53 53
 		return self::$instance;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 				    'url'        => home_url(),
124 124
 				    'site_data'  => $this->get_site_data(),
125 125
 			    ),
126
-			));
126
+			) );
127 127
 
128 128
 			// make sure the response came back okay
129 129
 			if ( is_wp_error( $response ) ) {
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	public function refresh_license_status() {
151 151
 
152
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
152
+		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
153 153
 			return;
154 154
 		}
155 155
 
156 156
 		global $pagenow;
157 157
 
158
-		$is_force_check = ( isset( $pagenow ) && 'update-core.php' === $pagenow && isset( $_REQUEST['force-check'] ) && '1' === $_REQUEST['force-check'] );
158
+		$is_force_check = ( isset( $pagenow ) && 'update-core.php' === $pagenow && isset( $_REQUEST[ 'force-check' ] ) && '1' === $_REQUEST[ 'force-check' ] );
159 159
 
160 160
 		// The transient is fresh; don't fetch.
161
-		if( $status = get_transient( self::status_transient_key ) && ! $is_force_check ) {
161
+		if ( $status = get_transient( self::status_transient_key ) && ! $is_force_check ) {
162 162
 			return;
163 163
 		}
164 164
 
@@ -191,49 +191,49 @@  discard block
 block discarded – undo
191 191
 		$theme_data = wp_get_theme();
192 192
 		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
193 193
 
194
-		$data['gv_version']  = GravityView_Plugin::version;
195
-		$data['php_version']  = phpversion();
196
-		$data['wp_version']   = get_bloginfo( 'version' );
197
-		$data['gf_version']  = GFForms::$version;
198
-		$data['server']       = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
199
-		$data['multisite']    = is_multisite();
200
-		$data['theme']        = $theme;
201
-		$data['url']          = home_url();
202
-		$data['license_key']  = GravityView_Settings::get_instance()->get_app_setting( 'license_key' );
203
-		$data['beta']         = GravityView_Settings::get_instance()->get_app_setting( 'beta' );
194
+		$data[ 'gv_version' ]  = GravityView_Plugin::version;
195
+		$data[ 'php_version' ]  = phpversion();
196
+		$data[ 'wp_version' ]   = get_bloginfo( 'version' );
197
+		$data[ 'gf_version' ]  = GFForms::$version;
198
+		$data[ 'server' ]       = isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) ? $_SERVER[ 'SERVER_SOFTWARE' ] : '';
199
+		$data[ 'multisite' ]    = is_multisite();
200
+		$data[ 'theme' ]        = $theme;
201
+		$data[ 'url' ]          = home_url();
202
+		$data[ 'license_key' ]  = GravityView_Settings::get_instance()->get_app_setting( 'license_key' );
203
+		$data[ 'beta' ]         = GravityView_Settings::get_instance()->get_app_setting( 'beta' );
204 204
 
205 205
 		// View Data
206
-		$gravityview_posts = get_posts('numberposts=-1&post_type=gravityview&post_status=publish&order=ASC');
206
+		$gravityview_posts = get_posts( 'numberposts=-1&post_type=gravityview&post_status=publish&order=ASC' );
207 207
 
208 208
 		if ( ! empty( $gravityview_posts ) ) {
209 209
 			$first = array_shift( $gravityview_posts );
210 210
 			$latest = array_pop( $gravityview_posts );
211
-			$data['view_count'] = count( $gravityview_posts );
212
-			$data['view_first'] = $first->post_date;
213
-			$data['view_latest'] = $latest->post_date;
211
+			$data[ 'view_count' ] = count( $gravityview_posts );
212
+			$data[ 'view_first' ] = $first->post_date;
213
+			$data[ 'view_latest' ] = $latest->post_date;
214 214
 		}
215 215
 
216 216
 		// Form counts
217 217
 		if ( class_exists( 'GFFormsModel' ) ) {
218 218
 			$form_data = GFFormsModel::get_form_count();
219
-			$data['forms_total'] = rgar( $form_data, 'total', 0 );
220
-			$data['forms_active'] = rgar( $form_data, 'active', 0 );
221
-			$data['forms_inactive'] = rgar( $form_data, 'inactive', 0 );
222
-			$data['forms_trash'] = rgar( $form_data, 'inactive', 0 );
219
+			$data[ 'forms_total' ] = rgar( $form_data, 'total', 0 );
220
+			$data[ 'forms_active' ] = rgar( $form_data, 'active', 0 );
221
+			$data[ 'forms_inactive' ] = rgar( $form_data, 'inactive', 0 );
222
+			$data[ 'forms_trash' ] = rgar( $form_data, 'inactive', 0 );
223 223
 		}
224 224
 
225 225
 		// Retrieve current plugin information
226
-		if( ! function_exists( 'get_plugins' ) ) {
226
+		if ( ! function_exists( 'get_plugins' ) ) {
227 227
 			include ABSPATH . '/wp-admin/includes/plugin.php';
228 228
 		}
229 229
 
230
-		$data['integrations']     = self::get_related_plugins_and_extensions();
231
-		$data['active_plugins']   = get_option( 'active_plugins', array() );
232
-		$data['inactive_plugins'] = array();
233
-		$data['locale']           = get_locale();
230
+		$data[ 'integrations' ]     = self::get_related_plugins_and_extensions();
231
+		$data[ 'active_plugins' ]   = get_option( 'active_plugins', array() );
232
+		$data[ 'inactive_plugins' ] = array();
233
+		$data[ 'locale' ]           = get_locale();
234 234
 
235 235
 		// Validate request on the GV server
236
-		$data['hash']             = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] );
236
+		$data[ 'hash' ]             = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] );
237 237
 
238 238
 		return $data;
239 239
 	}
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 
266 266
 				$plugin_data = get_plugin_data( $active_plugin );
267 267
 
268
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
268
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
269 269
 			}
270 270
 
271
-			if( ! empty( $extensions ) ) {
271
+			if ( ! empty( $extensions ) ) {
272 272
 				set_site_transient( self::related_plugins_key, $extensions, HOUR_IN_SECONDS );
273 273
 			} else {
274 274
 				return 'There was an error fetching related plugins.';
@@ -287,37 +287,37 @@  discard block
 block discarded – undo
287 287
 		$status = trim( $this->Addon->get_app_setting( 'license_key_status' ) );
288 288
 		$key = trim( $this->Addon->get_app_setting( 'license_key' ) );
289 289
 
290
-		if( !empty( $key ) ) {
290
+		if ( ! empty( $key ) ) {
291 291
 			$response = $this->Addon->get_app_setting( 'license_key_response' );
292
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
292
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
293 293
 		} else {
294 294
 			$response = array();
295 295
 		}
296 296
 
297 297
 		wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array(
298 298
 			'license_box' => $this->get_license_message( $response )
299
-		));
299
+		) );
300 300
 
301 301
 
302 302
 		$fields = array(
303 303
 			array(
304 304
 				'name'  => 'edd-activate',
305
-				'value' => __('Activate License', 'gravityview'),
306
-				'data-pending_text' => __('Verifying license…', 'gravityview'),
305
+				'value' => __( 'Activate License', 'gravityview' ),
306
+				'data-pending_text' => __( 'Verifying license…', 'gravityview' ),
307 307
 				'data-edd_action' => 'activate_license',
308 308
 				'class' => 'button-primary',
309 309
 			),
310 310
 			array(
311 311
 				'name'  => 'edd-deactivate',
312
-				'value' => __('Deactivate License', 'gravityview'),
313
-				'data-pending_text' => __('Deactivating license…', 'gravityview'),
312
+				'value' => __( 'Deactivate License', 'gravityview' ),
313
+				'data-pending_text' => __( 'Deactivating license…', 'gravityview' ),
314 314
 				'data-edd_action' => 'deactivate_license',
315 315
 				'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ),
316 316
 			),
317 317
 			array(
318 318
 				'name'  => 'edd-check',
319
-				'value' => __('Check License', 'gravityview'),
320
-				'data-pending_text' => __('Verifying license…', 'gravityview'),
319
+				'value' => __( 'Check License', 'gravityview' ),
320
+				'data-pending_text' => __( 'Verifying license…', 'gravityview' ),
321 321
 				'title' => 'Check the license before saving it',
322 322
 				'data-edd_action' => 'check_license',
323 323
 				'class' => 'button-secondary',
@@ -327,17 +327,17 @@  discard block
 block discarded – undo
327 327
 
328 328
 		$class = 'button gv-edd-action';
329 329
 
330
-		$class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
330
+		$class .= ( ! empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
331 331
 
332 332
 		$disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled';
333 333
 
334 334
 		$submit = '<div class="gv-edd-button-wrapper">';
335 335
 		foreach ( $fields as $field ) {
336
-			$field['type'] = 'button';
337
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
338
-			$field['style'] = 'margin-left: 10px;';
339
-			if( $disabled_attribute ) {
340
-				$field['disabled'] = $disabled_attribute;
336
+			$field[ 'type' ] = 'button';
337
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
338
+			$field[ 'style' ] = 'margin-left: 10px;';
339
+			if ( $disabled_attribute ) {
340
+				$field[ 'disabled' ] = $disabled_attribute;
341 341
 			}
342 342
 			$submit .= $this->Addon->settings_submit( $field, $echo );
343 343
 		}
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
 	 */
357 357
 	public function setup_edd() {
358 358
 
359
-		if( !class_exists('EDD_SL_Plugin_Updater') ) {
360
-			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php');
359
+		if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
360
+			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php' );
361 361
 		}
362 362
 
363 363
 		// setup the updater
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 		    'beta'      => $this->Addon->get_app_setting( 'beta' ),
396 396
 		);
397 397
 
398
-		if( !empty( $action ) ) {
399
-			$settings['edd_action'] = esc_attr( $action );
398
+		if ( ! empty( $action ) ) {
399
+			$settings[ 'edd_action' ] = esc_attr( $action );
400 400
 		}
401 401
 
402 402
 		$settings = array_map( 'urlencode', $settings );
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
 	 */
411 411
 	private function _license_get_remote_response( $data, $license = '' ) {
412 412
 
413
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
413
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
414 414
 
415 415
 		$url = add_query_arg( $api_params, self::url );
416 416
 
417 417
 		$response = wp_remote_get( $url, array(
418 418
 			'timeout'   => 15,
419 419
 			'sslverify' => false,
420
-		));
420
+		) );
421 421
 
422 422
 		if ( is_wp_error( $response ) ) {
423 423
 
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
 	 */
456 456
 	function get_license_message( $license_data ) {
457 457
 
458
-		if( empty( $license_data ) ) {
458
+		if ( empty( $license_data ) ) {
459 459
 			$message = '';
460 460
 		} else {
461 461
 
462
-			if( ! empty( $license_data->error ) ) {
462
+			if ( ! empty( $license_data->error ) ) {
463 463
 				$class = 'error';
464 464
 				$string_key = $license_data->error;
465 465
 			} else {
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 				$string_key = $license_data->license;
468 468
 			}
469 469
 
470
-			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) );
470
+			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings( 'status' ), $this->strings( $string_key, $license_data ) );
471 471
 
472 472
 			$message = $this->generate_license_box( $message, $class );
473 473
 		}
@@ -504,18 +504,18 @@  discard block
 block discarded – undo
504 504
 	 */
505 505
 	public function license_details( $response = array() ) {
506 506
 
507
-		$response = (array) $response;
507
+		$response = (array)$response;
508 508
 
509 509
 		$return = '';
510 510
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
511 511
 
512
-		if( ! empty( $response['license_key'] ) ) {
512
+		if ( ! empty( $response[ 'license_key' ] ) ) {
513 513
 
514 514
 			$return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>';
515 515
 
516 516
 			if ( in_array( rgar( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
517
-				$return .= $this->strings( $response['license'], $response );
518
-			} elseif ( ! empty( $response['license_name'] ) ) {
517
+				$return .= $this->strings( $response[ 'license' ], $response );
518
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
519 519
 
520 520
 				$response_keys = array(
521 521
 					'license_name'   => '',
@@ -530,19 +530,19 @@  discard block
 block discarded – undo
530 530
 				// Make sure all the keys are set
531 531
 				$response = wp_parse_args( $response, $response_keys );
532 532
 
533
-				$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' ) );
534
-				$local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
533
+				$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' ) );
534
+				$local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
535 535
 				$details    = array(
536
-					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ),
537
-					'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,
538
-					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text,
539
-					'expires'     => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ),
540
-					'upgrade'     => $this->get_upgrade_html( $response['upgrades'] ),
536
+					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ),
537
+					'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,
538
+					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text,
539
+					'expires'     => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ),
540
+					'upgrade'     => $this->get_upgrade_html( $response[ 'upgrades' ] ),
541 541
 				);
542 542
 
543
-				if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) {
544
-					unset( $details['upgrade'] );
545
-					$details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
543
+				if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) {
544
+					unset( $details[ 'upgrade' ] );
545
+					$details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
546 546
 				}
547 547
 
548 548
 				$return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>';
@@ -565,11 +565,11 @@  discard block
 block discarded – undo
565 565
 
566 566
 		$output = '';
567 567
 
568
-		if( ! empty( $upgrades ) ) {
568
+		if ( ! empty( $upgrades ) ) {
569 569
 
570 570
 			$locale_parts = explode( '_', get_locale() );
571 571
 
572
-			$is_english = ( 'en' === $locale_parts[0] );
572
+			$is_english = ( 'en' === $locale_parts[ 0 ] );
573 573
 
574 574
 			$output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>';
575 575
 
@@ -577,14 +577,14 @@  discard block
 block discarded – undo
577 577
 
578 578
 			foreach ( $upgrades as $upgrade_id => $upgrade ) {
579 579
 
580
-				$upgrade = (object) $upgrade;
580
+				$upgrade = (object)$upgrade;
581 581
 
582 582
 				$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 ) );
583 583
 
584
-				if( $is_english && isset( $upgrade->description ) ) {
584
+				if ( $is_english && isset( $upgrade->description ) ) {
585 585
 					$message = esc_html( $upgrade->description );
586 586
 				} else {
587
-					switch( $upgrade->price_id ) {
587
+					switch ( $upgrade->price_id ) {
588 588
 						// Interstellar
589 589
 						case 1:
590 590
 						default:
@@ -622,16 +622,16 @@  discard block
 block discarded – undo
622 622
 	 */
623 623
 	public function license_call( $array = array() ) {
624 624
 
625
-		$is_ajax = ( defined('DOING_AJAX') && DOING_AJAX );
626
-		$data = empty( $array ) ? $_POST['data'] : $array;
625
+		$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
626
+		$data = empty( $array ) ? $_POST[ 'data' ] : $array;
627 627
 		$has_cap = GVCommon::has_cap( 'gravityview_edit_settings' );
628 628
 
629
-		if ( $is_ajax && empty( $data['license'] ) ) {
630
-			die( - 1 );
629
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
630
+			die( -1 );
631 631
 		}
632 632
 
633 633
 		// If the user isn't allowed to edit settings, show an error message
634
-		if( ! $has_cap && empty( $data['all_caps'] ) ) {
634
+		if ( ! $has_cap && empty( $data[ 'all_caps' ] ) ) {
635 635
 			$license_data = new stdClass();
636 636
 			$license_data->error = 'capability';
637 637
 			$license_data->message = $this->get_license_message( $license_data );
@@ -655,11 +655,11 @@  discard block
 block discarded – undo
655 655
 
656 656
 			$json = json_encode( $license_data );
657 657
 
658
-			$update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) );
658
+			$update_license = ( ! isset( $data[ 'update' ] ) || ! empty( $data[ 'update' ] ) );
659 659
 
660
-			$is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX );
660
+			$is_check_action_button = ( 'check_license' === $data[ 'edd_action' ] && defined( 'DOING_AJAX' ) && DOING_AJAX );
661 661
 
662
-			if( $is_check_action_button ) {
662
+			if ( $is_check_action_button ) {
663 663
 				delete_transient( self::status_transient_key );
664 664
 			}
665 665
 			// Failed is the response from trying to de-activate a license and it didn't work.
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 			// most likely a mistake.
669 669
 			else if ( $license_data->license !== 'failed' && $update_license ) {
670 670
 
671
-				if ( ! empty( $data['field_id'] ) ) {
671
+				if ( ! empty( $data[ 'field_id' ] ) ) {
672 672
 					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
673 673
 				}
674 674
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 		if ( $is_ajax ) {
680 680
 			exit( $json );
681 681
 		} else { // Non-ajax call
682
-			return ( rgget('format', $data ) === 'object' ) ? $license_data : $json;
682
+			return ( rgget( 'format', $data ) === 'object' ) ? $license_data : $json;
683 683
 		}
684 684
 	}
685 685
 
@@ -693,9 +693,9 @@  discard block
 block discarded – undo
693 693
 		// Update option with passed data license
694 694
 		$settings = $this->Addon->get_app_settings();
695 695
 
696
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
697
-		$settings['license_key_status'] = $license_data->license;
698
-		$settings['license_key_response'] = (array)$license_data;
696
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
697
+		$settings[ 'license_key_status' ] = $license_data->license;
698
+		$settings[ 'license_key_response' ] = (array)$license_data;
699 699
 
700 700
 		$this->Addon->update_app_settings( $settings );
701 701
 	}
@@ -710,9 +710,9 @@  discard block
 block discarded – undo
710 710
 
711 711
 		$license_data = is_array( $license_data ) ? (object)$license_data : $license_data;
712 712
 
713
-		if( ! empty( $license_data->renewal_url ) ) {
713
+		if ( ! empty( $license_data->renewal_url ) ) {
714 714
 			$renew_license_url = $license_data->renewal_url;
715
-		} elseif( ! empty( $license_data->license_key ) ) {
715
+		} elseif ( ! empty( $license_data->license_key ) ) {
716 716
 			$renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key );
717 717
 		} else {
718 718
 			$renew_license_url = 'https://gravityview.co/account/';
@@ -734,31 +734,31 @@  discard block
 block discarded – undo
734 734
 
735 735
 
736 736
 		$strings = array(
737
-			'status' => esc_html__('Status', 'gravityview'),
738
-			'error' => esc_html__('There was an error processing the request.', 'gravityview'),
739
-			'failed'  => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'),
740
-			'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'),
741
-			'inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'),
742
-			'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
743
-			'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'),
744
-			'valid' => esc_html__('The license key is valid and active.', 'gravityview'),
745
-			'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'),
746
-			'missing' => esc_html__('Invalid license key.', 'gravityview'),
747
-			'revoked' => esc_html__('This license key has been revoked.', 'gravityview'),
748
-			'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>' ),
737
+			'status' => esc_html__( 'Status', 'gravityview' ),
738
+			'error' => esc_html__( 'There was an error processing the request.', 'gravityview' ),
739
+			'failed'  => esc_html__( 'Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview' ),
740
+			'site_inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ),
741
+			'inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ),
742
+			'no_activations_left' => esc_html__( 'Invalid: this license has reached its activation limit.', 'gravityview' ) . ' ' . sprintf( esc_html__( 'You can manage license activations %son your GravityView account page%s.', 'gravityview' ), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
743
+			'deactivated' => esc_html__( 'The license has been deactivated.', 'gravityview' ),
744
+			'valid' => esc_html__( 'The license key is valid and active.', 'gravityview' ),
745
+			'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ),
746
+			'missing' => esc_html__( 'Invalid license key.', 'gravityview' ),
747
+			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
748
+			'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>' ),
749 749
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
750 750
 
751
-			'verifying_license' => esc_html__('Verifying license&hellip;', 'gravityview'),
752
-			'activate_license' => esc_html__('Activate License', 'gravityview'),
753
-			'deactivate_license' => esc_html__('Deactivate License', 'gravityview'),
754
-			'check_license' => esc_html__('Verify License', 'gravityview'),
751
+			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
752
+			'activate_license' => esc_html__( 'Activate License', 'gravityview' ),
753
+			'deactivate_license' => esc_html__( 'Deactivate License', 'gravityview' ),
754
+			'check_license' => esc_html__( 'Verify License', 'gravityview' ),
755 755
 		);
756 756
 
757
-		if( empty( $status ) ) {
757
+		if ( empty( $status ) ) {
758 758
 			return $strings;
759 759
 		}
760 760
 
761
-		if( isset( $strings[ $status ] ) ) {
761
+		if ( isset( $strings[ $status ] ) ) {
762 762
 			return $strings[ $status ];
763 763
 		}
764 764
 
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-woothemes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 		$gv_page = gravityview_is_admin_page( '', 'single' );
79 79
 
80 80
 		// New View or Edit View page
81
-		if( $gv_page && $pagenow === 'post-new.php' ) {
81
+		if ( $gv_page && $pagenow === 'post-new.php' ) {
82 82
 			remove_meta_box( 'woothemes-settings', 'gravityview', 'normal' );
83 83
 		}
84 84
 	}
Please login to merge, or discard this patch.
includes/class-debug-bar.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 	function init() {
22 22
 
23 23
 		$icon = is_admin() ? '<i class="icon gv-icon-astronaut-head"></i>&nbsp;' : NULL;
24
-		$this->title( $icon . __('GravityView', 'gravityview') );
24
+		$this->title( $icon . __( 'GravityView', 'gravityview' ) );
25 25
 	}
26 26
 
27 27
 	function get_warnings() {
28 28
 
29
-		if( is_null( $this->warnings ) ) {
29
+		if ( is_null( $this->warnings ) ) {
30 30
 			$this->warnings = GravityView_Logging::get_errors();
31 31
 		}
32 32
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
 	function get_notices() {
37 37
 
38
-		if( is_null( $this->notices ) ) {
38
+		if ( is_null( $this->notices ) ) {
39 39
 			$this->notices = GravityView_Logging::get_notices();
40 40
 		}
41 41
 
@@ -84,27 +84,27 @@  discard block
 block discarded – undo
84 84
 		</style>
85 85
 		<div id='debug-bar-gravityview'>";
86 86
 
87
-		$output .= '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="alignright" alt="" width="100" height="132" />';
87
+		$output .= '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="alignright" alt="" width="100" height="132" />';
88 88
 
89 89
 
90 90
 		$warnings = $this->get_warnings();
91 91
 		$notices = $this->get_notices();
92 92
 
93
-		if(count($warnings)) {
94
-			$output .= '<h3><span>'.__('Warnings', 'gravityview').'</span></h3>';
93
+		if ( count( $warnings ) ) {
94
+			$output .= '<h3><span>' . __( 'Warnings', 'gravityview' ) . '</span></h3>';
95 95
 			$output .= '<ol>';
96
-			foreach ( $warnings as $key => $notice) {
97
-				if(empty($notice['message'])) { continue; }
98
-				$output .= '<li><a href="#'.sanitize_html_class( 'gv-warning-' . $key ).'">'.strip_tags($notice['message']).'</a></li>';
96
+			foreach ( $warnings as $key => $notice ) {
97
+				if ( empty( $notice[ 'message' ] ) ) { continue; }
98
+				$output .= '<li><a href="#' . sanitize_html_class( 'gv-warning-' . $key ) . '">' . strip_tags( $notice[ 'message' ] ) . '</a></li>';
99 99
 			}
100 100
 			$output .= '</ol><hr />';
101 101
 		}
102
-		if(count($notices)) {
103
-			$output .= '<h3><span>'.__('Logs', 'gravityview').'</span></h3>';
102
+		if ( count( $notices ) ) {
103
+			$output .= '<h3><span>' . __( 'Logs', 'gravityview' ) . '</span></h3>';
104 104
 			$output .= '<ol>';
105
-			foreach ( $notices as $key => $notice) {
106
-				if(empty($notice['message'])) { continue; }
107
-				$output .= '<li><a href="#'.sanitize_html_class( 'gv-notice-' . $key ).'">'.strip_tags($notice['message']).'</a></li>';
105
+			foreach ( $notices as $key => $notice ) {
106
+				if ( empty( $notice[ 'message' ] ) ) { continue; }
107
+				$output .= '<li><a href="#' . sanitize_html_class( 'gv-notice-' . $key ) . '">' . strip_tags( $notice[ 'message' ] ) . '</a></li>';
108 108
 			}
109 109
 			$output .= '</ol><hr />';
110 110
 		}
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 		if ( count( $warnings ) ) {
113 113
 			$output .= '<h3>Warnings</h3>';
114 114
 			$output .= '<ol class="debug-bar-php-list">';
115
-			foreach ( $warnings as $key => $notice) { $output .= $this->render_item( $notice, 'gv-warning-'  . $key ); }
115
+			foreach ( $warnings as $key => $notice ) { $output .= $this->render_item( $notice, 'gv-warning-' . $key ); }
116 116
 			$output .= '</ol>';
117 117
 		}
118 118
 
119 119
 		if ( count( $notices ) ) {
120 120
 			$output .= '<h3>Notices</h3>';
121 121
 			$output .= '<ol class="debug-bar-php-list">';
122
-			foreach ( $notices as $key => $notice) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); }
122
+			foreach ( $notices as $key => $notice ) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); }
123 123
 			$output .= '</ol>';
124 124
 		}
125 125
 
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 	 * @param  string|array $item Unescaped
134 134
 	 * @return string       Escaped HTML
135 135
 	 */
136
-	function esc_html_recursive($item) {
137
-		if(is_object($item)) {
138
-			foreach($item as $key => $value) {
139
-				$item->{$key} = $this->esc_html_recursive($value);
136
+	function esc_html_recursive( $item ) {
137
+		if ( is_object( $item ) ) {
138
+			foreach ( $item as $key => $value ) {
139
+				$item->{$key} = $this->esc_html_recursive( $value );
140 140
 			}
141
-		} else if(is_array($item)) {
142
-			foreach($item as $key => $value) {
143
-				$item[$key] = $this->esc_html_recursive($value);
141
+		} else if ( is_array( $item ) ) {
142
+			foreach ( $item as $key => $value ) {
143
+				$item[ $key ] = $this->esc_html_recursive( $value );
144 144
 			}
145 145
 		} else {
146
-			$item = esc_html($item);
146
+			$item = esc_html( $item );
147 147
 		}
148 148
 		return $item;
149 149
 	}
@@ -159,26 +159,26 @@  discard block
 block discarded – undo
159 159
 
160 160
 		$output = '';
161 161
 
162
-		if(!empty($notice['message'])) {
163
-			$output .= '<a id="'.sanitize_html_class( $anchor ).'"></a>';
162
+		if ( ! empty( $notice[ 'message' ] ) ) {
163
+			$output .= '<a id="' . sanitize_html_class( $anchor ) . '"></a>';
164 164
 			$output .= "<li class='debug-bar-php-notice'>";
165 165
 		}
166 166
 
167 167
 		$output .= '<div class="clear"></div>';
168 168
 
169 169
 		// Title
170
-		$output .= '<div class="gravityview-debug-bar-title">'.esc_attr( $notice['message'] ).'</div>';
170
+		$output .= '<div class="gravityview-debug-bar-title">' . esc_attr( $notice[ 'message' ] ) . '</div>';
171 171
 
172 172
 		// Debugging Output
173
-		if( empty( $notice['data'] ) ) {
174
-			if( !is_null( $notice['data'] ) ) {
175
-				$output .= '<em>'._x('Empty', 'Debugging output data is empty.', 'gravityview' ).'</em>';
173
+		if ( empty( $notice[ 'data' ] ) ) {
174
+			if ( ! is_null( $notice[ 'data' ] ) ) {
175
+				$output .= '<em>' . _x( 'Empty', 'Debugging output data is empty.', 'gravityview' ) . '</em>';
176 176
 			}
177 177
 		} else {
178
-			$output .= sprintf( '<pre>%s</pre>', print_r($this->esc_html_recursive( $notice['data'] ), true) );
178
+			$output .= sprintf( '<pre>%s</pre>', print_r( $this->esc_html_recursive( $notice[ 'data' ] ), true ) );
179 179
 		}
180 180
 
181
-		if(!empty($notice['message'])) {
181
+		if ( ! empty( $notice[ 'message' ] ) ) {
182 182
 			$output .= '</li>';
183 183
 		}
184 184
 
Please login to merge, or discard this patch.
includes/default-widgets.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,4 +5,4 @@
 block discarded – undo
5 5
  * @deprecated 1.7.5
6 6
  */
7 7
 
8
-include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' );
8
+include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' );
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-html.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
29 29
 
30
-		unset ( $field_options['search_filter'], $field_options['show_as_link'] );
30
+		unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] );
31 31
 
32 32
 		return $field_options;
33 33
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-number.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@
 block discarded – undo
28 28
 
29 29
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
30 30
 
31
-		$field_options['number_format'] = array(
31
+		$field_options[ 'number_format' ] = array(
32 32
 			'type' => 'checkbox',
33 33
 			'label' => __( 'Format number?', 'gravityview' ),
34
-			'desc' => __('Display numbers with thousands separators.', 'gravityview'),
34
+			'desc' => __( 'Display numbers with thousands separators.', 'gravityview' ),
35 35
 			'value' => false,
36 36
 		);
37 37
 
38
-		$field_options['decimals'] = array(
38
+		$field_options[ 'decimals' ] = array(
39 39
 			'type' => 'number',
40 40
 			'label' => __( 'Decimals', 'gravityview' ),
41
-			'desc' => __('Precision of the number of decimal places. Leave blank to use existing precision.', 'gravityview'),
41
+			'desc' => __( 'Precision of the number of decimal places. Leave blank to use existing precision.', 'gravityview' ),
42 42
 			'value' => '',
43 43
 			'merge_tags' => false,
44 44
 		);
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-id.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
31 31
 
32
-		$this->add_field_support('link_to_post', $field_options );
32
+		$this->add_field_support( 'link_to_post', $field_options );
33 33
 
34 34
 		return $field_options;
35 35
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-title.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@
 block discarded – undo
25 25
 
26 26
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
27 27
 
28
-		if( 'edit' === $context ) {
28
+		if ( 'edit' === $context ) {
29 29
 			return $field_options;
30 30
 		}
31 31
 
32
-		$this->add_field_support('link_to_post', $field_options );
32
+		$this->add_field_support( 'link_to_post', $field_options );
33 33
 
34
-		$this->add_field_support('dynamic_data', $field_options );
34
+		$this->add_field_support( 'dynamic_data', $field_options );
35 35
 
36 36
 		return $field_options;
37 37
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-date-created.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 
33 33
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
34 34
 
35
-		if( 'edit' === $context ) {
35
+		if ( 'edit' === $context ) {
36 36
 			return $field_options;
37 37
 		}
38 38
 
39
-		$this->add_field_support('date_display', $field_options );
39
+		$this->add_field_support( 'date_display', $field_options );
40 40
 
41 41
 		return $field_options;
42 42
 	}
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 	public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) {
59 59
 
60 60
 		/** Overridden by a template. */
61
-		if( ! empty( $field['field_path'] ) ) { return $output; }
61
+		if ( ! empty( $field[ 'field_path' ] ) ) { return $output; }
62 62
 
63
-		return GVCommon::format_date( $field['value'], 'format='.rgar( $field_settings, 'date_display' ) );
63
+		return GVCommon::format_date( $field[ 'value' ], 'format=' . rgar( $field_settings, 'date_display' ) );
64 64
 	}
65 65
 
66 66
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return string Original text if {date_created} isn't found. Otherwise, replaced text.
80 80
 	 */
81
-	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
81
+	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
82 82
 
83 83
 		$return = $text;
84 84
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 
88 88
 		foreach ( $matches as $match ) {
89 89
 
90
-			$full_tag          = $match[0];
91
-			$property          = $match[1];
90
+			$full_tag          = $match[ 0 ];
91
+			$property          = $match[ 1 ];
92 92
 
93 93
 			$formatted_date = GravityView_Merge_Tags::format_date( $date_created, $property );
94 94
 
Please login to merge, or discard this patch.