Code Duplication    Length = 25-27 lines in 3 locations

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

@@ 261-285 (lines=25) @@
258
	/**
259
	 * Grab all the current tour posts via the lsx_wetu_id field.
260
	 */
261
	public function find_current_tours() {
262
		global $wpdb;
263
		$return = array();
264
265
		$current_tours = $wpdb->get_results("
266
			SELECT key1.post_id,key1.meta_value
267
			FROM {$wpdb->postmeta} key1
268
269
			INNER JOIN  {$wpdb->posts} key2
270
			ON key1.post_id = key2.ID
271
272
			WHERE key1.meta_key = 'lsx_wetu_id'
273
			AND key2.post_type = 'tour'
274
275
			LIMIT 0,500
276
		");
277
278
		if ( null !== $current_tours && ! empty( $current_tours ) ) {
279
			foreach ( $current_tours as $tour ) {
280
				$return[ $tour->meta_value ] = $tour;
281
			}
282
		}
283
284
		return $return;
285
	}
286
287
	/**
288
	 * Run through the accommodation grabbed from the DB.

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

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

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

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