10 } |
10 } |
11 **!*/ |
11 **!*/ |
12 |
12 |
13 /* |
13 /* |
14 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
14 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
15 * Version 1.1.6 (Caoineag beta 1) |
15 * Copyright (C) 2006-2009 Dan Fuhry |
16 * Copyright (C) 2006-2008 Dan Fuhry |
|
17 * |
16 * |
18 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
17 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
19 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
18 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
20 * |
19 * |
21 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
1836 * @return string |
1835 * @return string |
1837 */ |
1836 */ |
1838 |
1837 |
1839 public static function format_date($time) |
1838 public static function format_date($time) |
1840 { |
1839 { |
1841 global $lang; |
1840 // merged into enano_date() :) |
1842 // Our formattting string to pass to enano_date() |
1841 return enano_date(ED_DATE, $time); |
1843 // This should not include minute/second info, only today's date in whatever format suits your fancy |
|
1844 $formatstring = 'F j, Y'; |
|
1845 // Today's date |
|
1846 $today = enano_date($formatstring); |
|
1847 // Yesterday's date |
|
1848 $yesterday = enano_date($formatstring, (time() - (24*60*60))); |
|
1849 // Date on the input |
|
1850 $then = enano_date($formatstring, $time); |
|
1851 // "X days ago" logic |
|
1852 for ( $i = 2; $i <= 6; $i++ ) |
|
1853 { |
|
1854 // hours_in_day * minutes_in_hour * seconds_in_minute * num_days |
|
1855 $offset = 24 * 60 * 60 * $i; |
|
1856 $days_ago = enano_date($formatstring, (time() - $offset)); |
|
1857 // so does the input timestamp match the date from $i days ago? |
|
1858 if ( $then == $days_ago ) |
|
1859 { |
|
1860 // yes, return $i |
|
1861 return $lang->get('userfuncs_ml_date_daysago', array('days_ago' => $i)); |
|
1862 } |
|
1863 } |
|
1864 // either yesterday, today, or before 6 days ago |
|
1865 switch($then) |
|
1866 { |
|
1867 case $today: |
|
1868 return $lang->get('userfuncs_ml_date_today'); |
|
1869 case $yesterday: |
|
1870 return $lang->get('userfuncs_ml_date_yesterday'); |
|
1871 default: |
|
1872 return $then; |
|
1873 } |
|
1874 // .--. |
|
1875 // |o_o | |
|
1876 // |!_/ | |
|
1877 // // \ \ |
|
1878 // (| | ) |
|
1879 // /'\_ _/`\ |
|
1880 // \___)=(___/ |
|
1881 return 'Linux rocks!'; |
|
1882 } |
1842 } |
1883 function reg_time($time, $row) |
1843 function reg_time($time, $row) |
1884 { |
1844 { |
1885 return $this->format_date($time); |
1845 return $this->format_date($time); |
1886 } |
1846 } |