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.
classes/class-importer.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 			$this->api_username = false;
217 217
 			$this->api_password = false;
218 218
 
219
-            if (isset($temp_options['api']['wetu_api_key']) && '' !== $temp_options['api']['wetu_api_key']) {
220
-                $this->api_key = $temp_options['api']['wetu_api_key'];
221
-            }
222
-            if (isset($temp_options['api']['wetu_api_username']) && '' !== $temp_options['api']['wetu_api_username']) {
223
-                $this->api_username = $temp_options['api']['wetu_api_username'];
224
-            }
225
-            if (isset($temp_options['api']['wetu_api_password']) && '' !== $temp_options['api']['wetu_api_password']) {
226
-                $this->api_password = $temp_options['api']['wetu_api_password'];
227
-            }
219
+			if (isset($temp_options['api']['wetu_api_key']) && '' !== $temp_options['api']['wetu_api_key']) {
220
+				$this->api_key = $temp_options['api']['wetu_api_key'];
221
+			}
222
+			if (isset($temp_options['api']['wetu_api_username']) && '' !== $temp_options['api']['wetu_api_username']) {
223
+				$this->api_username = $temp_options['api']['wetu_api_username'];
224
+			}
225
+			if (isset($temp_options['api']['wetu_api_password']) && '' !== $temp_options['api']['wetu_api_password']) {
226
+				$this->api_password = $temp_options['api']['wetu_api_password'];
227
+			}
228 228
 
229 229
 			//Set the tab slug
230 230
 			if(isset($_GET['tab']) || isset($_POST['type'])) {
@@ -240,22 +240,22 @@  discard block
 block discarded – undo
240 240
 			}
241 241
 
242 242
 			//Set the scaling options
243
-            if (isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug]) && isset($this->options['image_scaling'])) {
244
-                $this->scale_images = true;
245
-                $width = '1024';
246
-                if (isset($this->options['width']) && '' !== $this->options['width']) {
247
-                    $width = $this->options['width'];
248
-                }
249
-                $height = '768';
250
-                if (isset($this->options['height']) && '' !== $this->options['height']) {
251
-                    $height = $this->options['height'];
252
-                }
253
-                $cropping = 'w';
254
-                if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
255
-                    $cropping = $this->options['cropping'];
256
-                }
257
-                $this->image_scaling_url = 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
258
-            }
243
+			if (isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug]) && isset($this->options['image_scaling'])) {
244
+				$this->scale_images = true;
245
+				$width = '1024';
246
+				if (isset($this->options['width']) && '' !== $this->options['width']) {
247
+					$width = $this->options['width'];
248
+				}
249
+				$height = '768';
250
+				if (isset($this->options['height']) && '' !== $this->options['height']) {
251
+					$height = $this->options['height'];
252
+				}
253
+				$cropping = 'w';
254
+				if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
255
+					$cropping = $this->options['cropping'];
256
+				}
257
+				$this->image_scaling_url = 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
258
+			}
259 259
 
260 260
 		}
261 261
 	}
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 
330 330
 	// DISPLAY FUNCTIONS
331 331
 
332
-    /*
332
+	/*
333 333
      * Load the importer class you want to use
334 334
      */
335
-    public function load_class(){
335
+	public function load_class(){
336 336
 
337 337
 		switch($this->tab_slug){
338 338
 			case 'accommodation':
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 				break;
353 353
 		}
354 354
 
355
-    }
355
+	}
356 356
 
357 357
 	/**
358 358
 	 * Registers the admin page which will house the importer form.
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 				<?php*/
409 409
 			}else{
410 410
 			   $this->current_importer->display_page();
411
-            }; ?>
411
+			}; ?>
412 412
         </div>
413 413
 		<?php
414 414
 	}
@@ -808,12 +808,12 @@  discard block
 block discarded – undo
808 808
 	 */
809 809
 	public function set_featured_image($data,$id) {
810 810
 		if(is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])){
811
-		    if('tour' === $this->tab_slug){
812
-		        $key = array_rand($data[0]['content']['images']);
813
-                $this->featured_image = $this->attach_image($data[0]['content']['images'][$key],$id);
814
-            }else{
811
+			if('tour' === $this->tab_slug){
812
+				$key = array_rand($data[0]['content']['images']);
813
+				$this->featured_image = $this->attach_image($data[0]['content']['images'][$key],$id);
814
+			}else{
815 815
 				$this->featured_image = $this->attach_image($data[0]['content']['images'][0],$id);
816
-            }
816
+			}
817 817
 
818 818
 
819 819
 			if(false !== $this->featured_image){
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 	 */
834 834
 	public function set_banner_image($data,$id) {
835 835
 		if(is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])){
836
-		    if(isset($data[0]['destination_image']) && is_array($data[0]['destination_image'])) {
836
+			if(isset($data[0]['destination_image']) && is_array($data[0]['destination_image'])) {
837 837
 				$temp_banner = $this->attach_image($data[0]['destination_image'], $id, array('width' => '1920', 'height' => '600', 'cropping' => 'c'));
838 838
 			}else{
839 839
 				if ('tour' === $this->tab_slug) {
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 				} else {
843 843
 					$temp_banner = $this->attach_image($data[0]['content']['images'][1], $id, array('width' => '1920', 'height' => '600', 'cropping' => 'c'));
844 844
 				}
845
-            }
845
+			}
846 846
 
847 847
 
848 848
 			if(false !== $temp_banner){
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 	 * Run through the accommodation grabbed from the DB.
1055 1055
 	 */
1056 1056
 	public function process_ajax_search() {
1057
-	    $this->current_importer->process_ajax_search();
1057
+		$this->current_importer->process_ajax_search();
1058 1058
 		die();
1059 1059
 	}
1060 1060
 
Please login to merge, or discard this patch.