function weather_format_visibility in Weather 7
Convert visibility.
Parameters
int $visibility: Visibility in meter.
string $unit: Unit to be returned (for example, UK miles, km).
Return value
string Formatted representation.
1 call to weather_format_visibility()
- theme_weather_theming in ./
weather_theme.inc - Custom theme function for preprocessing the weather display.
File
- ./
weather_theme.inc, line 544 - Prepare themed weather output.
Code
function weather_format_visibility($visibility, $unit) {
if ($unit == 'miles') {
$result = t('!visibility mi', array(
'!visibility' => round($visibility / 1609.344, 1),
));
}
else {
// Default to metric units.
$result = t('!visibility km', array(
'!visibility' => round($visibility / 1000, 1),
));
}
return preg_replace("/([^ ]*) ([^ ]*)/", '<span style="white-space:nowrap;">\\1 \\2</span>', $result);
}