Forgot to commit the profiles timestamp thing
This commit is contained in:
@@ -103,4 +103,15 @@ function uuidv4() {
|
|||||||
$data[6] = chr((ord($data[6]) & 0x0f) | 0x40);
|
$data[6] = chr((ord($data[6]) & 0x0f) | 0x40);
|
||||||
$data[8] = chr((ord($data[8]) & 0x3f) | 0x80);
|
$data[8] = chr((ord($data[8]) & 0x3f) | 0x80);
|
||||||
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
function genTimestamp($time) {
|
||||||
|
$time = time() - $time;
|
||||||
|
$time = ($time < 1) ? 1 : $time;
|
||||||
|
$tokens = array (31536000 => 'year', 2592000 => 'month', 604800 => 'week', 86400 => 'day', 3600 => 'hour', 60 => 'minute', 1 => 'second');
|
||||||
|
foreach($tokens as $unit => $text) {
|
||||||
|
if($time < $unit) continue;
|
||||||
|
$numberOfUnits = floor($time / $unit);
|
||||||
|
return $numberOfUnits . ' ' . $text . (($numberOfUnits > 1) ? 's' : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user