Simple History - Version 2.1.7

Version Description

(September 2015) =

  • Fixed: Date and time in the log was using GMT time rather than local time. Could be confusing. Even very confusing if living in a time zone far far away from the GMT zone.
Download this release

Release Info

Developer eskapism
Plugin Icon 128x128 Simple History
Version 2.1.7
Comparing to
See all releases

Code changes from version 2.1.6 to 2.1.7

Files changed (3) hide show
  1. index.php +2 -2
  2. loggers/SimpleLogger.php +5 -10
  3. readme.txt +5 -1
index.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://simple-history.com
5
  Text Domain: simple-history
6
  Domain Path: /languages
7
  Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
8
- Version: 2.1.6
9
  Author: Pär Thernström
10
  Author URI: http://simple-history.com/
11
  License: GPL2
@@ -46,7 +46,7 @@ if ( version_compare( phpversion(), "5.3", ">=") ) {
46
  // register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
47
 
48
  if ( ! defined( 'SIMPLE_HISTORY_VERSION' ) ) {
49
- define( 'SIMPLE_HISTORY_VERSION', '2.1.6' );
50
  }
51
 
52
  if ( ! defined( 'SIMPLE_HISTORY_PATH' ) ) {
5
  Text Domain: simple-history
6
  Domain Path: /languages
7
  Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
8
+ Version: 2.1.7
9
  Author: Pär Thernström
10
  Author URI: http://simple-history.com/
11
  License: GPL2
46
  // register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
47
 
48
  if ( ! defined( 'SIMPLE_HISTORY_VERSION' ) ) {
49
+ define( 'SIMPLE_HISTORY_VERSION', '2.1.7' );
50
  }
51
 
52
  if ( ! defined( 'SIMPLE_HISTORY_PATH' ) ) {
loggers/SimpleLogger.php CHANGED
@@ -336,7 +336,7 @@ class SimpleLogger {
336
  // http://developers.whatwg.org/text-level-semantics.html#the-time-element
337
  $date_html = "";
338
  $str_when = "";
339
- $date_datetime = new DateTime($row->date);
340
 
341
  /**
342
  * Filter how many seconds as most that can pass since an
@@ -360,16 +360,16 @@ class SimpleLogger {
360
  $time_ago_just_now_max_time = 30;
361
  $time_ago_just_now_max_time = apply_filters("simple_history/header_just_now_max_time", $time_ago_just_now_max_time);
362
 
363
- if (time() - $date_datetime->getTimestamp() <= $time_ago_just_now_max_time) {
364
 
365
  // show "just now" if event is very recent
366
  $str_when = __("Just now", "simple-history");
367
 
368
- } else if (time() - $date_datetime->getTimestamp() > $time_ago_max_time) {
369
 
370
  /* translators: Date format for log row header, see http://php.net/date */
371
  $datef = __('M j, Y \a\t G:i', "simple-history");
372
- $str_when = date_i18n($datef, $date_datetime->getTimestamp());
373
 
374
  } else {
375
 
@@ -887,14 +887,9 @@ class SimpleLogger {
887
  $level = apply_filters("simple_history/log_argument/level", $level, $context, $message, $this);
888
  $message = apply_filters("simple_history/log_argument/message", $message, $level, $context, $this);
889
 
890
- /* Store date at utc or local time?
891
  * Some info here:
892
  * http://www.skyverge.com/blog/down-the-rabbit-hole-wordpress-and-timezones/
893
- * UNIX timestamp = no timezone = UTC
894
- * anything is better than now() anyway!
895
- * WP seems to use the local time, so I will go with that too I think
896
- * GMT/UTC-time is: date_i18n($timezone_format, false, 'gmt'));
897
- * local time is: date_i18n($timezone_format));
898
  */
899
  $localtime = current_time("mysql", 1);
900
 
336
  // http://developers.whatwg.org/text-level-semantics.html#the-time-element
337
  $date_html = "";
338
  $str_when = "";
339
+ $date_datetime = new DateTime( $row->date );
340
 
341
  /**
342
  * Filter how many seconds as most that can pass since an
360
  $time_ago_just_now_max_time = 30;
361
  $time_ago_just_now_max_time = apply_filters("simple_history/header_just_now_max_time", $time_ago_just_now_max_time);
362
 
363
+ if ( time() - $date_datetime->getTimestamp() <= $time_ago_just_now_max_time ) {
364
 
365
  // show "just now" if event is very recent
366
  $str_when = __("Just now", "simple-history");
367
 
368
+ } else if ( time() - $date_datetime->getTimestamp() > $time_ago_max_time ) {
369
 
370
  /* translators: Date format for log row header, see http://php.net/date */
371
  $datef = __('M j, Y \a\t G:i', "simple-history");
372
+ $str_when = date_i18n( $datef, strtotime( get_date_from_gmt( $row->date ) ) );
373
 
374
  } else {
375
 
887
  $level = apply_filters("simple_history/log_argument/level", $level, $context, $message, $this);
888
  $message = apply_filters("simple_history/log_argument/message", $message, $level, $context, $this);
889
 
890
+ /* Store date as GMT date, i.e. not local date/time
891
  * Some info here:
892
  * http://www.skyverge.com/blog/down-the-rabbit-hole-wordpress-and-timezones/
 
 
 
 
 
893
  */
894
  $localtime = current_time("mysql", 1);
895
 
readme.txt CHANGED
@@ -119,6 +119,10 @@ initiated by a specific user.
119
 
120
  ## Changelog
121
 
 
 
 
 
122
  = 2.1.6 (August 2015) =
123
 
124
  - Updated: Danish translation updated. Thanks translator!
@@ -130,7 +134,7 @@ initiated by a specific user.
130
 
131
  = 2.1.5 (August 2015) =
132
 
133
- - Fixed: It was not possible to modify the filters `simple_history/view_settings_capability` and `simple_history/view_history_capability` from the `functions.php`-file in a theme (filters where applied to early - they did however work from within a plugin!)
134
  - Changed: Use `h1` instead of `h2` on admin screens. Reason for this the changes in 4.3: https://make.wordpress.org/core/2015/07/31/headings-in-admin-screens-change-in-wordpress-4-3/.
135
  - Removed: the constant `VERSION` is now removed. Use constant `SIMPLE_HISTORY_VERSION` instead of you need to check the current version of Simple History.
136
 
119
 
120
  ## Changelog
121
 
122
+ = 2.1.7 (September 2015) =
123
+
124
+ - Fixed: Date and time in the log was using GMT time rather than local time. Could be confusing. Even very confusing if living in a time zone far far away from the GMT zone.
125
+
126
  = 2.1.6 (August 2015) =
127
 
128
  - Updated: Danish translation updated. Thanks translator!
134
 
135
  = 2.1.5 (August 2015) =
136
 
137
+ - Fixed: It was not possible to modify the filters `simple_history/view_settings_capability` and `simple_history/view_history_capability` from the `functions.php`-file in a theme (filters where applied too early - they did however work from within a plugin!)
138
  - Changed: Use `h1` instead of `h2` on admin screens. Reason for this the changes in 4.3: https://make.wordpress.org/core/2015/07/31/headings-in-admin-screens-change-in-wordpress-4-3/.
139
  - Removed: the constant `VERSION` is now removed. Use constant `SIMPLE_HISTORY_VERSION` instead of you need to check the current version of Simple History.
140