From c964e72aabc3a646dbb82f6bf609e9532e75d011 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Mon, 29 Aug 2011 19:31:29 -0500 Subject: A bit more cleanup in the date helper. --- system/helpers/date_helper.php | 113 ++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 59 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index e8a530353..e14bc2f94 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -54,10 +54,8 @@ if ( ! function_exists('now')) return $system_time; } - else - { - return time(); - } + + return time(); } } @@ -89,16 +87,14 @@ if ( ! function_exists('mdate')) return ''; } - if ($time == '') - { - $time = now(); - } + $time = ($time == '') ? now() : $time; $datestr = str_replace( '%\\', '', preg_replace("/([a-z]+?){1}/i", "\\\\\\1", $datestr) ); + return date($datestr, $time); } } @@ -376,14 +372,14 @@ if ( ! function_exists('mysql_to_unix')) $time = str_replace(' ', '', $time); // YYYYMMDDHHMMSS - return mktime( - substr($time, 8, 2), - substr($time, 10, 2), - substr($time, 12, 2), - substr($time, 4, 2), - substr($time, 6, 2), - substr($time, 0, 4) - ); + return mktime( + substr($time, 8, 2), + substr($time, 10, 2), + substr($time, 12, 2), + substr($time, 4, 2), + substr($time, 6, 2), + substr($time, 0, 4) + ); } } @@ -591,8 +587,7 @@ if ( ! function_exists('timezone_menu')) $CI =& get_instance(); $CI->lang->load('date'); - if ($default == 'GMT') - $default = 'UTC'; + $default = ($default == 'GMT') ? 'UTC' : $default; $menu = '