-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunctions.php
More file actions
28 lines (23 loc) · 786 Bytes
/
functions.php
File metadata and controls
28 lines (23 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
function get_time_ago( $time )
{
$time_difference = time() - $time;
if( $time_difference < 240 ) { return 'dinliyor <span class="indicator online"></span>'; }
$condition = array( 12 * 30 * 24 * 60 * 60 => 'yıl',
30 * 24 * 60 * 60 => 'ay',
24 * 60 * 60 => 'gün',
60 * 60 => 'saat',
60 => 'dakika',
1 => 'saniye'
);
foreach( $condition as $secs => $str )
{
$d = $time_difference / $secs;
if( $d >= 1 )
{
$t = round( $d );
return ' ' . $t . ' ' . $str . ( $t > 1 ? '' : '' ) . ' önce';
}
}
}
?>