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.php 1 location

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

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

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