Simple History - Version 2.15

Version Description

(May 2017) =

  • Use thumbnail version of PDF preview instead of full size image.
  • Remove Google Maps image when clicking IP address of failed login and similar, because Google Maps must be used with API key. Hostname, Network, City, Region and Country is still shown.
  • Fix notice in available updates logger.
  • Fix notice in redirection logger.
Download this release

Release Info

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

Code changes from version 2.14.1 to 2.15

dropins/SimpleHistoryIpInfoDropin.php CHANGED
@@ -30,7 +30,7 @@ class SimpleHistoryIpInfoDropin {
30
  public function enqueue_admin_scripts() {
31
 
32
  $file_url = plugin_dir_url(__FILE__);
33
-
34
  wp_enqueue_script("simple_history_IpInfoDropin", $file_url . "SimpleHistoryIpInfoDropin.js", array("jquery"), SIMPLE_HISTORY_VERSION, true);
35
 
36
  wp_enqueue_style("simple_history_IpInfoDropin", $file_url . "SimpleHistoryIpInfoDropin.css", null, SIMPLE_HISTORY_VERSION);
@@ -66,18 +66,20 @@ class SimpleHistoryIpInfoDropin {
66
  <# if ( typeof(data.bogon) != "undefined" ) { #>
67
 
68
  <p><?php _ex("That IP address does not seem like a public one.", "IP Info Dropin", "simple-history"); ?></p>
69
-
70
  <# } else { #>
71
-
72
  <table class="SimpleHistoryIpInfoDropin__ipInfoTable">
73
 
74
  <tr class="SimpleHistoryIpInfoDropin__ipInfoTable__mapRow">
75
  <td colspan="2">
 
76
  <# if ( typeof(data.loc) != "undefined" && data.loc ) { #>
77
  <a href="https://www.google.com/maps/place/{{ data.loc }}/@{{ data.loc }},6z" target="_blank">
78
  <img src="https://maps.googleapis.com/maps/api/staticmap?center={{ data.loc }}&zoom=7&size=350x100&sensor=false" width="350" height="100" alt="Google Map">
79
  </a>
80
  <# } #>
 
81
  </td>
82
  </tr>
83
 
@@ -134,7 +136,7 @@ class SimpleHistoryIpInfoDropin {
134
  {{ data.city }}
135
  </td>
136
  </tr>
137
- <# } #>
138
 
139
  <# if ( typeof(data.region) != "undefined" && data.region ) { #>
140
  <tr>
30
  public function enqueue_admin_scripts() {
31
 
32
  $file_url = plugin_dir_url(__FILE__);
33
+
34
  wp_enqueue_script("simple_history_IpInfoDropin", $file_url . "SimpleHistoryIpInfoDropin.js", array("jquery"), SIMPLE_HISTORY_VERSION, true);
35
 
36
  wp_enqueue_style("simple_history_IpInfoDropin", $file_url . "SimpleHistoryIpInfoDropin.css", null, SIMPLE_HISTORY_VERSION);
66
  <# if ( typeof(data.bogon) != "undefined" ) { #>
67
 
68
  <p><?php _ex("That IP address does not seem like a public one.", "IP Info Dropin", "simple-history"); ?></p>
69
+
70
  <# } else { #>
71
+
72
  <table class="SimpleHistoryIpInfoDropin__ipInfoTable">
73
 
74
  <tr class="SimpleHistoryIpInfoDropin__ipInfoTable__mapRow">
75
  <td colspan="2">
76
+ <!--
77
  <# if ( typeof(data.loc) != "undefined" && data.loc ) { #>
78
  <a href="https://www.google.com/maps/place/{{ data.loc }}/@{{ data.loc }},6z" target="_blank">
79
  <img src="https://maps.googleapis.com/maps/api/staticmap?center={{ data.loc }}&zoom=7&size=350x100&sensor=false" width="350" height="100" alt="Google Map">
80
  </a>
81
  <# } #>
82
+ -->
83
  </td>
84
  </tr>
85
 
136
  {{ data.city }}
137
  </td>
138
  </tr>
139
+ <# } #>
140
 
141
  <# if ( typeof(data.region) != "undefined" && data.region ) { #>
142
  <tr>
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.14.1
9
  Author: Pär Thernström
10
  Author URI: http://simple-history.com/
11
  License: GPL2
@@ -42,7 +42,7 @@ if ( version_compare( phpversion(), "5.3", ">=") ) {
42
  // register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
43
 
44
  if ( ! defined( 'SIMPLE_HISTORY_VERSION' ) ) {
45
- define( 'SIMPLE_HISTORY_VERSION', '2.14' );
46
  }
47
 
48
  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.15
9
  Author: Pär Thernström
10
  Author URI: http://simple-history.com/
11
  License: GPL2
42
  // register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
43
 
44
  if ( ! defined( 'SIMPLE_HISTORY_VERSION' ) ) {
45
+ define( 'SIMPLE_HISTORY_VERSION', '2.15' );
46
  }
47
 
48
  if ( ! defined( 'SIMPLE_HISTORY_PATH' ) ) {
loggers/AvailableUpdatesLogger.php CHANGED
@@ -225,10 +225,11 @@ if ( ! class_exists("AvailableUpdatesLogger") ) {
225
 
226
  $current_version = null;
227
  $new_version = null;
 
228
 
229
  $context = isset( $row->context ) ? $row->context : array();
230
 
231
- switch ( $row->context_message_key ) {
232
 
233
  case "core_update_available":
234
  $current_version = isset( $context["wp_core_current_version"] ) ? $context["wp_core_current_version"] : null;
225
 
226
  $current_version = null;
227
  $new_version = null;
228
+ $context_message_key = isset($row->context_message_key) ? $row->context_message_key : null;
229
 
230
  $context = isset( $row->context ) ? $row->context : array();
231
 
232
+ switch ( $context_message_key ) {
233
 
234
  case "core_update_available":
235
  $current_version = isset( $context["wp_core_current_version"] ) ? $context["wp_core_current_version"] : null;
loggers/Plugin_Redirection.php CHANGED
@@ -109,10 +109,6 @@ if ( ! class_exists("Plugin_Redirection") ) {
109
 
110
  $referer_parsed = parse_url( $referer );
111
 
112
- error_log( "-----" );
113
- // error_log( SimpleHistory::json_encode( $referer_parsed ) );
114
- error_log( SimpleHistory::json_encode( $_REQUEST ) );
115
-
116
  /*
117
  Create redirection
118
  {
@@ -210,9 +206,9 @@ if ( ! class_exists("Plugin_Redirection") ) {
210
  "update": "Update"
211
  }
212
  */
213
- if (
214
  isset( $_REQUEST["sub"] ) && $_REQUEST["sub"] == "options" &&
215
- isset( $_REQUEST["update"] ) && $_REQUEST["update"] == "Update"
216
 
217
  ) {
218
  $this->log_options_save( $_REQUEST );
@@ -231,9 +227,9 @@ if ( ! class_exists("Plugin_Redirection") ) {
231
  "add": "Add"
232
  }
233
  */
234
- if (
235
  isset( $_REQUEST["sub"] ) && $_REQUEST["sub"] == "groups" &&
236
- isset( $_REQUEST["add"] ) && $_REQUEST["add"] == "Add"
237
  ) {
238
  $this->log_group_add( $_REQUEST );
239
  return;
@@ -257,9 +253,9 @@ if ( ! class_exists("Plugin_Redirection") ) {
257
  "action2": "delete"
258
  }
259
  */
260
- if (
261
  isset( $_REQUEST["sub"] ) && $_REQUEST["sub"] == "groups" &&
262
- isset( $_REQUEST["action"] ) && $_REQUEST["action"] == "delete"
263
  ) {
264
  $this->log_group_delete( $_REQUEST );
265
  return;
@@ -285,15 +281,15 @@ if ( ! class_exists("Plugin_Redirection") ) {
285
  "action2": "-1"
286
  }
287
  */
288
- if (
289
  isset( $_REQUEST["sub"] ) && $_REQUEST["sub"] == "groups" &&
290
- isset( $_REQUEST["action"] ) && $_REQUEST["action"] == "enable"
291
  ) {
292
  $this->log_group_enable_or_disable( $_REQUEST );
293
  return;
294
- } else if (
295
  isset( $_REQUEST["sub"] ) && $_REQUEST["sub"] == "groups" &&
296
- isset( $_REQUEST["action"] ) && $_REQUEST["action"] == "disable"
297
  ) {
298
  $this->log_group_enable_or_disable( $_REQUEST );
299
  return;
@@ -343,7 +339,7 @@ if ( ! class_exists("Plugin_Redirection") ) {
343
 
344
  function log_options_save( $req ) {
345
 
346
- $this->infoMessage("redirection_options_saved");
347
 
348
  }
349
 
@@ -354,7 +350,7 @@ if ( ! class_exists("Plugin_Redirection") ) {
354
  }
355
 
356
  function log_redirection_delete( $req ) {
357
-
358
  $items = isset( $req["item"] ) ? (array) $req["item"] : array();
359
 
360
  $context = array(
@@ -365,7 +361,7 @@ if ( ! class_exists("Plugin_Redirection") ) {
365
  $message_key = "redirection_redirection_removed";
366
 
367
  $this->infoMessage(
368
- $message_key,
369
  $context
370
  );
371
 
@@ -389,7 +385,6 @@ if ( ! class_exists("Plugin_Redirection") ) {
389
  "_wp_http_referer": "\/wp-admin\/admin-ajax.php"
390
  }
391
  */
392
- #error_log( "log_redirection_edit\n" . SimpleHistory::json_encode( $_REQUEST ) );
393
 
394
  $context = array(
395
  "source_url" => isset( $req["old"] ) ? $req["old"] : null,
@@ -407,16 +402,16 @@ if ( ! class_exists("Plugin_Redirection") ) {
407
  $message_key = "redirection_redirection_edited";
408
 
409
  $this->infoMessage(
410
- $message_key,
411
  $context
412
  );
413
 
414
  }
415
 
416
  function log_redirection_enable_or_disable( $req ) {
417
-
418
  $message_key = $req["action"] == "enable" ? "redirection_redirection_enabled" : "redirection_redirection_disabled";
419
-
420
  $items = isset( $req["item"] ) ? (array) $req["item"] : array();
421
 
422
  $context = array(
@@ -425,18 +420,18 @@ if ( ! class_exists("Plugin_Redirection") ) {
425
  );
426
 
427
  $this->infoMessage(
428
- $message_key,
429
  $context
430
  );
431
 
432
  }
433
 
434
  function log_redirection_add( $req ) {
435
-
436
  if ( ! isset( $req["group_id"] ) ) {
437
  return;
438
  }
439
-
440
  $source = isset( $req["source"] ) ? $req["source"] : null;
441
  $target = isset( $req["target"] ) ? $req["target"] : null;
442
  $match = isset( $req["match"] ) ? $req["match"] : null;
109
 
110
  $referer_parsed = parse_url( $referer );
111
 
 
 
 
 
112
  /*
113
  Create redirection
114
  {
206
  "update": "Update"
207
  }
208
  */
209
+ if (
210
  isset( $_REQUEST["sub"] ) && $_REQUEST["sub"] == "options" &&
211
+ isset( $_REQUEST["update"] ) && $_REQUEST["update"] == "Update"
212
 
213
  ) {
214
  $this->log_options_save( $_REQUEST );
227
  "add": "Add"
228
  }
229
  */
230
+ if (
231
  isset( $_REQUEST["sub"] ) && $_REQUEST["sub"] == "groups" &&
232
+ isset( $_REQUEST["add"] ) && $_REQUEST["add"] == "Add"
233
  ) {
234
  $this->log_group_add( $_REQUEST );
235
  return;
253
  "action2": "delete"
254
  }
255
  */
256
+ if (
257
  isset( $_REQUEST["sub"] ) && $_REQUEST["sub"] == "groups" &&
258
+ isset( $_REQUEST["action"] ) && $_REQUEST["action"] == "delete"
259
  ) {
260
  $this->log_group_delete( $_REQUEST );
261
  return;
281
  "action2": "-1"
282
  }
283
  */
284
+ if (
285
  isset( $_REQUEST["sub"] ) && $_REQUEST["sub"] == "groups" &&
286
+ isset( $_REQUEST["action"] ) && $_REQUEST["action"] == "enable"
287
  ) {
288
  $this->log_group_enable_or_disable( $_REQUEST );
289
  return;
290
+ } else if (
291
  isset( $_REQUEST["sub"] ) && $_REQUEST["sub"] == "groups" &&
292
+ isset( $_REQUEST["action"] ) && $_REQUEST["action"] == "disable"
293
  ) {
294
  $this->log_group_enable_or_disable( $_REQUEST );
295
  return;
339
 
340
  function log_options_save( $req ) {
341
 
342
+ $this->infoMessage("redirection_options_saved");
343
 
344
  }
345
 
350
  }
351
 
352
  function log_redirection_delete( $req ) {
353
+
354
  $items = isset( $req["item"] ) ? (array) $req["item"] : array();
355
 
356
  $context = array(
361
  $message_key = "redirection_redirection_removed";
362
 
363
  $this->infoMessage(
364
+ $message_key,
365
  $context
366
  );
367
 
385
  "_wp_http_referer": "\/wp-admin\/admin-ajax.php"
386
  }
387
  */
 
388
 
389
  $context = array(
390
  "source_url" => isset( $req["old"] ) ? $req["old"] : null,
402
  $message_key = "redirection_redirection_edited";
403
 
404
  $this->infoMessage(
405
+ $message_key,
406
  $context
407
  );
408
 
409
  }
410
 
411
  function log_redirection_enable_or_disable( $req ) {
412
+
413
  $message_key = $req["action"] == "enable" ? "redirection_redirection_enabled" : "redirection_redirection_disabled";
414
+
415
  $items = isset( $req["item"] ) ? (array) $req["item"] : array();
416
 
417
  $context = array(
420
  );
421
 
422
  $this->infoMessage(
423
+ $message_key,
424
  $context
425
  );
426
 
427
  }
428
 
429
  function log_redirection_add( $req ) {
430
+
431
  if ( ! isset( $req["group_id"] ) ) {
432
  return;
433
  }
434
+
435
  $source = isset( $req["source"] ) ? $req["source"] : null;
436
  $target = isset( $req["target"] ) ? $req["target"] : null;
437
  $match = isset( $req["match"] ) ? $req["match"] : null;
loggers/SimpleMediaLogger.php CHANGED
@@ -146,16 +146,18 @@ class SimpleMediaLogger extends SimpleLogger
146
 
147
  /**
148
  * Get output for detailed log section
 
 
149
  */
150
- function getLogRowDetailsOutput($row) {
151
 
152
  $context = $row->context;
153
- $message_key = $context["_message_key"];
154
- $output = "";
155
 
156
- $attachment_id = $context["attachment_id"];
157
  $attachment_post = get_post( $attachment_id );
158
- $attachment_is_available = is_a($attachment_post, "WP_Post");
159
 
160
  if ( "attachment_updated" == $message_key ) {
161
 
@@ -177,16 +179,20 @@ class SimpleMediaLogger extends SimpleLogger
177
  $message = "";
178
  $full_src = false;
179
 
 
180
  $is_image = wp_attachment_is_image( $attachment_id );
 
 
181
  $is_video = strpos($filetype["type"], "video/") !== false;
182
  $is_audio = strpos($filetype["type"], "audio/") !== false;
183
 
184
  $full_image_width = null;
185
  $full_image_height = null;
 
186
  if ( $is_image ) {
187
 
188
- $thumb_src = wp_get_attachment_image_src($attachment_id, array(350,500));
189
- $full_src = wp_get_attachment_image_src($attachment_id, "full");
190
 
191
  $full_image_width = $full_src[1];
192
  $full_image_height = $full_src[2];
@@ -218,14 +224,13 @@ class SimpleMediaLogger extends SimpleLogger
218
 
219
  } else {
220
 
221
- // use wordpress icon for other media types
222
  if ( $attachment_is_available ) {
223
- $context["attachment_thumb"] = wp_get_attachment_image( $attachment_id, null, true );
 
 
 
224
  }
225
- /*else {
226
- // Add icon for deleted media?
227
- $context["attachment_thumb"] = "thumb";
228
- }*/
229
 
230
  }
231
 
@@ -238,7 +243,7 @@ class SimpleMediaLogger extends SimpleLogger
238
  $message .= "<a class='SimpleHistoryLogitemThumbnailLink' href='".$edit_link."'>";
239
  }
240
 
241
- $message .= __('{attachment_thumb}', 'simple-history');
242
 
243
  if ( $is_image ) {
244
  $message .= "</a>";
@@ -249,15 +254,14 @@ class SimpleMediaLogger extends SimpleLogger
249
  $message .= "<p class='SimpleHistoryLogitem--logger-SimpleMediaLogger--attachment-meta'>";
250
  $message .= "<span class='SimpleHistoryLogitem__inlineDivided'>" . __('{attachment_size_format}', "simple-history") . "</span> ";
251
  $message .= "<span class='SimpleHistoryLogitem__inlineDivided'>" . __('{attachment_filetype_extension}', "simple-history") . "</span>";
252
-
253
  if ( $full_image_width && $full_image_height ) {
254
 
255
- $message .= " <span class='SimpleHistoryLogitem__inlineDivided'>" . __('{full_image_width} × {full_image_height}', "simple-history") . "</span>";
256
 
257
  }
258
 
259
- //$message .= " <span class='SimpleHistoryLogitem__inlineDivided'>" . sprintf( __('<a href="%1$s">Edit attachment</a>'), $edit_link ) . "</span>";
260
- $message .= "</p>";
261
 
262
  $output .= $this->interpolate( $message, $context, $row );
263
 
@@ -360,7 +364,10 @@ class SimpleMediaLogger extends SimpleLogger
360
 
361
  if ( isset( $row->context["attachment_id"] ) ) {
362
 
363
- $permalink = add_query_arg(array("action" => "edit", "post" => $row->context["attachment_id"]), admin_url( "post.php" ) );
 
 
 
364
 
365
  if ( $permalink ) {
366
  $link = $permalink;
146
 
147
  /**
148
  * Get output for detailed log section
149
+ *
150
+ * @param array $row Row.
151
  */
152
+ function getLogRowDetailsOutput( $row ) {
153
 
154
  $context = $row->context;
155
+ $message_key = $context['_message_key'];
156
+ $output = '';
157
 
158
+ $attachment_id = $context['attachment_id'];
159
  $attachment_post = get_post( $attachment_id );
160
+ $attachment_is_available = is_a( $attachment_post, 'WP_Post' );
161
 
162
  if ( "attachment_updated" == $message_key ) {
163
 
179
  $message = "";
180
  $full_src = false;
181
 
182
+ // Is true if attachment is an image. But for example PDFs can have thumbnail images, but they are not considered to be image.
183
  $is_image = wp_attachment_is_image( $attachment_id );
184
+
185
+ // $message .= $is_image ? "is images yes" : "is image no";
186
  $is_video = strpos($filetype["type"], "video/") !== false;
187
  $is_audio = strpos($filetype["type"], "audio/") !== false;
188
 
189
  $full_image_width = null;
190
  $full_image_height = null;
191
+
192
  if ( $is_image ) {
193
 
194
+ $thumb_src = wp_get_attachment_image_src( $attachment_id, array( 350, 500 ) );
195
+ $full_src = wp_get_attachment_image_src( $attachment_id, 'full' );
196
 
197
  $full_image_width = $full_src[1];
198
  $full_image_height = $full_src[2];
224
 
225
  } else {
226
 
227
+ // Use WordPress icon for other media types.
228
  if ( $attachment_is_available ) {
229
+ $context['attachment_thumb'] = sprintf(
230
+ '%1$s',
231
+ wp_get_attachment_image( $attachment_id, array( 350, 500 ), true ) // Placeholder 1.
232
+ );
233
  }
 
 
 
 
234
 
235
  }
236
 
243
  $message .= "<a class='SimpleHistoryLogitemThumbnailLink' href='".$edit_link."'>";
244
  }
245
 
246
+ $message .= __( '{attachment_thumb}', 'simple-history' );
247
 
248
  if ( $is_image ) {
249
  $message .= "</a>";
254
  $message .= "<p class='SimpleHistoryLogitem--logger-SimpleMediaLogger--attachment-meta'>";
255
  $message .= "<span class='SimpleHistoryLogitem__inlineDivided'>" . __('{attachment_size_format}', "simple-history") . "</span> ";
256
  $message .= "<span class='SimpleHistoryLogitem__inlineDivided'>" . __('{attachment_filetype_extension}', "simple-history") . "</span>";
257
+
258
  if ( $full_image_width && $full_image_height ) {
259
 
260
+ $message .= " <span class='SimpleHistoryLogitem__inlineDivided'>" . __( '{full_image_width} × {full_image_height}', 'simple-history' ) . '</span>';
261
 
262
  }
263
 
264
+ $message .= '</p>';
 
265
 
266
  $output .= $this->interpolate( $message, $context, $row );
267
 
364
 
365
  if ( isset( $row->context["attachment_id"] ) ) {
366
 
367
+ $permalink = add_query_arg( array(
368
+ 'action' => 'edit',
369
+ 'post' => $row->context['attachment_id'],
370
+ ), admin_url( 'post.php' ) );
371
 
372
  if ( $permalink ) {
373
  $link = $permalink;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
4
  Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, dashboard, admin, syslog, feed, activity, stream, audit trail, brute-force
5
  Requires at least: 4.5.1
6
  Tested up to: 4.7
7
- Stable tag: 2.14.1
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
@@ -61,7 +61,7 @@ The [redirection plugin](https://sv.wordpress.org/plugins/redirection/) manages
61
  Simple History will log redirects and groups that are created, changed, enabled or disabled and also when the global plugin settings have been modified.
62
 
63
  **Duplicate Post**
64
- Tjhe plugin [Duplicate Post](https://wordpress.org/plugins/duplicate-post/) allows users to
65
  clone posts of any type.
66
  Simple History will log when a clone of a post or page is done.
67
 
@@ -162,6 +162,14 @@ A simple way to see any uncommon activity, for example an increased number of lo
162
 
163
  ## Changelog
164
 
 
 
 
 
 
 
 
 
165
  = 2.14.1 (April 2017) =
166
 
167
  - Fix for users running on older PHP versions.
4
  Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, dashboard, admin, syslog, feed, activity, stream, audit trail, brute-force
5
  Requires at least: 4.5.1
6
  Tested up to: 4.7
7
+ Stable tag: 2.15
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
61
  Simple History will log redirects and groups that are created, changed, enabled or disabled and also when the global plugin settings have been modified.
62
 
63
  **Duplicate Post**
64
+ The plugin [Duplicate Post](https://wordpress.org/plugins/duplicate-post/) allows users to
65
  clone posts of any type.
66
  Simple History will log when a clone of a post or page is done.
67
 
162
 
163
  ## Changelog
164
 
165
+ = 2.15 (May 2017) =
166
+
167
+ - Use thumbnail version of PDF preview instead of full size image.
168
+ - Remove Google Maps image when clicking IP address of failed login and similar, because Google Maps must be used with API key.
169
+ Hostname, Network, City, Region and Country is still shown.
170
+ - Fix notice in available updates logger.
171
+ - Fix notice in redirection logger.
172
+
173
  = 2.14.1 (April 2017) =
174
 
175
  - Fix for users running on older PHP versions.