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

@@ 1083-1103 (lines=21) @@
1080
	/**
1081
	 * Grab all the current accommodation posts via the lsx_wetu_id field.
1082
	 */
1083
	public function find_current_accommodation($post_type='accommodation') {
1084
		global $wpdb;
1085
		$return = array();
1086
1087
		$current_accommodation = $wpdb->get_results("
1088
					SELECT key1.post_id,key1.meta_value
1089
					FROM {$wpdb->postmeta} key1
1090
1091
					INNER JOIN  {$wpdb->posts} key2 
1092
    				ON key1.post_id = key2.ID
1093
					
1094
					WHERE key1.meta_key = 'lsx_wetu_id'
1095
					AND key2.post_type = '{$post_type}'
1096
1097
					LIMIT 0,500
1098
		");
1099
		if(null !== $current_accommodation && !empty($current_accommodation)){
1100
			foreach($current_accommodation as $accom){
1101
				$return[$accom->meta_value] = $accom;
1102
			}
1103
		}
1104
		return $return;
1105
	}
1106