You are here

function _archive_date in Archive 6

Same name and namespace in other branches
  1. 5 archive.module \_archive_date()
  2. 7.2 archive.module \_archive_date()
  3. 7 archive.module \_archive_date()

Parses the current URL and populates an archive date object.

Parameters

$year: Number of year.

$month: Number of month.

$day: Number of day.

Return value

A date object with GMT date values and a timezone value.

2 calls to _archive_date()
archive_page in ./archive.pages.inc
Fetch nodes for the selected date, or current date if none selected.
theme_archive_block_calendar in ./archive.module
Returns a single month as a calendar grid.

File

./archive.module, line 329

Code

function _archive_date($type, $year = 0, $month = 0, $day = 0) {
  $date = new stdClass();
  $date->tz = _archive_get_timezone();
  $date->year = 0;
  $date->month = 0;
  $date->day = 0;
  if (_archive_validate_date($year, $month, $day)) {
    $date->year = $year;
    $date->month = $month;
    $date->day = $day;
  }
  else {
    if (_archive_validate_date($year, $month)) {
      $date->year = $year;
      $date->month = $month;
    }
    else {
      if (_archive_validate_date($year)) {
        $date->year = $year;
      }
    }
  }
  $post_counts = _archive_post_count($type, $date);
  $date->years = $post_counts['years'];
  ksort($date->years);
  $date->months = $post_counts['months'];
  ksort($date->months);
  $date->days = $post_counts['days'];
  ksort($date->days);
  $date->next_month_days = $post_counts['next_month_days'];
  $date->prev_month_days = $post_counts['prev_month_days'];
  return $date;
}