Code Duplication    Length = 25-27 lines in 3 locations

classes/class-wetu-importer.php 1 location

@@ 1225-1251 (lines=27) @@
1222
	/**
1223
	 * Grab all the current accommodation posts via the lsx_wetu_id field.
1224
	 */
1225
	public function find_current_accommodation( $post_type = 'accommodation' ) {
1226
		global $wpdb;
1227
		$return = array();
1228
1229
		// @codingStandardsIgnoreStart
1230
		$current_accommodation = $wpdb->get_results("
1231
			SELECT key1.post_id,key1.meta_value
1232
			FROM {$wpdb->postmeta} key1
1233
1234
			INNER JOIN  {$wpdb->posts} key2
1235
			ON key1.post_id = key2.ID
1236
1237
			WHERE key1.meta_key = 'lsx_wetu_id'
1238
			AND key2.post_type = '{$post_type}'
1239
1240
			LIMIT 0,5000
1241
		");
1242
		// @codingStandardsIgnoreEnd
1243
1244
		if ( null !== $current_accommodation && ! empty( $current_accommodation ) ) {
1245
			foreach ( $current_accommodation as $accom ) {
1246
				$return[ $accom->meta_value ] = $accom;
1247
			}
1248
		}
1249
1250
		return $return;
1251
	}
1252
1253
	/**
1254
	 * Set the Video date

classes/class-wetu-importer-destination.php 1 location

@@ 295-321 (lines=27) @@
292
	/**
293
	 * Grab all the current destination posts via the lsx_wetu_id field.
294
	 */
295
	public function find_current_destination( $post_type = 'destination' ) {
296
		global $wpdb;
297
		$return = array();
298
299
		// @codingStandardsIgnoreStart
300
		$current_destination = $wpdb->get_results("
301
			SELECT key1.post_id,key1.meta_value,key2.post_title as name,key2.post_date as last_modified
302
			FROM {$wpdb->postmeta} key1
303
304
			INNER JOIN  {$wpdb->posts} key2
305
			ON key1.post_id = key2.ID
306
307
			WHERE key1.meta_key = 'lsx_wetu_id'
308
			AND key2.post_type = '{$post_type}'
309
310
			LIMIT 0,1000
311
		");
312
		// @codingStandardsIgnoreEnd
313
314
		if ( null !== $current_destination && ! empty( $current_destination ) ) {
315
			foreach ( $current_destination as $accom ) {
316
				$return[ $accom->meta_value ] = $accom;
317
			}
318
		}
319
320
		return $return;
321
	}
322
323
	/**
324
	 * Run through the accommodation grabbed from the DB.

classes/class-wetu-importer-tours.php 1 location

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