Code Duplication    Length = 21-21 lines in 3 locations

classes/class-destination.php 1 location

@@ 318-338 (lines=21) @@
315
	/**
316
	 * Grab all the current destination posts via the lsx_wetu_id field.
317
	 */
318
	public function find_current_destination($post_type = 'destination')
319
	{
320
		global $wpdb;
321
		$return = array();
322
323
		$current_destination = $wpdb->get_results("
324
					SELECT key1.post_id,key1.meta_value,key2.post_title as name,key2.post_date as last_modified
325
					FROM {$wpdb->postmeta} key1
326
327
					INNER JOIN  {$wpdb->posts} key2 
328
    				ON key1.post_id = key2.ID
329
					
330
					WHERE key1.meta_key = 'lsx_wetu_id'
331
					AND key2.post_type = '{$post_type}'
332
333
					LIMIT 0,500
334
		");
335
		if (null !== $current_destination && !empty($current_destination)) {
336
			foreach ($current_destination as $accom) {
337
				$return[$accom->meta_value] = $accom;
338
			}
339
		}
340
		return $return;
341
	}

classes/class-importer.php 1 location

@@ 1040-1060 (lines=21) @@
1037
	/**
1038
	 * Grab all the current accommodation posts via the lsx_wetu_id field.
1039
	 */
1040
	public function find_current_accommodation($post_type='accommodation') {
1041
		global $wpdb;
1042
		$return = array();
1043
1044
		$current_accommodation = $wpdb->get_results("
1045
					SELECT key1.post_id,key1.meta_value
1046
					FROM {$wpdb->postmeta} key1
1047
1048
					INNER JOIN  {$wpdb->posts} key2 
1049
    				ON key1.post_id = key2.ID
1050
					
1051
					WHERE key1.meta_key = 'lsx_wetu_id'
1052
					AND key2.post_type = '{$post_type}'
1053
1054
					LIMIT 0,500
1055
		");
1056
		if(null !== $current_accommodation && !empty($current_accommodation)){
1057
			foreach($current_accommodation as $accom){
1058
				$return[$accom->meta_value] = $accom;
1059
			}
1060
		}
1061
		return $return;
1062
	}
1063
}

classes/class-tours.php 1 location

@@ 287-307 (lines=21) @@
284
	/**
285
	 * Grab all the current tour posts via the lsx_wetu_id field.
286
	 */
287
	public function find_current_tours() {
288
		global $wpdb;
289
		$return = array();
290
291
		$current_tours = $wpdb->get_results("
292
					SELECT key1.post_id,key1.meta_value
293
					FROM {$wpdb->postmeta} key1
294
295
					INNER JOIN  {$wpdb->posts} key2 
296
    				ON key1.post_id = key2.ID
297
					
298
					WHERE key1.meta_key = 'lsx_wetu_id'
299
					AND key2.post_type = 'tour'
300
301
					LIMIT 0,500
302
		");
303
		if(null !== $current_tours && !empty($current_tours)){
304
			foreach($current_tours as $tour){
305
				$return[$tour->meta_value] = $tour;
306
			}
307
		}
308
		return $return;
309
	}
310