Changeset 13086 for trunk/include
- Timestamp:
- Feb 10, 2012, 6:02:54 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r13085 r13086 547 547 $tok = strtok('- :'); 548 548 } 549 550 if ($ymdhms[0] < 1970) return false; 551 if (!isset($ymdhms[3])) $ymdhms[3] = 12; 552 if (!isset($ymdhms[4])) $ymdhms[4] = 0; 553 if (!isset($ymdhms[5])) $ymdhms[5] = 0; 549 554 $original = mktime($ymdhms[3],$ymdhms[4],$ymdhms[5],$ymdhms[1],$ymdhms[2],$ymdhms[0]); 550 555 } … … 552 557 // array of time period chunks 553 558 $chunks = array( 554 array(60 * 60 * 24 * 365 , 'year'),555 array(60 * 60 * 24 * 30 , 'month'),556 array(60 * 60 * 24 * 7, 'week'),557 array(60 * 60 * 24 , 'day'),558 array(60 * 60 , 'hour'),559 array(60 , 'minute'),560 array(1 , 'second'),559 'year' => 60 * 60 * 24 * 365, 560 'month' => 60 * 60 * 24 * 30, 561 'week' => 60 * 60 * 24 * 7, 562 'day' => 60 * 60 * 24, 563 'hour' => 60 * 60, 564 'minute' => 60, 565 'second' => 1, 561 566 ); 562 567 … … 565 570 566 571 $print = null; 567 for ($i = 0, $j = count($chunks); $i < $j; $i++) 568 { 569 $seconds = $chunks[$i][0]; 570 $name = $chunks[$i][1]; 572 foreach ($chunks as $name => $seconds) 573 { 571 574 if (($count = floor($since / $seconds)) != 0) 572 575 { 573 $print.= ($count == 1) ? '1 '.l10n($name).' ' : $count.' '.l10n($name.'s').' ';576 $print.= l10n_dec('%d '.$name, '%d '.$name.'s', $count); 574 577 $since-= $count*$seconds; 575 578 } 576 if ( $name == $stop)579 if (!empty($print) and $chunks[$name] <= $chunks[$stop]) 577 580 { 578 581 break;
Note: See TracChangeset
for help on using the changeset viewer.