Code Duplication    Length = 21-21 lines in 3 locations

classes/class-tours.php 1 location

@@ 334-354 (lines=21) @@
331
	/**
332
	 * Grab all the current tour posts via the lsx_wetu_id field.
333
	 */
334
	public function find_current_tours() {
335
		global $wpdb;
336
		$return = array();
337
338
		$current_tours = $wpdb->get_results("
339
					SELECT key1.post_id,key1.meta_value
340
					FROM {$wpdb->postmeta} key1
341
342
					INNER JOIN  {$wpdb->posts} key2 
343
    				ON key1.post_id = key2.ID
344
					
345
					WHERE key1.meta_key = 'lsx_wetu_id'
346
					AND key2.post_type = 'tour'
347
348
					LIMIT 0,500
349
		");
350
		if(null !== $current_tours && !empty($current_tours)){
351
			foreach($current_tours as $tour){
352
				$return[$tour->meta_value] = $tour;
353
			}
354
		}
355
		return $return;
356
	}
357

classes/class-destination.php 1 location

@@ 274-294 (lines=21) @@
271
	/**
272
	 * Grab all the current destination posts via the lsx_wetu_id field.
273
	 */
274
	public function find_current_destination($post_type = 'destination')
275
	{
276
		global $wpdb;
277
		$return = array();
278
279
		$current_destination = $wpdb->get_results("
280
					SELECT key1.post_id,key1.meta_value,key2.post_title as name,key2.post_date as last_modified
281
					FROM {$wpdb->postmeta} key1
282
283
					INNER JOIN  {$wpdb->posts} key2 
284
    				ON key1.post_id = key2.ID
285
					
286
					WHERE key1.meta_key = 'lsx_wetu_id'
287
					AND key2.post_type = '{$post_type}'
288
289
					LIMIT 0,500
290
		");
291
		if (null !== $current_destination && !empty($current_destination)) {
292
			foreach ($current_destination as $accom) {
293
				$return[$accom->meta_value] = $accom;
294
			}
295
		}
296
		return $return;
297
	}

classes/class-importer.php 1 location

@@ 1071-1091 (lines=21) @@
1068
	/**
1069
	 * Grab all the current accommodation posts via the lsx_wetu_id field.
1070
	 */
1071
	public function find_current_accommodation($post_type='accommodation') {
1072
		global $wpdb;
1073
		$return = array();
1074
1075
		$current_accommodation = $wpdb->get_results("
1076
					SELECT key1.post_id,key1.meta_value
1077
					FROM {$wpdb->postmeta} key1
1078
1079
					INNER JOIN  {$wpdb->posts} key2 
1080
    				ON key1.post_id = key2.ID
1081
					
1082
					WHERE key1.meta_key = 'lsx_wetu_id'
1083
					AND key2.post_type = '{$post_type}'
1084
1085
					LIMIT 0,500
1086
		");
1087
		if(null !== $current_accommodation && !empty($current_accommodation)){
1088
			foreach($current_accommodation as $accom){
1089
				$return[$accom->meta_value] = $accom;
1090
			}
1091
		}
1092
		return $return;
1093
	}
1094