function _quant_get_time_from_url in Quant 6
Same name and namespace in other branches
- 7 quant.pages.inc \_quant_get_time_from_url()
Retrieve the time period or interval from the URL
Parameters
$period: If the set option is a period, the return value will be a single timestamp representing how far to go back in time from the current. If the set option is custom, the return value will be an array representing a given time interval. The first value will be the "from" timestamp and the second value will be the "to" timestamp. If neither can be determined, FALSE will be returned. If no queries are in the URL, a timestamp for a 1 month period will be returned.
1 call to _quant_get_time_from_url()
- quant_page in includes/
pages.inc - The analytics page callback
File
- ./
quant.module, line 123
Code
function _quant_get_time_from_url() {
// Get the option
if (isset($_GET['option'])) {
switch ($_GET['option']) {
case 'custom':
$from = strtotime($_GET['from']);
$to = strtotime($_GET['to']);
if (is_numeric($from) && is_numeric($to)) {
// Move the 'to' date to 1 second before midnight
return array(
$from,
$to + 86399,
);
}
break;
case 'period':
$period = strtotime('-' . str_replace('_', ' ', filter_xss($_GET['period'])));
if (is_numeric($period)) {
return $period;
}
}
}
else {
return strtotime('-1 month');
}
return FALSE;
}