diff --git a/README.md b/README.md index d2c0f90..9aea6de 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,13 @@ Features - Responsive Design - User Roles - Online Backup -- File Caching (Auto Minify HTML support) +- File Caching - Online Update - Post Draft - i18n - Menu builder +- Caching Minify (optional) +- Posts Date display like Social Media (optional) Requirements ------------ diff --git a/config/config.ini.example b/config/config.ini.example index 31ba57a..eae1ae8 100644 --- a/config/config.ini.example +++ b/config/config.ini.example @@ -93,6 +93,9 @@ teaser.char = "200" ; Description character count description.char = "150" +; Post date display as, set "true" display as social media or set "false" as default +timeago.format = "false" + ; RSS feed count rss.count = "10" @@ -129,6 +132,9 @@ generation.time = "false" ; Switch on and off the cache timestamp. Options "false" and "true" cache.timestamp = "false" +; Switch on and off the cache minify. Options "false" and "true" +cache.minify = "false" + ; Set the theme here views.root = "themes/twentyfifteen" diff --git a/system/admin/views/config-performance.html.php b/system/admin/views/config-performance.html.php index 2f20cfa..29068a7 100644 --- a/system/admin/views/config-performance.html.php +++ b/system/admin/views/config-performance.html.php @@ -39,6 +39,25 @@ +
+ +
+
+
+ checked> + +
+
+ checked> + +
+
+
+
@@ -56,7 +75,7 @@
- +
diff --git a/system/admin/views/config-reading.html.php b/system/admin/views/config-reading.html.php index 5792e6c..b61280b 100644 --- a/system/admin/views/config-reading.html.php +++ b/system/admin/views/config-reading.html.php @@ -75,7 +75,7 @@
- +
@@ -89,6 +89,25 @@
+
+ +
+
+
+ checked> + +
+
+ checked> + +
+
+
+


diff --git a/system/includes/dispatch.php b/system/includes/dispatch.php index bd33cec..78a8158 100644 --- a/system/includes/dispatch.php +++ b/system/includes/dispatch.php @@ -489,7 +489,11 @@ function render($view, $locals = null, $layout = null) } if (!$login && $view != '404') { if (!file_exists($cachefile)) { - $content = minify_html(ob_get_contents()); // Minify HTML + if(config('cache.minify') == 'true') { + $content = minify_html(ob_get_contents()); // Minify HTML + } else { + $content = ob_get_contents(); // Un-Minify HTML + } if (config('cache.timestamp') == 'true') { $content .= "\n" . ''; } diff --git a/system/includes/functions.php b/system/includes/functions.php index 1b37ba0..e712378 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -3244,38 +3244,46 @@ function format_date($date) $date_format = config('date.format'); - if (!isset($date_format) || empty($date_format)) { - return strftime('%e %B %Y', $date); + // Timeago + if(config('timeago.format') == 'true') { + $time = time() - $date; + if ($time < 60) { + return ( $time > 1 ) ? $time . ' ' . i18n('Seconds_ago') : i18n('A_second_ago'); + } + elseif ($time < 3600) { + $tmp = floor($time / 60); + return ($tmp > 1) ? $tmp . ' ' . i18n('Minutes_ago') : i18n('A_minute_ago'); + } + elseif ($time < 86400) { + $tmp = floor($time / 3600); + return ($tmp > 1) ? $tmp . ' ' . i18n('Hours_ago') : i18n('An_hour_ago'); + } + elseif ($time < 2592000) { + $tmp = floor($time / 86400); + return ($tmp > 1) ? $tmp . ' ' . i18n('Days_ago') : i18n('Yesterday'); + } + elseif ($time < 946080000) { + if (!isset($date_format) || empty($date_format)) { + return strftime('%e %B %Y', $date); + } else { + return strftime($date_format, $date); + } + } + else { + $tmp = floor($time / 946080000); + if (!isset($date_format) || empty($date_format)) { + return strftime('%e %B %Y', $date); + } else { + return strftime($date_format, $date); + } + } } else { - return strftime($date_format, $date); - } - -} - -// Function Timeago -function timeago($date){ - $time = time() - $date; - - if ($time < 60) - return ( $time > 1 ) ? $time . ' ' . i18n('Seconds_ago') : i18n('A_second_ago'); - elseif ($time < 3600) { - $tmp = floor($time / 60); - return ($tmp > 1) ? $tmp . ' ' . i18n('Minutes_ago') : i18n('A_minute_ago'); - } - elseif ($time < 86400) { - $tmp = floor($time / 3600); - return ($tmp > 1) ? $tmp . ' ' . i18n('Hours_ago') : i18n('An_hour_ago'); - } - elseif ($time < 2592000) { - $tmp = floor($time / 86400); - return ($tmp > 1) ? $tmp . ' ' . i18n('Days_ago') : i18n('Yesterday'); - } - elseif ($time < 946080000) { - return format_date($date); - } - else { - $tmp = floor($time / 946080000); - return format_date($date); + // Default + if (!isset($date_format) || empty($date_format)) { + return strftime('%e %B %Y', $date); + } else { + return strftime($date_format, $date); + } } }