| 346 | |
| 347 | /** |
| 348 | * Check if the current date is within an optionally specified date range. |
| 349 | * |
| 350 | * @return bool True if the current date is within the date range, or if no date range is specified. |
| 351 | */ |
| 352 | protected function is_within_date_range() { |
| 353 | $blog_id = get_current_blog_id(); |
| 354 | |
| 355 | /** |
| 356 | * Filter: Optionally set a date on which Tagregator will begin importing new items. |
| 357 | * |
| 358 | * @param DateTime|null $start_date The date that Tagregator should start importing items. Default null. |
| 359 | */ |
| 360 | $start_date = apply_filters( Tagregator::PREFIX . 'start_date', null ); |
| 361 | |
| 362 | /** |
| 363 | * Filter: Optionally set a date on which Tagregator will stop importing new items. |
| 364 | * |
| 365 | * @param DateTime|null $end_date The date that Tagregator should stop importing items. Default null. |
| 366 | */ |
| 367 | $end_date = apply_filters( Tagregator::PREFIX . 'end_date', null ); |
| 368 | |
| 369 | $now = new DateTime( 'now' ); |
| 370 | |
| 371 | if ( $start_date instanceof DateTime && $now < $start_date ) { |
| 372 | return false; |
| 373 | } |
| 374 | |
| 375 | if ( $end_date instanceof DateTime && $now > $end_date ) { |
| 376 | return false; |
| 377 | } |
| 378 | |
| 379 | return true; |
| 380 | } |