Revize c478920d
Přidáno uživatelem Ondřej Fibich před asi 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
Undo my stupid mistake (I have pushed issue-957 to master instead of develop). Do I have copied files from GitHub master and push them back..