| | 357 | public static function timespan_string($time1, $time2 = NULL, $output = 'years,months,weeks,days,hours,minutes,seconds') |
| | 358 | { |
| | 359 | if ($difference = date::timespan($time1, $time2, $output) AND is_array($difference)) |
| | 360 | { |
| | 361 | $key = end($difference); |
| | 362 | $key = key($difference); |
| | 363 | |
| | 364 | echo Kohana::debug($key, $difference);exit; |
| | 365 | |
| | 366 | $span = array(); |
| | 367 | foreach ($difference as $name => $amount) |
| | 368 | { |
| | 369 | if ($amount === 1) |
| | 370 | { |
| | 371 | // Make the name singualr |
| | 372 | $name = inflector::singular($name); |
| | 373 | } |
| | 374 | |
| | 375 | $span[] = $amount.' '.$name; |
| | 376 | } |
| | 377 | |
| | 378 | $span = array_splice() |
| | 379 | |
| | 380 | $span = trim($span).' ago'; |
| | 381 | } |
| | 382 | } |
| | 383 | |