| @@ 258-282 (lines=25) @@ | ||
| 255 | /** |
|
| 256 | * Grab all the current tour posts via the lsx_wetu_id field. |
|
| 257 | */ |
|
| 258 | public function find_current_tours() { |
|
| 259 | global $wpdb; |
|
| 260 | $return = array(); |
|
| 261 | ||
| 262 | $current_tours = $wpdb->get_results(" |
|
| 263 | SELECT key1.post_id,key1.meta_value,key2.post_title |
|
| 264 | FROM {$wpdb->postmeta} key1 |
|
| 265 | ||
| 266 | INNER JOIN {$wpdb->posts} key2 |
|
| 267 | ON key1.post_id = key2.ID |
|
| 268 | ||
| 269 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 270 | AND key2.post_type = 'tour' |
|
| 271 | ||
| 272 | LIMIT 0,500 |
|
| 273 | "); |
|
| 274 | ||
| 275 | if ( null !== $current_tours && ! empty( $current_tours ) ) { |
|
| 276 | foreach ( $current_tours as $tour ) { |
|
| 277 | $return[ $tour->meta_value ] = $tour; |
|
| 278 | } |
|
| 279 | } |
|
| 280 | ||
| 281 | return $return; |
|
| 282 | } |
|
| 283 | ||
| 284 | /** |
|
| 285 | * Run through the accommodation grabbed from the DB. |
|
| @@ 288-314 (lines=27) @@ | ||
| 285 | /** |
|
| 286 | * Grab all the current destination posts via the lsx_wetu_id field. |
|
| 287 | */ |
|
| 288 | public function find_current_destination( $post_type = 'destination' ) { |
|
| 289 | global $wpdb; |
|
| 290 | $return = array(); |
|
| 291 | ||
| 292 | // @codingStandardsIgnoreStart |
|
| 293 | $current_destination = $wpdb->get_results(" |
|
| 294 | SELECT key1.post_id,key1.meta_value,key2.post_title as name,key2.post_date as last_modified |
|
| 295 | FROM {$wpdb->postmeta} key1 |
|
| 296 | ||
| 297 | INNER JOIN {$wpdb->posts} key2 |
|
| 298 | ON key1.post_id = key2.ID |
|
| 299 | ||
| 300 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 301 | AND key2.post_type = '{$post_type}' |
|
| 302 | ||
| 303 | LIMIT 0,1000 |
|
| 304 | "); |
|
| 305 | // @codingStandardsIgnoreEnd |
|
| 306 | ||
| 307 | if ( null !== $current_destination && ! empty( $current_destination ) ) { |
|
| 308 | foreach ( $current_destination as $accom ) { |
|
| 309 | $return[ $accom->meta_value ] = $accom; |
|
| 310 | } |
|
| 311 | } |
|
| 312 | ||
| 313 | return $return; |
|
| 314 | } |
|
| 315 | ||
| 316 | /** |
|
| 317 | * Run through the accommodation grabbed from the DB. |
|
| @@ 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 |
|