Code Duplication    Length = 21-21 lines in 3 locations

classes/class-accommodation.php 1 location

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

classes/class-destination.php 1 location

@@ 287-307 (lines=21) @@
284
	/**
285
	 * Grab all the current destination posts via the lsx_wetu_id field.
286
	 */
287
	public function find_current_destination($post_type='destination') {
288
		global $wpdb;
289
		$return = array();
290
291
		$current_destination = $wpdb->get_results("
292
					SELECT key1.post_id,key1.meta_value,key2.post_title as name,key2.post_date as last_modified
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 = '{$post_type}'
300
301
					LIMIT 0,500
302
		");
303
		if(null !== $current_destination && !empty($current_destination)){
304
			foreach($current_destination as $accom){
305
				$return[$accom->meta_value] = $accom;
306
			}
307
		}
308
		return $return;
309
	}
310

classes/class-tours.php 1 location

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