- Patch #1416218 by scorchio: Improve variable naming in format_interval().
parent
7361ef66a5
commit
85a23905e3
|
@ -1817,7 +1817,7 @@ function format_size($size, $langcode = NULL) {
|
||||||
/**
|
/**
|
||||||
* Formats a time interval with the requested granularity.
|
* Formats a time interval with the requested granularity.
|
||||||
*
|
*
|
||||||
* @param $timestamp
|
* @param $interval
|
||||||
* The length of the interval in seconds.
|
* The length of the interval in seconds.
|
||||||
* @param $granularity
|
* @param $granularity
|
||||||
* How many different units to display in the string.
|
* How many different units to display in the string.
|
||||||
|
@ -1828,7 +1828,7 @@ function format_size($size, $langcode = NULL) {
|
||||||
* @return
|
* @return
|
||||||
* A translated string representation of the interval.
|
* A translated string representation of the interval.
|
||||||
*/
|
*/
|
||||||
function format_interval($timestamp, $granularity = 2, $langcode = NULL) {
|
function format_interval($interval, $granularity = 2, $langcode = NULL) {
|
||||||
$units = array(
|
$units = array(
|
||||||
'1 year|@count years' => 31536000,
|
'1 year|@count years' => 31536000,
|
||||||
'1 month|@count months' => 2592000,
|
'1 month|@count months' => 2592000,
|
||||||
|
@ -1841,9 +1841,9 @@ function format_interval($timestamp, $granularity = 2, $langcode = NULL) {
|
||||||
$output = '';
|
$output = '';
|
||||||
foreach ($units as $key => $value) {
|
foreach ($units as $key => $value) {
|
||||||
$key = explode('|', $key);
|
$key = explode('|', $key);
|
||||||
if ($timestamp >= $value) {
|
if ($interval >= $value) {
|
||||||
$output .= ($output ? ' ' : '') . format_plural(floor($timestamp / $value), $key[0], $key[1], array(), array('langcode' => $langcode));
|
$output .= ($output ? ' ' : '') . format_plural(floor($interval / $value), $key[0], $key[1], array(), array('langcode' => $langcode));
|
||||||
$timestamp %= $value;
|
$interval %= $value;
|
||||||
$granularity--;
|
$granularity--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue