function _archive_date in Archive 5
Same name and namespace in other branches
- 6 archive.module \_archive_date()
- 7.2 archive.module \_archive_date()
- 7 archive.module \_archive_date()
Parses the current URL and populates an archive date object with the selected date information.
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()
- theme_archive_block_calendar in ./
archive.module - Returns a single month as a calendar grid TODO: take the archive logic out to allow better theme-overloading of this Pass days with post numbers to this function and have this function only create the calendar
- _archive_page in ./
archive.inc - Fetch nodes for the selected date, or current date if none selected.
File
- ./
archive.module, line 211
Code
function _archive_date($type, $year = NULL, $month = NULL, $day = NULL) {
$date = (object) array(
'tz' => _archive_get_timezone(),
);
$date->year = 0;
$date->month = 0;
$date->day = 0;
if (_archive_validate_year($year)) {
$date->year = $year;
if (_archive_validate_month($month)) {
$date->month = $month;
if (_archive_validate_day($year, $month, $day)) {
$date->day = $day;
}
}
}
$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;
}