Revize 74a7dbca
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
application/helpers/dns.php | ||
---|---|---|
if (!$result || count($result)!=1) return '';
|
||
return $result[0]['target'];
|
||
}
|
||
|
||
/**
|
||
* Converts TTL to seconds
|
||
*
|
||
* @author David Raška
|
||
* @param string $ttl Time To Live
|
||
* @return int Time in seconds
|
||
*/
|
||
public static function get_seconds_from_ttl($ttl)
|
||
{
|
||
$multiplier = substr($ttl, -1);
|
||
|
||
// Given TTL is in seconds
|
||
if (is_numeric($multiplier))
|
||
{
|
||
return $ttl;
|
||
}
|
||
|
||
$value = substr($ttl, 0, -1);
|
||
|
||
switch (strtolower($multiplier))
|
||
{
|
||
// minute
|
||
case 'm':
|
||
return $value * 60;
|
||
break;
|
||
// hour
|
||
case 'h':
|
||
return $value * 60 * 60;
|
||
break;
|
||
// day
|
||
case 'd':
|
||
return $value * 60 * 60 * 24;
|
||
break;
|
||
// week
|
||
case 'w':
|
||
return $value * 60 * 60 * 24 * 7;
|
||
break;
|
||
// Error
|
||
default:
|
||
return NULL;
|
||
}
|
||
}
|
||
|
||
} // End dns
|
Také k dispozici: Unified diff
Merge from SVN branch 1.2.