Passed
Push — master ( 65f2fd...a92f6e )
by Fernando
02:12
created
classes/class-lsx-api-manager.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @since 1.0.0
200 200
 	 *
201
-	 * @return    object A single instance of this class.
201
+	 * @return    false|null A single instance of this class.
202 202
 	 */
203 203
 	public function dashboard_tabs($tab='general') {
204 204
 		if('api' !== $tab){ return false;}
@@ -395,7 +395,6 @@  discard block
 block discarded – undo
395 395
 
396 396
 	/**
397 397
 	 * Formats the error code into a readable format.
398
-	 * @param  array $args
399 398
 	 * @return array
400 399
 	 */
401 400
 	public function format_error_code($code=false){
Please login to merge, or discard this patch.
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -99,32 +99,32 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function __construct($api_array = array()) {
101 101
 
102
-		if(isset($api_array['api_key'])){
102
+		if (isset($api_array['api_key'])) {
103 103
 			$api_array['api_key'] = trim($api_array['api_key']);
104
-			if('dev-' === substr($api_array['api_key'], 0, 4)){
104
+			if ('dev-' === substr($api_array['api_key'], 0, 4)) {
105 105
 				$this->dev_mode = true;
106 106
 				$api_array['api_key'] = preg_replace('/^(dev-)(.*)$/i', '${2}', $api_array['api_key']);
107 107
 			}
108 108
 			$this->api_key = $api_array['api_key'];
109 109
 		}
110
-		if(isset($api_array['email'])){
110
+		if (isset($api_array['email'])) {
111 111
 			$this->email = trim($api_array['email']);
112 112
 		}
113
-		if(isset($api_array['product_id'])){
113
+		if (isset($api_array['product_id'])) {
114 114
 			$this->product_id = $api_array['product_id'];
115 115
 			$this->product_slug = sanitize_title($api_array['product_id']);
116 116
 		}
117
-		if(isset($api_array['version'])){
117
+		if (isset($api_array['version'])) {
118 118
 			$this->version = $api_array['version'];
119 119
 		}
120
-		if(isset($api_array['instance'])){
120
+		if (isset($api_array['instance'])) {
121 121
 			$this->password = $api_array['instance'];
122 122
 		}
123
-		if(isset($api_array['file'])){
123
+		if (isset($api_array['file'])) {
124 124
 			$this->file = $api_array['file'];
125 125
 		}
126 126
 
127
-		if(isset($api_array['documentation'])){
127
+		if (isset($api_array['documentation'])) {
128 128
 			$this->documentation = $api_array['documentation'];
129 129
 		}
130 130
 
@@ -132,32 +132,32 @@  discard block
 block discarded – undo
132 132
 			$this->api_url = 'https://dev.lsdev.biz/wc-api/product-key-api';
133 133
 			$this->products_api_url = 'https://dev.lsdev.biz/';
134 134
 			$this->license_check_url = 'https://dev.lsdev.biz/wc-api/license-status-check';
135
-		} else {
135
+		}else {
136 136
 			$this->api_url = 'https://www.lsdev.biz/wc-api/product-key-api';
137 137
 			$this->products_api_url = 'https://www.lsdev.biz/';
138 138
 			$this->license_check_url = 'https://www.lsdev.biz/wc-api/license-status-check';
139 139
 		}
140 140
 
141
-		add_filter( 'plugin_action_links_' . plugin_basename(str_replace('.php','',$this->file).'/'.$this->file), array($this,'add_action_links'));
142
-		$this->status = get_option($this->product_slug.'_status',false);
141
+		add_filter('plugin_action_links_'.plugin_basename(str_replace('.php', '', $this->file).'/'.$this->file), array($this, 'add_action_links'));
142
+		$this->status = get_option($this->product_slug.'_status', false);
143 143
 
144
-		if(isset($_GET['page']) && in_array($_GET['page'],apply_filters('lsx_api_manager_options_pages',array(false)))){
144
+		if (isset($_GET['page']) && in_array($_GET['page'], apply_filters('lsx_api_manager_options_pages', array(false)))) {
145 145
 
146 146
 			//Maybe activate the software, do this before the status checks.
147 147
 			$this->activate_deactivate();
148 148
 
149
-			if(false === $this->status){
149
+			if (false === $this->status) {
150 150
 				$this->status = $this->check_status();
151
-				update_option($this->product_slug.'_status',$this->status);
151
+				update_option($this->product_slug.'_status', $this->status);
152 152
 			}
153 153
 
154 154
 			$button_url = '<a data-product="'.$this->product_slug.'" style="margin-top:-5px;" href="';
155 155
 			$button_label = '';
156
-			$admin_url_base = function_exists( 'tour_operator' ) ? 'admin.php?page=lsx-to-settings' : 'themes.php?page=lsx-settings';
157
-			if(false === $this->status || 'inactive' === $this->status){
156
+			$admin_url_base = function_exists('tour_operator') ? 'admin.php?page=lsx-to-settings' : 'themes.php?page=lsx-settings';
157
+			if (false === $this->status || 'inactive' === $this->status) {
158 158
 				$button_url .= admin_url($admin_url_base.'&action=activate&product='.$this->product_slug);
159 159
 				$button_label = 'Activate';
160
-			}elseif('active' === $this->status){
160
+			}elseif ('active' === $this->status) {
161 161
 				$button_url .= admin_url($admin_url_base.'&action=deactivate&product='.$this->product_slug);
162 162
 				$button_label = 'Deactivate';
163 163
 			}
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
 			$this->button = $button_url;
166 166
 		}
167 167
 
168
-		add_filter('site_transient_update_plugins', array($this,'injectUpdate'));
169
-		add_action( "in_plugin_update_message-".$this->file,array($this,'plugin_update_message'),10,2);
168
+		add_filter('site_transient_update_plugins', array($this, 'injectUpdate'));
169
+		add_action("in_plugin_update_message-".$this->file, array($this, 'plugin_update_message'), 10, 2);
170 170
 
171
-		if ( function_exists( 'tour_operator' ) ) {
172
-			add_action( 'lsx_to_framework_api_tab_content', array( $this, 'dashboard_tabs' ), 1, 1 );
173
-		} else {
174
-			add_action( 'lsx_framework_api_tab_content', array( $this, 'dashboard_tabs' ), 1, 1 );
171
+		if (function_exists('tour_operator')) {
172
+			add_action('lsx_to_framework_api_tab_content', array($this, 'dashboard_tabs'), 1, 1);
173
+		}else {
174
+			add_action('lsx_framework_api_tab_content', array($this, 'dashboard_tabs'), 1, 1);
175 175
 		}
176 176
 
177
-		add_action('wp_ajax_wc_api_'.$this->product_slug,array($this,'activate_deactivate'));
178
-		add_action('wp_ajax_nopriv_wc_api_'.$this->product_slug,array($this,'activate_deactivate'));
177
+		add_action('wp_ajax_wc_api_'.$this->product_slug, array($this, 'activate_deactivate'));
178
+		add_action('wp_ajax_nopriv_wc_api_'.$this->product_slug, array($this, 'activate_deactivate'));
179 179
 	}
180 180
 
181 181
 	/**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public static function get_instance() {
189 189
 		// If the single instance hasn't been set, set it now.
190
-		if ( null == self::$instance ) {
190
+		if (null == self::$instance) {
191 191
 			self::$instance = new self;
192 192
 		}
193 193
 		return self::$instance;
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return    object A single instance of this class.
202 202
 	 */
203
-	public function dashboard_tabs($tab='general') {
204
-		if('api' !== $tab){ return false;}
203
+	public function dashboard_tabs($tab = 'general') {
204
+		if ('api' !== $tab) { return false; }
205 205
 
206
-		if('active' === $this->status){
207
-			$description = __( '<span style="color:#008000;">Your license is now active</span>', $this->product_slug );
208
-		}else{
209
-			$description = __( 'You can find your key on your <a target="_blank" href="https://www.lsdev.biz/my-account/">My Account</a> page.', $this->product_slug );
206
+		if ('active' === $this->status) {
207
+			$description = __('<span style="color:#008000;">Your license is now active</span>', $this->product_slug);
208
+		}else {
209
+			$description = __('You can find your key on your <a target="_blank" href="https://www.lsdev.biz/my-account/">My Account</a> page.', $this->product_slug);
210 210
 		}
211 211
 
212 212
 		?>
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
 				<?php
217 217
 				$colour = 'red';
218
-				if('active' === $this->status){
218
+				if ('active' === $this->status) {
219 219
 					$colour = 'green';
220 220
 				}
221 221
 				?>
@@ -223,18 +223,18 @@  discard block
 block discarded – undo
223 223
 				<h4 style="margin-bottom:0px;">
224 224
 					<span><?php echo $this->product_id; ?></span>
225 225
 					- <span><?php echo $this->version; ?></span>
226
-					- <span style="color:<?php echo $colour;?>;"><?php echo $this->status; ?></span>
226
+					- <span style="color:<?php echo $colour; ?>;"><?php echo $this->status; ?></span>
227 227
 					- <?php echo $this->button; ?>
228 228
 				</h4>
229 229
 
230
-				<?php if ( $this->dev_mode && is_array( $this->messages ) ) { ?><p><small class="messages" style="font-weight:normal;"><?php echo implode( '. ', $this->messages ); ?></small></p><?php }  ?>
230
+				<?php if ($this->dev_mode && is_array($this->messages)) { ?><p><small class="messages" style="font-weight:normal;"><?php echo implode('. ', $this->messages); ?></small></p><?php }  ?>
231 231
 
232 232
 			</th>
233 233
 		</tr>
234 234
 
235 235
 		<tr class="form-field <?php echo $this->product_slug; ?>-api-email-wrap">
236 236
 			<th style="font-size:13px;" scope="row">
237
-				<i class="dashicons-before dashicons-email-alt"></i> <?php esc_html_e( 'Registered Email', $this->product_slug ); ?>
237
+				<i class="dashicons-before dashicons-email-alt"></i> <?php esc_html_e('Registered Email', $this->product_slug); ?>
238 238
 			</th>
239 239
 			<td>
240 240
 				<input type="text" {{#if <?php echo $this->product_slug; ?>_email}} value="{{<?php echo $this->product_slug; ?>_email}}" {{/if}} name="<?php echo $this->product_slug; ?>_email" /><br />
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		</tr>
244 244
 		<tr class="form-field <?php echo $this->product_slug; ?>-api-key-wrap">
245 245
 			<th style="font-size:13px;" scope="row">
246
-				<i class="dashicons-before dashicons-admin-network"></i> <?php esc_html_e( 'API Key', $this->product_slug ); ?>
246
+				<i class="dashicons-before dashicons-admin-network"></i> <?php esc_html_e('API Key', $this->product_slug); ?>
247 247
 			</th>
248 248
 			<td>
249 249
 				<input type="text" {{#if <?php echo $this->product_slug; ?>_api_key}} value="{{<?php echo $this->product_slug; ?>_api_key}}" {{/if}} name="<?php echo $this->product_slug; ?>_api_key" />
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	/**
258 258
 	 * outputs the scripts for the dashboard settings pages.
259 259
 	 */
260
-	public function settings_page_scripts(){ ?>
260
+	public function settings_page_scripts() { ?>
261 261
 		{{#script}}
262 262
 		jQuery( function( $ ){
263 263
 		$( '.<?php echo $this->product_slug; ?>-api-email-wrap input' ).on( 'change', function() {
@@ -287,26 +287,26 @@  discard block
 block discarded – undo
287 287
 	/**
288 288
 	 * Return an instance of this class.
289 289
 	 */
290
-	public function activate_deactivate(){
291
-		if(isset($_GET['action']) && 'activate' === $_GET['action']
290
+	public function activate_deactivate() {
291
+		if (isset($_GET['action']) && 'activate' === $_GET['action']
292 292
 			&& isset($_GET['product']) && $this->product_slug === $_GET['product']
293 293
 			&& false !== $this->api_key && '' !== $this->api_key
294
-			&& false !== $this->email && '' !== $this->email){
294
+			&& false !== $this->email && '' !== $this->email) {
295 295
 
296 296
 
297 297
 			$response = $this->query('activation');
298
-			if(is_object($response) && isset($response->activated) && true === $response->activated){
299
-				update_option($this->product_slug.'_status','active');
298
+			if (is_object($response) && isset($response->activated) && true === $response->activated) {
299
+				update_option($this->product_slug.'_status', 'active');
300 300
 				$this->status = 'active';
301 301
 			}
302 302
 		}
303 303
 
304
-		if((isset($_GET['action']) && 'deactivate' === $_GET['action'] && isset($_GET['product']) && $this->product_slug === $_GET['product'])
305
-			|| (false === $this->api_key || '' === $this->api_key || false === $this->email || '' === $this->email)){
304
+		if ((isset($_GET['action']) && 'deactivate' === $_GET['action'] && isset($_GET['product']) && $this->product_slug === $_GET['product'])
305
+			|| (false === $this->api_key || '' === $this->api_key || false === $this->email || '' === $this->email)) {
306 306
 
307
-			if('active' === $this->status) {
307
+			if ('active' === $this->status) {
308 308
 				$this->query('deactivation');
309
-				update_option($this->product_slug.'_status','inactive');
309
+				update_option($this->product_slug.'_status', 'inactive');
310 310
 				$this->status = 'inactive';
311 311
 			}
312 312
 		}
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 	/**
316 316
 	 * Generates the API URL
317 317
 	 */
318
-	public function create_software_api_url( $args ) {
318
+	public function create_software_api_url($args) {
319 319
 
320 320
 		$endpoint = 'am-software-api';
321
-		if('pluginupdatecheck' === $args['request']){
321
+		if ('pluginupdatecheck' === $args['request']) {
322 322
 			$endpoint = 'upgrade-api';
323 323
 		}
324
-		$api_url = add_query_arg( 'wc-api', $endpoint, $this->products_api_url );
325
-		return $api_url . '&' . http_build_query( $args );
324
+		$api_url = add_query_arg('wc-api', $endpoint, $this->products_api_url);
325
+		return $api_url.'&'.http_build_query($args);
326 326
 	}
327 327
 
328 328
 	/**
@@ -330,23 +330,23 @@  discard block
 block discarded – undo
330 330
 	 * @return string
331 331
 	 */
332 332
 	public function check_status($response = false) {
333
-		if(false === $response){
333
+		if (false === $response) {
334 334
 			$response = $this->query('status');
335 335
 		}
336
-		if ( $this->dev_mode ) {
337
-			$this->messages[] = print_r( $response, true );
336
+		if ($this->dev_mode) {
337
+			$this->messages[] = print_r($response, true);
338 338
 		}
339 339
 		$status = 'inactive';
340
-		if(is_object($response)){
340
+		if (is_object($response)) {
341 341
 
342
-			if(isset($response->error)){
342
+			if (isset($response->error)) {
343 343
 				$this->messages[] = $this->format_error_code($response->code);
344
-			}elseif(isset($response->status_check)){
344
+			}elseif (isset($response->status_check)) {
345 345
 				$status = $response->status_check;
346
-				if(isset($response->activations_remaining)){
346
+				if (isset($response->activations_remaining)) {
347 347
 					$this->messages[] = $response->activations_remaining;
348 348
 				}
349
-				if(isset($response->message)){
349
+				if (isset($response->message)) {
350 350
 					$this->messages[] = $response->message;
351 351
 				}
352 352
 			}
@@ -359,15 +359,15 @@  discard block
 block discarded – undo
359 359
 	 * @param  string $action
360 360
 	 * @return array
361 361
 	 */
362
-	public function query($action='status') {
363
-		if ( 'status' === $action ) {
364
-			$transient_status_id = 'lsx_addon_' . $this->product_id . '_status';
365
-			$response =  get_transient( $transient_status_id );
366
-		} else {
362
+	public function query($action = 'status') {
363
+		if ('status' === $action) {
364
+			$transient_status_id = 'lsx_addon_'.$this->product_id.'_status';
365
+			$response = get_transient($transient_status_id);
366
+		}else {
367 367
 			$response = false;
368 368
 		}
369 369
 
370
-		if ( ! $response ) {
370
+		if (!$response) {
371 371
 			$args = array(
372 372
 				'request' 		=> $action,
373 373
 				'email' 		=> $this->email,
@@ -376,18 +376,18 @@  discard block
 block discarded – undo
376 376
 				'platform' 		=> home_url(),
377 377
 				'instance' 		=> $this->password
378 378
 			);
379
-			$target_url = esc_url_raw( $this->create_software_api_url( $args ) );
379
+			$target_url = esc_url_raw($this->create_software_api_url($args));
380 380
 
381
-			$request = wp_remote_get( $target_url );
382
-			if( is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) != 200 ) {
381
+			$request = wp_remote_get($target_url);
382
+			if (is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) {
383 383
 				// Request failed
384 384
 				return false;
385 385
 			}
386
-			$response = wp_remote_retrieve_body( $request );
387
-			if ( $this->dev_mode ) {
388
-				$this->messages[] = print_r( $response, true );
386
+			$response = wp_remote_retrieve_body($request);
387
+			if ($this->dev_mode) {
388
+				$this->messages[] = print_r($response, true);
389 389
 			}
390
-			set_transient( $transient_status_id, $response, MINUTE_IN_SECONDS );
390
+			set_transient($transient_status_id, $response, MINUTE_IN_SECONDS);
391 391
 		}
392 392
 
393 393
 		return json_decode($response);
@@ -398,28 +398,28 @@  discard block
 block discarded – undo
398 398
 	 * @param  array $args
399 399
 	 * @return array
400 400
 	 */
401
-	public function format_error_code($code=false){
402
-		switch ( $code ) {
401
+	public function format_error_code($code = false) {
402
+		switch ($code) {
403 403
 			case '101' :
404
-				$error = array( 'error' => esc_html__( 'Invalid API License Key. Login to your My Account page to find a valid API License Key', $this->product_slug ), 'code' => '101' );
404
+				$error = array('error' => esc_html__('Invalid API License Key. Login to your My Account page to find a valid API License Key', $this->product_slug), 'code' => '101');
405 405
 				break;
406 406
 			case '102' :
407
-				$error = array( 'error' => esc_html__( 'Software has been deactivated', $this->product_slug ), 'code' => '102' );
407
+				$error = array('error' => esc_html__('Software has been deactivated', $this->product_slug), 'code' => '102');
408 408
 				break;
409 409
 			case '103' :
410
-				$error = array( 'error' => esc_html__( 'Exceeded maximum number of activations', $this->product_slug ), 'code' => '103' );
410
+				$error = array('error' => esc_html__('Exceeded maximum number of activations', $this->product_slug), 'code' => '103');
411 411
 				break;
412 412
 			case '104' :
413
-				$error = array( 'error' => esc_html__( 'Invalid Instance ID', $this->product_slug ), 'code' => '104' );
413
+				$error = array('error' => esc_html__('Invalid Instance ID', $this->product_slug), 'code' => '104');
414 414
 				break;
415 415
 			case '105' :
416
-				$error = array( 'error' => esc_html__( 'Invalid API License Key', $this->product_slug ), 'code' => '105' );
416
+				$error = array('error' => esc_html__('Invalid API License Key', $this->product_slug), 'code' => '105');
417 417
 				break;
418 418
 			case '106' :
419
-				$error = array( 'error' => esc_html__( 'Subscription Is Not Active', $this->product_slug ), 'code' => '106' );
419
+				$error = array('error' => esc_html__('Subscription Is Not Active', $this->product_slug), 'code' => '106');
420 420
 				break;
421 421
 			default :
422
-				$error = array( 'error' => esc_html__( 'Invalid Request', $this->product_slug ), 'code' => '100' );
422
+				$error = array('error' => esc_html__('Invalid Request', $this->product_slug), 'code' => '100');
423 423
 				break;
424 424
 		}
425 425
 	}
@@ -436,15 +436,15 @@  discard block
 block discarded – undo
436 436
 		return $result;
437 437
 	}
438 438
 
439
-	public function set_update_status(){
439
+	public function set_update_status() {
440 440
 		$this->status = $this->check_status();
441
-		$this->upgrade_response = get_transient($this->product_slug.'_upgrade_response',false);
441
+		$this->upgrade_response = get_transient($this->product_slug.'_upgrade_response', false);
442 442
 
443
-		if(false !== $this->upgrade_response){
443
+		if (false !== $this->upgrade_response) {
444 444
 			$this->upgrade_response = maybe_unserialize($this->upgrade_response);
445 445
 		}
446 446
 
447
-		if(isset($this->status) && 'active' === $this->status && false === $this->upgrade_response){
447
+		if (isset($this->status) && 'active' === $this->status && false === $this->upgrade_response) {
448 448
 			$args = array(
449 449
 				'request' 			=> 'pluginupdatecheck',
450 450
 				'plugin_name' 		=> $this->product_slug.'/'.$this->file,
@@ -456,15 +456,15 @@  discard block
 block discarded – undo
456 456
 				'instance' 			=> $this->password,
457 457
 				'software_version'	=> $this->version,
458 458
 			);
459
-			$target_url = esc_url_raw( $this->create_software_api_url( $args ) );
460
-			$request = wp_remote_get( $target_url );
461
-			if( is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) != 200 ) {
459
+			$target_url = esc_url_raw($this->create_software_api_url($args));
460
+			$request = wp_remote_get($target_url);
461
+			if (is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) {
462 462
 				// Request failed
463
-				$this->upgrade_response=false;
463
+				$this->upgrade_response = false;
464 464
 			}
465
-			$response = wp_remote_retrieve_body( $request );
465
+			$response = wp_remote_retrieve_body($request);
466 466
 			$this->upgrade_response = maybe_unserialize($response);
467
-			set_transient($this->product_slug . '_upgrade_response', $response, 60 * 30);
467
+			set_transient($this->product_slug.'_upgrade_response', $response, 60 * 30);
468 468
 		}
469 469
 	}
470 470
 
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
 	 * @param StdClass $updates Update list.
475 475
 	 * @return StdClass Modified update list.
476 476
 	 */
477
-	public function injectUpdate($updates=false){
477
+	public function injectUpdate($updates = false) {
478 478
 		$this->set_update_status();
479
-		if(isset($this->status) && 'active' === $this->status && null !== $this->upgrade_response && is_object($this->upgrade_response) && isset($this->upgrade_response->new_version) && version_compare ( $this->upgrade_response->new_version , $this->version , '>' )){
479
+		if (isset($this->status) && 'active' === $this->status && null !== $this->upgrade_response && is_object($this->upgrade_response) && isset($this->upgrade_response->new_version) && version_compare($this->upgrade_response->new_version, $this->version, '>')) {
480 480
 
481 481
 			//setup the response if our plugin is the only one that needs updating.
482
-			if ( !is_object($updates) ) {
482
+			if (!is_object($updates)) {
483 483
 				$updates = new StdClass();
484 484
 				$updates->response = array();
485 485
 			}
@@ -491,15 +491,15 @@  discard block
 block discarded – undo
491 491
 	/**
492 492
 	 * Adds in the "settings" link for the plugins.php page
493 493
 	 */
494
-	public function add_action_links ( $links ) {
495
-		$admin_url_base = function_exists( 'tour_operator' ) ? 'admin.php?page=lsx-to-settings' : 'themes.php?page=lsx-settings';
494
+	public function add_action_links($links) {
495
+		$admin_url_base = function_exists('tour_operator') ? 'admin.php?page=lsx-to-settings' : 'themes.php?page=lsx-settings';
496 496
 		$documentation = $this->product_slug;
497
-		if(false !== $this->documentation){$documentation = $this->documentation; }
497
+		if (false !== $this->documentation) {$documentation = $this->documentation; }
498 498
 		$mylinks = array(
499
-			'<a href="' . admin_url( $admin_url_base ) . '">'.esc_html__('Settings',$this->product_slug).'</a>',
500
-			'<a href="https://www.lsdev.biz/documentation/'.$documentation.'/" target="_blank">'.esc_html__('Documentation',$this->product_slug).'</a>',
501
-			'<a href="https://www.lsdev.biz/contact-us/" target="_blank">'.esc_html__('Support',$this->product_slug).'</a>',
499
+			'<a href="'.admin_url($admin_url_base).'">'.esc_html__('Settings', $this->product_slug).'</a>',
500
+			'<a href="https://www.lsdev.biz/documentation/'.$documentation.'/" target="_blank">'.esc_html__('Documentation', $this->product_slug).'</a>',
501
+			'<a href="https://www.lsdev.biz/contact-us/" target="_blank">'.esc_html__('Support', $this->product_slug).'</a>',
502 502
 		);
503
-		return array_merge( $links, $mylinks );
503
+		return array_merge($links, $mylinks);
504 504
 	}
505 505
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			if(false === $this->status || 'inactive' === $this->status){
158 158
 				$button_url .= admin_url($admin_url_base.'&action=activate&product='.$this->product_slug);
159 159
 				$button_label = 'Activate';
160
-			}elseif('active' === $this->status){
160
+			} elseif('active' === $this->status){
161 161
 				$button_url .= admin_url($admin_url_base.'&action=deactivate&product='.$this->product_slug);
162 162
 				$button_label = 'Deactivate';
163 163
 			}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 		if('active' === $this->status){
207 207
 			$description = __( '<span style="color:#008000;">Your license is now active</span>', $this->product_slug );
208
-		}else{
208
+		} else{
209 209
 			$description = __( 'You can find your key on your <a target="_blank" href="https://www.lsdev.biz/my-account/">My Account</a> page.', $this->product_slug );
210 210
 		}
211 211
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
 			if(isset($response->error)){
343 343
 				$this->messages[] = $this->format_error_code($response->code);
344
-			}elseif(isset($response->status_check)){
344
+			} elseif(isset($response->status_check)){
345 345
 				$status = $response->status_check;
346 346
 				if(isset($response->activations_remaining)){
347 347
 					$this->messages[] = $response->activations_remaining;
Please login to merge, or discard this patch.
wetu-importer.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,50 +11,50 @@  discard block
 block discarded – undo
11 11
  * Domain Path: /languages/
12 12
  */
13 13
 
14
-define( 'WETU_IMPORTER_PATH',  plugin_dir_path( __FILE__ ) );
15
-define( 'WETU_IMPORTER_CORE',  __FILE__ );
16
-define( 'WETU_IMPORTER_URL',  plugin_dir_url( __FILE__ ) );
17
-define( 'WETU_IMPORTER_VER',  '1.1.0' );
14
+define('WETU_IMPORTER_PATH', plugin_dir_path(__FILE__));
15
+define('WETU_IMPORTER_CORE', __FILE__);
16
+define('WETU_IMPORTER_URL', plugin_dir_url(__FILE__));
17
+define('WETU_IMPORTER_VER', '1.1.0');
18 18
 
19
-register_activation_hook( WETU_IMPORTER_CORE, array( 'WETU_Importer', 'register_activation_hook' ) );
19
+register_activation_hook(WETU_IMPORTER_CORE, array('WETU_Importer', 'register_activation_hook'));
20 20
 
21 21
 /* ======================= The API Classes ========================= */
22 22
 
23
-if ( ! class_exists( 'LSX_API_Manager' ) ) {
24
-	require_once( 'classes/class-lsx-api-manager.php' );
23
+if (!class_exists('LSX_API_Manager')) {
24
+	require_once('classes/class-lsx-api-manager.php');
25 25
 }
26 26
 
27 27
 /**
28 28
  *	Grabs the email and api key from settings.
29 29
  */
30
-function lsx_to_wetu_importer_options_pages_filter( $pages ) {
30
+function lsx_to_wetu_importer_options_pages_filter($pages) {
31 31
 	$pages[] = 'lsx-to-settings';
32 32
 	return $pages;
33 33
 }
34 34
 
35
-add_filter( 'lsx_api_manager_options_pages', 'lsx_to_wetu_importer_options_pages_filter', 10, 1 );
35
+add_filter('lsx_api_manager_options_pages', 'lsx_to_wetu_importer_options_pages_filter', 10, 1);
36 36
 
37 37
 function lsx_to_wetu_importer_api_admin_init() {
38
-	$options = get_option( '_lsx-to_settings', false );
38
+	$options = get_option('_lsx-to_settings', false);
39 39
 
40 40
 	$data = array(
41 41
 		'api_key' => '',
42 42
 		'email' => '',
43 43
 	);
44 44
 
45
-	if ( false !== $options && isset( $options['api'] ) ) {
46
-		if ( isset( $options['api']['wetu-importer_api_key'] ) && '' !== $options['api']['wetu-importer_api_key'] ) {
45
+	if (false !== $options && isset($options['api'])) {
46
+		if (isset($options['api']['wetu-importer_api_key']) && '' !== $options['api']['wetu-importer_api_key']) {
47 47
 			$data['api_key'] = $options['api']['wetu-importer_api_key'];
48 48
 		}
49 49
 
50
-		if ( isset( $options['api']['wetu-importer_email'] ) && '' !== $options['api']['wetu-importer_email'] ) {
50
+		if (isset($options['api']['wetu-importer_email']) && '' !== $options['api']['wetu-importer_email']) {
51 51
 			$data['email'] = $options['api']['wetu-importer_email'];
52 52
 		}
53 53
 	}
54 54
 
55
-	$instance = get_option( 'lsx_api_instance', false );
55
+	$instance = get_option('lsx_api_instance', false);
56 56
 
57
-	if ( false === $instance ) {
57
+	if (false === $instance) {
58 58
 		$instance = LSX_API_Manager::generatePassword();
59 59
 	}
60 60
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 		'file' => 'wetu-importer.php',
68 68
 	);
69 69
 
70
-	$lsx_to_wetu_importer_api_manager = new LSX_API_Manager( $api_array );
70
+	$lsx_to_wetu_importer_api_manager = new LSX_API_Manager($api_array);
71 71
 }
72 72
 
73
-add_action( 'admin_init', 'lsx_to_wetu_importer_api_admin_init' );
73
+add_action('admin_init', 'lsx_to_wetu_importer_api_admin_init');
74 74
 
75 75
 /* ======================= Below is the Plugin Class init ========================= */
76 76
 
77
-require_once( WETU_IMPORTER_PATH . 'classes/class-wetu-importer.php' );
77
+require_once(WETU_IMPORTER_PATH.'classes/class-wetu-importer.php');
78 78
 //require_once(WETU_IMPORTER_PATH.'classes/class-wetu-importer-connect-accommodation.php');
79
-require_once( WETU_IMPORTER_PATH . 'classes/class-wetu-importer-settings.php' );
79
+require_once(WETU_IMPORTER_PATH.'classes/class-wetu-importer-settings.php');
Please login to merge, or discard this patch.