Completed
Push — master ( b537c5...4e63e0 )
by Warwick
03:12
created
classes/class-destination.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		//	$this->url    = 'https://wetu.com/API/Pins/';
79 79
 		//	$this->url_qs = 'username=' . $this->api_username . '&password=' . $this->api_password;
80 80
 		//} elseif ( false !== $this->api_key ) {
81
-		$this->url = 'https://wetu.com/API/Pins/' . $this->api_key;
81
+		$this->url = 'https://wetu.com/API/Pins/'.$this->api_key;
82 82
 		$this->url_qs = '';
83 83
 		//}
84 84
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
 				if (isset($_POST['keyword'])) {
324 324
 					$keyphrases = $_POST['keyword'];
325
-				} else {
325
+				}else {
326 326
 					$keyphrases = array(0);
327 327
 				}
328 328
 
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
 					foreach ($destination as $row) {
355 355
 
356 356
 						//If we are searching for
357
-						if('import' === $post_status) {
358
-							if(is_array($this->queued_imports) && in_array($row->post_id,$this->queued_imports)){
359
-								$searched_items[sanitize_title($row->name) . '-' . $row->meta_value] = $this->format_row($row);
360
-							}else{
357
+						if ('import' === $post_status) {
358
+							if (is_array($this->queued_imports) && in_array($row->post_id, $this->queued_imports)) {
359
+								$searched_items[sanitize_title($row->name).'-'.$row->meta_value] = $this->format_row($row);
360
+							}else {
361 361
 								continue;
362 362
 							}
363 363
 						}else if (false !== $post_status) {
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
 							if ($current_status !== $post_status) {
367 367
 								continue;
368 368
 							}
369
-							$searched_items[sanitize_title($row->name) . '-' . $row->meta_value] = $this->format_row($row);
369
+							$searched_items[sanitize_title($row->name).'-'.$row->meta_value] = $this->format_row($row);
370 370
 
371 371
 
372
-						} else {
372
+						}else {
373 373
 							//Search through each keyword.
374 374
 							foreach ($keyphrases as $keyphrase) {
375 375
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 								}
381 381
 
382 382
 								if ($this->multineedle_stripos(ltrim(rtrim($row->name)), $keywords) !== false) {
383
-									$searched_items[sanitize_title($row->name) . '-' . $row->meta_value] = $this->format_row($row);
383
+									$searched_items[sanitize_title($row->name).'-'.$row->meta_value] = $this->format_row($row);
384 384
 								}
385 385
 							}
386 386
 						}
@@ -406,23 +406,23 @@  discard block
 block discarded – undo
406 406
 
407 407
 			$status = 'import';
408 408
 			if (0 !== $row->post_id) {
409
-				$status = '<a href="' . admin_url('/post.php?post=' . $row->post_id . '&action=edit') . '" target="_blank">' . get_post_status($row->post_id) . '</a>';
409
+				$status = '<a href="'.admin_url('/post.php?post='.$row->post_id.'&action=edit').'" target="_blank">'.get_post_status($row->post_id).'</a>';
410 410
 			}
411 411
 
412 412
 			$row_html = '
413
-			<tr class="post-' . $row->post_id . ' type-tour" id="post-' . $row->post_id . '">
413
+			<tr class="post-' . $row->post_id.' type-tour" id="post-'.$row->post_id.'">
414 414
 				<th class="check-column" scope="row">
415
-					<label for="cb-select-' . $row->meta_value . '" class="screen-reader-text">' . $row->name . '</label>
416
-					<input type="checkbox" data-identifier="' . $row->meta_value . '" value="' . $row->post_id . '" name="post[]" id="cb-select-' . $row->meta_value . '">
415
+					<label for="cb-select-' . $row->meta_value.'" class="screen-reader-text">'.$row->name.'</label>
416
+					<input type="checkbox" data-identifier="' . $row->meta_value.'" value="'.$row->post_id.'" name="post[]" id="cb-select-'.$row->meta_value.'">
417 417
 				</th>
418 418
 				<td class="post-title page-title column-title">
419
-					<strong>' . $row->name . '</strong> - ' . $status . '
419
+					<strong>' . $row->name.'</strong> - '.$status.'
420 420
 				</td>
421 421
 				<td class="date column-date">
422
-					<abbr title="' . date('Y/m/d', strtotime($row->last_modified)) . '">' . date('Y/m/d', strtotime($row->last_modified)) . '</abbr><br>Last Modified
422
+					<abbr title="' . date('Y/m/d', strtotime($row->last_modified)).'">'.date('Y/m/d', strtotime($row->last_modified)).'</abbr><br>Last Modified
423 423
 				</td>
424 424
 				<td class="ssid column-ssid">
425
-					' . $row->meta_value . '
425
+					' . $row->meta_value.'
426 426
 				</td>
427 427
 			</tr>';
428 428
 			return $row_html;
@@ -441,13 +441,13 @@  discard block
 block discarded – undo
441 441
 			if (isset($_POST['post_id'])) {
442 442
 				$post_id = $_POST['post_id'];
443 443
 				$this->current_post = get_post($post_id);
444
-			} else {
444
+			}else {
445 445
 				$post_id = 0;
446 446
 			}
447 447
 
448 448
 			if (isset($_POST['team_members'])) {
449 449
 				$team_members = $_POST['team_members'];
450
-			} else {
450
+			}else {
451 451
 				$team_members = false;
452 452
 			}
453 453
 
@@ -457,11 +457,11 @@  discard block
 block discarded – undo
457 457
 			if (isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])) {
458 458
 				$content = $_POST['content'];
459 459
 				add_option('wetu_importer_destination_settings', $content);
460
-			} else {
460
+			}else {
461 461
 				$content = false;
462 462
 			}
463 463
 
464
-			$jdata = file_get_contents($this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id);
464
+			$jdata = file_get_contents($this->url.'/Get?'.$this->url_qs.'&ids='.$wetu_id);
465 465
 			if ($jdata) {
466 466
 				$adata = json_decode($jdata, true);
467 467
 
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 					$return = $this->import_row($adata, $wetu_id, $post_id, $team_members, $content, $safari_brands);
470 470
 					$this->remove_from_queue($return);
471 471
 					$this->format_completed_row($return);
472
-				}else{
473
-				    if(isset($adata['error'])){
472
+				}else {
473
+				    if (isset($adata['error'])) {
474 474
 				        $this->format_error($adata['error']);
475
-                    }else{
476
-						$this->format_error(esc_html__('There was a problem importing your destination, please try refreshing the page.','wetu-importer'));
475
+                    }else {
476
+						$this->format_error(esc_html__('There was a problem importing your destination, please try refreshing the page.', 'wetu-importer'));
477 477
                     }
478 478
                 }
479 479
 			}
@@ -486,11 +486,11 @@  discard block
 block discarded – undo
486 486
 	public function remove_from_queue($id) {
487 487
 		if (!empty($this->queued_imports)) {
488 488
 
489
-			if(($key = array_search($id, $this->queued_imports)) !== false) {
489
+			if (($key = array_search($id, $this->queued_imports)) !== false) {
490 490
 				unset($this->queued_imports[$key]);
491 491
 
492 492
 				delete_option('wetu_importer_que');
493
-				update_option('wetu_importer_que',$this->queued_imports);
493
+				update_option('wetu_importer_que', $this->queued_imports);
494 494
 			}
495 495
 		}
496 496
 	}
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 				$id = wp_update_post($post);
526 526
 				$prev_date = get_post_meta($id, 'lsx_wetu_modified_date', true);
527 527
 				update_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']), $prev_date);
528
-			} else {
528
+			}else {
529 529
 
530 530
 				//Set the name
531 531
 				if (isset($data[0]['name'])) {
@@ -627,9 +627,9 @@  discard block
 block discarded – undo
627 627
 	public function set_team_member($id, $team_members)
628 628
 	{
629 629
 
630
-		delete_post_meta($id, 'team_to_' . $this->tab_slug);
630
+		delete_post_meta($id, 'team_to_'.$this->tab_slug);
631 631
 		foreach ($team_members as $team) {
632
-			add_post_meta($id, 'team_to_' . $this->tab_slug, $team);
632
+			add_post_meta($id, 'team_to_'.$this->tab_slug, $team);
633 633
 		}
634 634
 	}
635 635
 
Please login to merge, or discard this patch.