Version Description
Unreleased =
Changed: It's now possible to log things before the
after_setup_theme
hook by using theSimpleLogger()
function. Before this change callingSimpleLogger()
beforeafter_setup_theme
, or onafter_setup_theme
with a prio smaller than 10, would result in a fatal error (Fatal error: Uncaught Error: Class 'SimpleLogger' not found
). Props https://github.com/JoryHogeveen.Changed: More custom post types that use the block editor ("Gutenberg") should now have their changes logged. Props https://github.com/claytoncollie.
Download this release
Release Info
Developer | eskapism |
Plugin | Simple History |
Version | 2.38.0 |
Comparing to | |
See all releases |
Code changes from version 2.37.2 to 2.38.0
- dropins/SimpleHistoryFilterDropin.css +1 -1
- dropins/SimpleHistoryFilterDropin.js +0 -1
- dropins/SimpleHistoryFilterDropin.php +1 -1
- inc/SimpleHistory.php +16 -12
- inc/helpers.php +6 -0
- index.php +2 -2
- loggers/SimplePostLogger.php +12 -3
- readme.txt +7 -1
dropins/SimpleHistoryFilterDropin.css
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
.SimpleHistory__filters__form input[type="text"],
|
23 |
.SimpleHistory__filters__form input[type="search"] {
|
24 |
/* width: 100%; */
|
25 |
-
|
26 |
}
|
27 |
|
28 |
.SimpleHistory__filters__filter--date,
|
22 |
.SimpleHistory__filters__form input[type="text"],
|
23 |
.SimpleHistory__filters__form input[type="search"] {
|
24 |
/* width: 100%; */
|
25 |
+
width: 310px !important;
|
26 |
}
|
27 |
|
28 |
.SimpleHistory__filters__filter--date,
|
dropins/SimpleHistoryFilterDropin.js
CHANGED
@@ -154,7 +154,6 @@ var SimpleHistoryFilterDropin = (function ($) {
|
|
154 |
$elms.filter_user.select2({
|
155 |
minimumInputLength: 2,
|
156 |
allowClear: true,
|
157 |
-
placeholder: 'All users',
|
158 |
ajax: {
|
159 |
url: ajaxurl,
|
160 |
dataType: 'json',
|
154 |
$elms.filter_user.select2({
|
155 |
minimumInputLength: 2,
|
156 |
allowClear: true,
|
|
|
157 |
ajax: {
|
158 |
url: ajaxurl,
|
159 |
dataType: 'json',
|
dropins/SimpleHistoryFilterDropin.php
CHANGED
@@ -411,7 +411,7 @@ class SimpleHistoryFilterDropin
|
|
411 |
<select
|
412 |
name="users"
|
413 |
class="SimpleHistory__filters__filter SimpleHistory__filters__filter--user"
|
414 |
-
placeholder="<?php _e('All users', 'simple-history') ?>"
|
415 |
value="<?php echo esc_attr(implode(',', $default_user_ids)) ?>"
|
416 |
data-default-user-data="<?php echo esc_attr(json_encode($arr_default_user_data)) ?>"
|
417 |
>
|
411 |
<select
|
412 |
name="users"
|
413 |
class="SimpleHistory__filters__filter SimpleHistory__filters__filter--user"
|
414 |
+
data-placeholder="<?php _e('All users', 'simple-history') ?>"
|
415 |
value="<?php echo esc_attr(implode(',', $default_user_ids)) ?>"
|
416 |
data-default-user-data="<?php echo esc_attr(json_encode($arr_default_user_data)) ?>"
|
417 |
>
|
inc/SimpleHistory.php
CHANGED
@@ -859,6 +859,20 @@ class SimpleHistory
|
|
859 |
{
|
860 |
$loggersDir = SIMPLE_HISTORY_PATH . 'loggers/';
|
861 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
862 |
$loggersFiles = [
|
863 |
// Main loggers.
|
864 |
$loggersDir . 'SimpleCommentsLogger.php',
|
@@ -891,14 +905,6 @@ class SimpleHistory
|
|
891 |
$loggersDir . 'Plugin_BeaverBuilder.php',
|
892 |
];
|
893 |
|
894 |
-
// SimpleLogger.php must be loaded first and always since the other loggers extend it.
|
895 |
-
// Include it manually so no risk of anyone using filters or similar disables it.
|
896 |
-
include_once $loggersDir . 'SimpleLogger.php';
|
897 |
-
include_once $loggersDir . 'SimpleLoggerLogInitiators.php';
|
898 |
-
include_once $loggersDir . 'SimpleLoggerLogTypes.php';
|
899 |
-
include_once $loggersDir . 'SimpleLoggerLogLevels.php';
|
900 |
-
include_once $loggersDir . 'SimpleLogger.php';
|
901 |
-
|
902 |
/**
|
903 |
* Filter the array with absolute paths to logger files to be loaded.
|
904 |
*
|
@@ -1031,8 +1037,6 @@ class SimpleHistory
|
|
1031 |
|
1032 |
// LoggerInfo contains all messages, both translated an not, by key.
|
1033 |
// Add messages to the loggerInstance.
|
1034 |
-
$loopNum = 0;
|
1035 |
-
|
1036 |
$arr_messages_by_message_key = [];
|
1037 |
|
1038 |
if (isset($logger_info['messages']) && is_array($logger_info['messages'])) {
|
@@ -2274,7 +2278,7 @@ Because Simple History was only recently installed, this feed does not display m
|
|
2274 |
* Loggers are discouraged to override this in the loggers,
|
2275 |
* because the output should be the same for all items in the gui
|
2276 |
*
|
2277 |
-
* @param
|
2278 |
* @return string
|
2279 |
*/
|
2280 |
public function getLogRowHeaderOutput($row)
|
@@ -2296,7 +2300,7 @@ Because Simple History was only recently installed, this feed does not display m
|
|
2296 |
/**
|
2297 |
*
|
2298 |
*
|
2299 |
-
* @param
|
2300 |
* @return string
|
2301 |
*/
|
2302 |
private function getLogRowSenderImageOutput($row)
|
859 |
{
|
860 |
$loggersDir = SIMPLE_HISTORY_PATH . 'loggers/';
|
861 |
|
862 |
+
// SimpleLogger.php must be loaded first and always since the other loggers extend it.
|
863 |
+
// Load it manually so no risk of anyone using filters or similar disables it.
|
864 |
+
// Also load files that contain constants used by the SimpleLogger.
|
865 |
+
include_once $loggersDir . 'SimpleLogger.php';
|
866 |
+
include_once $loggersDir . 'SimpleLoggerLogInitiators.php';
|
867 |
+
include_once $loggersDir . 'SimpleLoggerLogTypes.php';
|
868 |
+
include_once $loggersDir . 'SimpleLoggerLogLevels.php';
|
869 |
+
|
870 |
+
// Bail if we are not in filter after_setup_theme,
|
871 |
+
// i.e. we are probably calling SimpleLogger() early.
|
872 |
+
if (!doing_action('after_setup_theme')) {
|
873 |
+
return;
|
874 |
+
}
|
875 |
+
|
876 |
$loggersFiles = [
|
877 |
// Main loggers.
|
878 |
$loggersDir . 'SimpleCommentsLogger.php',
|
905 |
$loggersDir . 'Plugin_BeaverBuilder.php',
|
906 |
];
|
907 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
908 |
/**
|
909 |
* Filter the array with absolute paths to logger files to be loaded.
|
910 |
*
|
1037 |
|
1038 |
// LoggerInfo contains all messages, both translated an not, by key.
|
1039 |
// Add messages to the loggerInstance.
|
|
|
|
|
1040 |
$arr_messages_by_message_key = [];
|
1041 |
|
1042 |
if (isset($logger_info['messages']) && is_array($logger_info['messages'])) {
|
2278 |
* Loggers are discouraged to override this in the loggers,
|
2279 |
* because the output should be the same for all items in the gui
|
2280 |
*
|
2281 |
+
* @param object $row
|
2282 |
* @return string
|
2283 |
*/
|
2284 |
public function getLogRowHeaderOutput($row)
|
2300 |
/**
|
2301 |
*
|
2302 |
*
|
2303 |
+
* @param object $row
|
2304 |
* @return string
|
2305 |
*/
|
2306 |
private function getLogRowSenderImageOutput($row)
|
inc/helpers.php
CHANGED
@@ -8,6 +8,12 @@
|
|
8 |
*/
|
9 |
function SimpleLogger()
|
10 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
return new SimpleLogger(SimpleHistory::get_instance());
|
12 |
}
|
13 |
|
8 |
*/
|
9 |
function SimpleLogger()
|
10 |
{
|
11 |
+
// Load loggers if main SimpleLogger class is not yet available.
|
12 |
+
// Makes it possible to log things early,
|
13 |
+
// before loggers are loaded "normally" on filter "after_setup_theme".
|
14 |
+
if (!class_exists('SimpleLogger')) {
|
15 |
+
SimpleHistory::get_instance()->load_loggers();
|
16 |
+
}
|
17 |
return new SimpleLogger(SimpleHistory::get_instance());
|
18 |
}
|
19 |
|
index.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* Text Domain: simple-history
|
7 |
* Domain Path: /languages
|
8 |
* Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
|
9 |
-
* Version: 2.
|
10 |
* Author: Pär Thernström
|
11 |
* Author URI: http://simple-history.com/
|
12 |
* License: GPL2
|
@@ -45,7 +45,7 @@ if ($ok_php_version && $ok_wp_version) {
|
|
45 |
* @TODO: make activation multi site aware, as in https://github.com/scribu/wp-proper-network-activation
|
46 |
* register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
|
47 |
*/
|
48 |
-
define('SIMPLE_HISTORY_VERSION', '2.
|
49 |
define('SIMPLE_HISTORY_PATH', plugin_dir_path(__FILE__));
|
50 |
define('SIMPLE_HISTORY_BASENAME', plugin_basename(__FILE__));
|
51 |
define('SIMPLE_HISTORY_DIR_URL', plugin_dir_url(__FILE__));
|
6 |
* Text Domain: simple-history
|
7 |
* Domain Path: /languages
|
8 |
* Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
|
9 |
+
* Version: 2.38.0
|
10 |
* Author: Pär Thernström
|
11 |
* Author URI: http://simple-history.com/
|
12 |
* License: GPL2
|
45 |
* @TODO: make activation multi site aware, as in https://github.com/scribu/wp-proper-network-activation
|
46 |
* register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
|
47 |
*/
|
48 |
+
define('SIMPLE_HISTORY_VERSION', '2.38.0');
|
49 |
define('SIMPLE_HISTORY_PATH', plugin_dir_path(__FILE__));
|
50 |
define('SIMPLE_HISTORY_BASENAME', plugin_basename(__FILE__));
|
51 |
define('SIMPLE_HISTORY_DIR_URL', plugin_dir_url(__FILE__));
|
loggers/SimplePostLogger.php
CHANGED
@@ -35,7 +35,9 @@ class SimplePostLogger extends SimpleLogger
|
|
35 |
add_action('untrash_post', array($this, 'on_untrash_post'));
|
36 |
|
37 |
$this->add_xml_rpc_hooks();
|
38 |
-
|
|
|
|
|
39 |
|
40 |
add_filter('simple_history/rss_item_link', array($this, 'filter_rss_item_link'), 10, 2);
|
41 |
}
|
@@ -45,8 +47,15 @@ class SimplePostLogger extends SimpleLogger
|
|
45 |
*/
|
46 |
public function add_rest_hooks()
|
47 |
{
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
// Add actions for each post type.
|
52 |
foreach ($post_types as $post_type) {
|
35 |
add_action('untrash_post', array($this, 'on_untrash_post'));
|
36 |
|
37 |
$this->add_xml_rpc_hooks();
|
38 |
+
|
39 |
+
// Add rest hooks late to increase chance of getting all registered post types.
|
40 |
+
add_action('init', array($this, 'add_rest_hooks'), 99);
|
41 |
|
42 |
add_filter('simple_history/rss_item_link', array($this, 'filter_rss_item_link'), 10, 2);
|
43 |
}
|
47 |
*/
|
48 |
public function add_rest_hooks()
|
49 |
{
|
50 |
+
/**
|
51 |
+
* Filter the post types we are logging information from.
|
52 |
+
*
|
53 |
+
* @param array $post_types Core, public and private post types.
|
54 |
+
* @return array $post_types Filtered post types.
|
55 |
+
*
|
56 |
+
* @since 2.37
|
57 |
+
*/
|
58 |
+
$post_types = apply_filters('simple_history/post_logger/post_types', get_post_types(array(), 'object'));
|
59 |
|
60 |
// Add actions for each post type.
|
61 |
foreach ($post_types as $post_type) {
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: history, log, changes, changelog, audit, audit log, event log, user tracki
|
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 2.
|
9 |
|
10 |
View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
|
11 |
|
@@ -189,6 +189,12 @@ Events in the log are stored for 60 days by default. Events older than this will
|
|
189 |
|
190 |
== Changelog ==
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
= 2.37.2 (September 2020) =
|
193 |
|
194 |
- Fixed: Even more code that was to new for PHP 5.6 (I do have some tests, I just didn't look at them `¯\_(ツ)_/¯`.)
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.38.0
|
9 |
|
10 |
View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
|
11 |
|
189 |
|
190 |
== Changelog ==
|
191 |
|
192 |
+
= 2.38.0 Unreleased =
|
193 |
+
|
194 |
+
- Changed: It's now possible to log things before the `after_setup_theme` hook by using the `SimpleLogger()` function. Before this change calling `SimpleLogger()` before `after_setup_theme`, or on `after_setup_theme` with a prio smaller than 10, would result in a fatal error (`Fatal error: Uncaught Error: Class 'SimpleLogger' not found`). Props https://github.com/JoryHogeveen.
|
195 |
+
|
196 |
+
- Changed: More custom post types that use the block editor ("Gutenberg") should now have their changes logged. Props https://github.com/claytoncollie.
|
197 |
+
|
198 |
= 2.37.2 (September 2020) =
|
199 |
|
200 |
- Fixed: Even more code that was to new for PHP 5.6 (I do have some tests, I just didn't look at them `¯\_(ツ)_/¯`.)
|