Code Duplication    Length = 25-27 lines in 3 locations

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

@@ 287-313 (lines=27) @@
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
		// @codingStandardsIgnoreStart
292
		$current_destination = $wpdb->get_results("
293
			SELECT key1.post_id,key1.meta_value,key2.post_title as name,key2.post_date as last_modified
294
			FROM {$wpdb->postmeta} key1
295
296
			INNER JOIN  {$wpdb->posts} key2
297
			ON key1.post_id = key2.ID
298
299
			WHERE key1.meta_key = 'lsx_wetu_id'
300
			AND key2.post_type = '{$post_type}'
301
302
			LIMIT 0,1000
303
		");
304
		// @codingStandardsIgnoreEnd
305
306
		if ( null !== $current_destination && ! empty( $current_destination ) ) {
307
			foreach ( $current_destination as $accom ) {
308
				$return[ $accom->meta_value ] = $accom;
309
			}
310
		}
311
312
		return $return;
313
	}
314
315
	/**
316
	 * Run through the accommodation grabbed from the DB.

classes/class-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-wetu-importer.php 1 location

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