| @@ 293-313 (lines=21) @@ | ||
| 290 | /** |
|
| 291 | * Grab all the current destination posts via the lsx_wetu_id field. |
|
| 292 | */ |
|
| 293 | public function find_current_destination( $post_type = 'destination' ) { |
|
| 294 | global $wpdb; |
|
| 295 | $return = array(); |
|
| 296 | ||
| 297 | // @codingStandardsIgnoreStart |
|
| 298 | $current_destination = $wpdb->get_results(" |
|
| 299 | SELECT key1.post_id,key1.meta_value,key2.post_title as name,key2.post_date as last_modified |
|
| 300 | FROM {$wpdb->postmeta} key1 |
|
| 301 | ||
| 302 | INNER JOIN {$wpdb->posts} key2 |
|
| 303 | ON key1.post_id = key2.ID |
|
| 304 | ||
| 305 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 306 | AND key2.post_type = '{$post_type}' |
|
| 307 | ||
| 308 | LIMIT 0,1000 |
|
| 309 | "); |
|
| 310 | // @codingStandardsIgnoreEnd |
|
| 311 | ||
| 312 | if ( null !== $current_destination && ! empty( $current_destination ) ) { |
|
| 313 | foreach ( $current_destination as $accom ) { |
|
| 314 | $return[ $accom->meta_value ] = $accom; |
|
| 315 | } |
|
| 316 | } |
|
| @@ 336-356 (lines=21) @@ | ||
| 333 | /** |
|
| 334 | * Grab all the current tour posts via the lsx_wetu_id field. |
|
| 335 | */ |
|
| 336 | public function find_current_tours() { |
|
| 337 | global $wpdb; |
|
| 338 | $return = array(); |
|
| 339 | ||
| 340 | $current_tours = $wpdb->get_results(" |
|
| 341 | SELECT key1.post_id,key1.meta_value |
|
| 342 | FROM {$wpdb->postmeta} key1 |
|
| 343 | ||
| 344 | INNER JOIN {$wpdb->posts} key2 |
|
| 345 | ON key1.post_id = key2.ID |
|
| 346 | ||
| 347 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 348 | AND key2.post_type = 'tour' |
|
| 349 | ||
| 350 | LIMIT 0,500 |
|
| 351 | "); |
|
| 352 | ||
| 353 | if ( null !== $current_tours && ! empty( $current_tours ) ) { |
|
| 354 | foreach ( $current_tours as $tour ) { |
|
| 355 | $return[ $tour->meta_value ] = $tour; |
|
| 356 | } |
|
| 357 | } |
|
| 358 | ||
| 359 | return $return; |
|
| @@ 1206-1226 (lines=21) @@ | ||
| 1203 | /** |
|
| 1204 | * Grab all the current accommodation posts via the lsx_wetu_id field. |
|
| 1205 | */ |
|
| 1206 | public function find_current_accommodation( $post_type = 'accommodation' ) { |
|
| 1207 | global $wpdb; |
|
| 1208 | $return = array(); |
|
| 1209 | ||
| 1210 | // @codingStandardsIgnoreStart |
|
| 1211 | $current_accommodation = $wpdb->get_results(" |
|
| 1212 | SELECT key1.post_id,key1.meta_value |
|
| 1213 | FROM {$wpdb->postmeta} key1 |
|
| 1214 | ||
| 1215 | INNER JOIN {$wpdb->posts} key2 |
|
| 1216 | ON key1.post_id = key2.ID |
|
| 1217 | ||
| 1218 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 1219 | AND key2.post_type = '{$post_type}' |
|
| 1220 | ||
| 1221 | LIMIT 0,5000 |
|
| 1222 | "); |
|
| 1223 | // @codingStandardsIgnoreEnd |
|
| 1224 | ||
| 1225 | if ( null !== $current_accommodation && ! empty( $current_accommodation ) ) { |
|
| 1226 | foreach ( $current_accommodation as $accom ) { |
|
| 1227 | $return[ $accom->meta_value ] = $accom; |
|
| 1228 | } |
|
| 1229 | } |
|