Version Description
Download this release
Release Info
Developer | eskapism |
Plugin | Simple History |
Version | 2.37.0 |
Comparing to | |
See all releases |
Code changes from version 2.36.0 to 2.37.0
- code.md +13 -4
- dropins/SimpleHistoryDonateDropin.php +4 -4
- dropins/SimpleHistoryFilterDropin.php +19 -16
- dropins/SimpleHistoryIpInfoDropin.php +2 -9
- dropins/SimpleHistoryNewRowsNotifier.php +2 -2
- dropins/SimpleHistoryPluginPatchesDropin.php +4 -4
- dropins/SimpleHistoryRSSDropin.php +3 -5
- dropins/SimpleHistorySidebarDropin.php +2 -2
- dropins/SimpleHistorySidebarSettings.php +3 -3
- dropins/SimpleHistorySidebarStats.php +4 -4
- dropins/SimpleHistoryWPCLIDropin.php +1 -2
- examples/example-dropin.php +8 -12
- examples/example-logger.php +3 -5
- inc/SimpleHistory.php +18 -13
- inc/helpers.php +39 -0
- index.php +2 -2
- loggers/AvailableUpdatesLogger.php +10 -11
- loggers/FileEditsLogger.php +3 -3
- loggers/PluginEnableMediaReplaceLogger.php +3 -3
- loggers/PluginUserSwitchingLogger.php +5 -5
- loggers/Plugin_ACF.php +2 -2
- loggers/Plugin_BeaverBuilder.php +14 -13
- loggers/Plugin_DuplicatePost.php +54 -33
- loggers/Plugin_LimitLoginAttempts.php +6 -8
- loggers/Plugin_Redirection.php +2 -4
- loggers/Plugin_UltimateMembers_Logger.php +3 -5
- loggers/SimpleCommentsLogger.php +10 -20
- loggers/SimpleCoreUpdatesLogger.php +3 -3
- loggers/SimpleExportLogger.php +3 -22
- loggers/SimpleLegacyLogger.php +1 -2
- loggers/SimpleLogger.php +3 -58
- loggers/SimpleLoggerLogInitiators.php +27 -0
- loggers/SimpleLoggerLogLevels.php +18 -0
- loggers/SimpleLoggerLogTypes.php +19 -0
- loggers/SimpleMediaLogger.php +22 -25
- loggers/SimpleMenuLogger.php +7 -9
- loggers/SimpleOptionsLogger.php +13 -14
- loggers/SimplePluginLogger.php +196 -24
- loggers/SimpleThemeLogger.php +19 -21
- loggers/SimpleUserLogger.php +15 -4
- loggers/class-sh-jetpack-logger.php +2 -2
- loggers/class-sh-privacy-logger.php +1 -1
- loggers/class-sh-translations-logger.php +1 -2
- readme.txt +9 -2
- templates/settings-style-example.php +20 -6
code.md
CHANGED
@@ -1,16 +1,18 @@
|
|
1 |
Since I always forget what standards I use in different projects this file is here to remind me about the standards I use in this project:
|
2 |
|
3 |
- PHP coding standard: [PSR12()] because that's the standard that I use in other projects.
|
4 |
-
|
|
|
5 |
|
6 |
- Formatting:
|
7 |
phpcbf to fix errors and warning.
|
8 |
Then sometimes Prettier, but befare it's not 100 % stable yet for PHP files.
|
9 |
|
10 |
- phpcs to lint while editing. Lots of code is old but working but was written
|
11 |
-
before my editor had nice linting, so much of the code does not lint. This will be fixed.
|
|
|
12 |
|
13 |
-
|
14 |
|
15 |
## How to use in Visual Studio Code
|
16 |
|
@@ -21,8 +23,15 @@ Since I always forget what standards I use in different projects this file is he
|
|
21 |
|
22 |
List errors and warnings:
|
23 |
|
24 |
-
$ phpcs /path/to/code/myfile.php
|
|
|
|
|
25 |
|
26 |
Fix things:
|
27 |
|
28 |
$ phpcbf /path/to/code
|
|
|
|
|
|
|
|
|
|
1 |
Since I always forget what standards I use in different projects this file is here to remind me about the standards I use in this project:
|
2 |
|
3 |
- PHP coding standard: [PSR12()] because that's the standard that I use in other projects.
|
4 |
+
|
5 |
+
- `phpcs.xml.dist` is the config used.
|
6 |
|
7 |
- Formatting:
|
8 |
phpcbf to fix errors and warning.
|
9 |
Then sometimes Prettier, but befare it's not 100 % stable yet for PHP files.
|
10 |
|
11 |
- phpcs to lint while editing. Lots of code is old but working but was written
|
12 |
+
before my editor had nice linting, so much of the code does not lint. This will be fixed.
|
13 |
+
`$ phpcs` to lint PHP from command line
|
14 |
|
15 |
+
- Changelog: try to use format from https://keepachangelog.com.
|
16 |
|
17 |
## How to use in Visual Studio Code
|
18 |
|
23 |
|
24 |
List errors and warnings:
|
25 |
|
26 |
+
$ phpcs /path/to/code/myfile.php # lint specific file
|
27 |
+
$ phpcs # be in plugin root and all files will be linted
|
28 |
+
$ npm run lint-php # or use npm script
|
29 |
|
30 |
Fix things:
|
31 |
|
32 |
$ phpcbf /path/to/code
|
33 |
+
|
34 |
+
## Git
|
35 |
+
|
36 |
+
- Will try to follow OneFlow:
|
37 |
+
https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow
|
dropins/SimpleHistoryDonateDropin.php
CHANGED
@@ -18,7 +18,7 @@ class SimpleHistoryDonateDropin
|
|
18 |
// Simple History instance
|
19 |
private $sh;
|
20 |
|
21 |
-
function __construct($sh)
|
22 |
{
|
23 |
|
24 |
$this->sh = $sh;
|
@@ -30,7 +30,7 @@ class SimpleHistoryDonateDropin
|
|
30 |
* Add link to the donate page in the Plugins » Installed plugins screen
|
31 |
* Called from filter 'plugin_row_meta'
|
32 |
*/
|
33 |
-
function action_plugin_row_meta($links, $file)
|
34 |
{
|
35 |
|
36 |
if ($file == $this->sh->plugin_basename) {
|
@@ -67,7 +67,7 @@ class SimpleHistoryDonateDropin
|
|
67 |
*/
|
68 |
}
|
69 |
|
70 |
-
function settings_section_output()
|
71 |
{
|
72 |
|
73 |
printf(
|
@@ -77,7 +77,7 @@ class SimpleHistoryDonateDropin
|
|
77 |
}
|
78 |
|
79 |
|
80 |
-
function settings_field_donate()
|
81 |
{
|
82 |
}
|
83 |
}
|
18 |
// Simple History instance
|
19 |
private $sh;
|
20 |
|
21 |
+
public function __construct($sh)
|
22 |
{
|
23 |
|
24 |
$this->sh = $sh;
|
30 |
* Add link to the donate page in the Plugins » Installed plugins screen
|
31 |
* Called from filter 'plugin_row_meta'
|
32 |
*/
|
33 |
+
public function action_plugin_row_meta($links, $file)
|
34 |
{
|
35 |
|
36 |
if ($file == $this->sh->plugin_basename) {
|
67 |
*/
|
68 |
}
|
69 |
|
70 |
+
public function settings_section_output()
|
71 |
{
|
72 |
|
73 |
printf(
|
77 |
}
|
78 |
|
79 |
|
80 |
+
public function settings_field_donate()
|
81 |
{
|
82 |
}
|
83 |
}
|
dropins/SimpleHistoryFilterDropin.php
CHANGED
@@ -14,7 +14,7 @@ class SimpleHistoryFilterDropin
|
|
14 |
// Simple History instance
|
15 |
private $sh;
|
16 |
|
17 |
-
function __construct($sh)
|
18 |
{
|
19 |
|
20 |
$this->sh = $sh;
|
@@ -262,8 +262,12 @@ class SimpleHistoryFilterDropin
|
|
262 |
</p>
|
263 |
|
264 |
<p class="SimpleHistory__filters__filterSubmitWrap">
|
265 |
-
<button class="button SimpleHistoryFilterDropin-doFilterButton SimpleHistoryFilterDropin-doFilterButton--first js-SimpleHistoryFilterDropin-doFilter"
|
266 |
-
|
|
|
|
|
|
|
|
|
267 |
</p>
|
268 |
|
269 |
<?php
|
@@ -419,8 +423,12 @@ class SimpleHistoryFilterDropin
|
|
419 |
?>
|
420 |
|
421 |
<p class="SimpleHistory__filters__filterSubmitWrap">
|
422 |
-
<button class="button SimpleHistoryFilterDropin-doFilterButton SimpleHistoryFilterDropin-doFilterButton--second js-SimpleHistoryFilterDropin-doFilter"
|
423 |
-
|
|
|
|
|
|
|
|
|
424 |
</p>
|
425 |
|
426 |
</div><!-- // more filters -->
|
@@ -435,8 +443,7 @@ class SimpleHistoryFilterDropin
|
|
435 |
|
436 |
</div>
|
437 |
<?php
|
438 |
-
}
|
439 |
-
|
440 |
|
441 |
/**
|
442 |
* Return format used for select2 for a single user id
|
@@ -516,9 +523,9 @@ class SimpleHistoryFilterDropin
|
|
516 |
$data['results'] = array_merge($data['results'], $results_user);
|
517 |
|
518 |
wp_send_json_success($data);
|
519 |
-
}
|
520 |
|
521 |
-
function add_gravatar_to_user_array(&$val, $index = null)
|
522 |
{
|
523 |
$val->text = sprintf(
|
524 |
'%1$s - %2$s',
|
@@ -543,7 +550,7 @@ class SimpleHistoryFilterDropin
|
|
543 |
* @param int|bool $multi Optional. Whether the additional fields and buttons should be added.
|
544 |
* Default 0|false.
|
545 |
*/
|
546 |
-
function touch_time($from_or_to, $edit = 1)
|
547 |
{
|
548 |
|
549 |
global $wp_locale;
|
@@ -589,9 +596,5 @@ class SimpleHistoryFilterDropin
|
|
589 |
printf(__('%1$s %2$s, %3$s'), $month, $day, $year);
|
590 |
|
591 |
echo '</span>';
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
<?php
|
596 |
-
} // func
|
597 |
-
} // end class
|
14 |
// Simple History instance
|
15 |
private $sh;
|
16 |
|
17 |
+
public function __construct($sh)
|
18 |
{
|
19 |
|
20 |
$this->sh = $sh;
|
262 |
</p>
|
263 |
|
264 |
<p class="SimpleHistory__filters__filterSubmitWrap">
|
265 |
+
<button class="button SimpleHistoryFilterDropin-doFilterButton SimpleHistoryFilterDropin-doFilterButton--first js-SimpleHistoryFilterDropin-doFilter">
|
266 |
+
<?php _e('Search events', 'simple-history') ?>
|
267 |
+
</button>
|
268 |
+
<button type="button" class="SimpleHistoryFilterDropin-showMoreFilters SimpleHistoryFilterDropin-showMoreFilters--first js-SimpleHistoryFilterDropin-showMoreFilters">
|
269 |
+
<?php _ex('Show search options', 'Filter dropin: button to show more search options', 'simple-history') ?>
|
270 |
+
</button>
|
271 |
</p>
|
272 |
|
273 |
<?php
|
423 |
?>
|
424 |
|
425 |
<p class="SimpleHistory__filters__filterSubmitWrap">
|
426 |
+
<button class="button SimpleHistoryFilterDropin-doFilterButton SimpleHistoryFilterDropin-doFilterButton--second js-SimpleHistoryFilterDropin-doFilter">
|
427 |
+
<?php _e('Search events', 'simple-history') ?>
|
428 |
+
</button>
|
429 |
+
<button type="button" class="SimpleHistoryFilterDropin-showMoreFilters SimpleHistoryFilterDropin-showMoreFilters--second js-SimpleHistoryFilterDropin-showMoreFilters">
|
430 |
+
<?php _ex('Hide search options', 'Filter dropin: button to hide more search options', 'simple-history') ?>
|
431 |
+
</button>
|
432 |
</p>
|
433 |
|
434 |
</div><!-- // more filters -->
|
443 |
|
444 |
</div>
|
445 |
<?php
|
446 |
+
}
|
|
|
447 |
|
448 |
/**
|
449 |
* Return format used for select2 for a single user id
|
523 |
$data['results'] = array_merge($data['results'], $results_user);
|
524 |
|
525 |
wp_send_json_success($data);
|
526 |
+
}
|
527 |
|
528 |
+
public function add_gravatar_to_user_array(&$val, $index = null)
|
529 |
{
|
530 |
$val->text = sprintf(
|
531 |
'%1$s - %2$s',
|
550 |
* @param int|bool $multi Optional. Whether the additional fields and buttons should be added.
|
551 |
* Default 0|false.
|
552 |
*/
|
553 |
+
public function touch_time($from_or_to, $edit = 1)
|
554 |
{
|
555 |
|
556 |
global $wp_locale;
|
596 |
printf(__('%1$s %2$s, %3$s'), $month, $day, $year);
|
597 |
|
598 |
echo '</span>';
|
599 |
+
}
|
600 |
+
}
|
|
|
|
|
|
|
|
dropins/SimpleHistoryIpInfoDropin.php
CHANGED
@@ -13,17 +13,11 @@ class SimpleHistoryIpInfoDropin
|
|
13 |
|
14 |
private $sh;
|
15 |
|
16 |
-
function __construct($sh)
|
17 |
{
|
18 |
|
19 |
$this->sh = $sh;
|
20 |
|
21 |
-
// Since it's not quite done yet, it's for da devs only for now
|
22 |
-
/*
|
23 |
-
if ( ! defined("SIMPLE_HISTORY_DEV") || ! SIMPLE_HISTORY_DEV ) {
|
24 |
-
return;
|
25 |
-
}*/
|
26 |
-
|
27 |
add_action('simple_history/enqueue_admin_scripts', array( $this, 'enqueue_admin_scripts' ));
|
28 |
add_action('simple_history/admin_footer', array( $this, 'add_js_template' ));
|
29 |
}
|
@@ -173,5 +167,4 @@ class SimpleHistoryIpInfoDropin
|
|
173 |
</script>
|
174 |
<?php
|
175 |
}
|
176 |
-
}
|
177 |
-
|
13 |
|
14 |
private $sh;
|
15 |
|
16 |
+
public function __construct($sh)
|
17 |
{
|
18 |
|
19 |
$this->sh = $sh;
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
add_action('simple_history/enqueue_admin_scripts', array( $this, 'enqueue_admin_scripts' ));
|
22 |
add_action('simple_history/admin_footer', array( $this, 'add_js_template' ));
|
23 |
}
|
167 |
</script>
|
168 |
<?php
|
169 |
}
|
170 |
+
}
|
|
dropins/SimpleHistoryNewRowsNotifier.php
CHANGED
@@ -18,7 +18,7 @@ class SimpleHistoryNewRowsNotifier
|
|
18 |
// How often we should check for new rows, in ms
|
19 |
private $interval = 10000;
|
20 |
|
21 |
-
function __construct($sh)
|
22 |
{
|
23 |
|
24 |
$this->sh = $sh;
|
@@ -95,4 +95,4 @@ class SimpleHistoryNewRowsNotifier
|
|
95 |
|
96 |
wp_send_json_success($json_data);
|
97 |
}
|
98 |
-
}
|
18 |
// How often we should check for new rows, in ms
|
19 |
private $interval = 10000;
|
20 |
|
21 |
+
public function __construct($sh)
|
22 |
{
|
23 |
|
24 |
$this->sh = $sh;
|
95 |
|
96 |
wp_send_json_success($json_data);
|
97 |
}
|
98 |
+
}
|
dropins/SimpleHistoryPluginPatchesDropin.php
CHANGED
@@ -14,7 +14,7 @@ class SimpleHistoryPluginPatchesDropin
|
|
14 |
|
15 |
private $sh;
|
16 |
|
17 |
-
function __construct($sh)
|
18 |
{
|
19 |
|
20 |
$this->sh = $sh;
|
@@ -55,7 +55,7 @@ class SimpleHistoryPluginPatchesDropin
|
|
55 |
* Plugin also gives lots of errors, reported by me here:
|
56 |
* https://wordpress.org/support/topic/errors-has_cap-deprecated-strict-standards-warning
|
57 |
*/
|
58 |
-
function patch_captcha_on_login()
|
59 |
{
|
60 |
|
61 |
add_action('simple_history/log/do_log', array( $this, 'patch_captcha_on_login_on_log' ), 10, 5);
|
@@ -63,7 +63,7 @@ class SimpleHistoryPluginPatchesDropin
|
|
63 |
|
64 |
// Detect that this log message is being called from Captha on login
|
65 |
// and that the message is "user_logged_out"
|
66 |
-
function patch_captcha_on_login_on_log($doLog, $level = null, $message = null, $context = null, $loggerInstance = null)
|
67 |
{
|
68 |
|
69 |
if (empty($context) || ! isset($context['_message_key']) || 'user_logged_out' != $context['_message_key']) {
|
@@ -168,4 +168,4 @@ class SimpleHistoryPluginPatchesDropin
|
|
168 |
|
169 |
return $doLog;
|
170 |
}
|
171 |
-
}
|
14 |
|
15 |
private $sh;
|
16 |
|
17 |
+
public function __construct($sh)
|
18 |
{
|
19 |
|
20 |
$this->sh = $sh;
|
55 |
* Plugin also gives lots of errors, reported by me here:
|
56 |
* https://wordpress.org/support/topic/errors-has_cap-deprecated-strict-standards-warning
|
57 |
*/
|
58 |
+
public function patch_captcha_on_login()
|
59 |
{
|
60 |
|
61 |
add_action('simple_history/log/do_log', array( $this, 'patch_captcha_on_login_on_log' ), 10, 5);
|
63 |
|
64 |
// Detect that this log message is being called from Captha on login
|
65 |
// and that the message is "user_logged_out"
|
66 |
+
public function patch_captcha_on_login_on_log($doLog, $level = null, $message = null, $context = null, $loggerInstance = null)
|
67 |
{
|
68 |
|
69 |
if (empty($context) || ! isset($context['_message_key']) || 'user_logged_out' != $context['_message_key']) {
|
168 |
|
169 |
return $doLog;
|
170 |
}
|
171 |
+
}
|
dropins/SimpleHistoryRSSDropin.php
CHANGED
@@ -12,8 +12,6 @@ Author: Pär Thernström
|
|
12 |
*/
|
13 |
class SimpleHistoryRSSDropin
|
14 |
{
|
15 |
-
|
16 |
-
|
17 |
public function __construct($sh)
|
18 |
{
|
19 |
|
@@ -114,7 +112,7 @@ class SimpleHistoryRSSDropin
|
|
114 |
wp_redirect($goback);
|
115 |
exit;
|
116 |
}
|
117 |
-
}
|
118 |
|
119 |
/**
|
120 |
* Check if RSS feed is enabled or disabled
|
@@ -321,7 +319,7 @@ class SimpleHistoryRSSDropin
|
|
321 |
</rss>
|
322 |
<?php
|
323 |
}// End if().
|
324 |
-
}
|
325 |
|
326 |
/**
|
327 |
* Create a new RSS secret
|
@@ -408,4 +406,4 @@ class SimpleHistoryRSSDropin
|
|
408 |
_e('Simple History has a RSS feed which you can subscribe to and receive log updates. Make sure you only share the feed with people you trust, since it can contain sensitive or confidential information.', 'simple-history');
|
409 |
echo '</p>';
|
410 |
}
|
411 |
-
}
|
12 |
*/
|
13 |
class SimpleHistoryRSSDropin
|
14 |
{
|
|
|
|
|
15 |
public function __construct($sh)
|
16 |
{
|
17 |
|
112 |
wp_redirect($goback);
|
113 |
exit;
|
114 |
}
|
115 |
+
}
|
116 |
|
117 |
/**
|
118 |
* Check if RSS feed is enabled or disabled
|
319 |
</rss>
|
320 |
<?php
|
321 |
}// End if().
|
322 |
+
}
|
323 |
|
324 |
/**
|
325 |
* Create a new RSS secret
|
406 |
_e('Simple History has a RSS feed which you can subscribe to and receive log updates. Make sure you only share the feed with people you trust, since it can contain sensitive or confidential information.', 'simple-history');
|
407 |
echo '</p>';
|
408 |
}
|
409 |
+
}
|
dropins/SimpleHistorySidebarDropin.php
CHANGED
@@ -207,7 +207,7 @@ class SimpleHistorySidebarDropin
|
|
207 |
* <div class="postbox">
|
208 |
* <h3 class="hndle">Title</h3>
|
209 |
* <div class="inside">
|
210 |
-
* <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
211 |
* </div>
|
212 |
* </div>
|
213 |
*/
|
@@ -232,4 +232,4 @@ class SimpleHistorySidebarDropin
|
|
232 |
</div>
|
233 |
<?php
|
234 |
}
|
235 |
-
}
|
207 |
* <div class="postbox">
|
208 |
* <h3 class="hndle">Title</h3>
|
209 |
* <div class="inside">
|
210 |
+
* <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
211 |
* </div>
|
212 |
* </div>
|
213 |
*/
|
232 |
</div>
|
233 |
<?php
|
234 |
}
|
235 |
+
}
|
dropins/SimpleHistorySidebarSettings.php
CHANGED
@@ -23,7 +23,7 @@ class SimpleHistorySidebarSettings
|
|
23 |
*
|
24 |
* @param object $sh Simple History instance.
|
25 |
*/
|
26 |
-
function __construct($sh)
|
27 |
{
|
28 |
|
29 |
$this->init($sh);
|
@@ -34,7 +34,7 @@ class SimpleHistorySidebarSettings
|
|
34 |
*
|
35 |
* @param object $sh Simple History instance.
|
36 |
*/
|
37 |
-
function init($sh)
|
38 |
{
|
39 |
|
40 |
$this->sh = $sh;
|
@@ -45,7 +45,7 @@ class SimpleHistorySidebarSettings
|
|
45 |
/**
|
46 |
* Output HTML
|
47 |
*/
|
48 |
-
function on_sidebar_html()
|
49 |
{
|
50 |
|
51 |
?>
|
23 |
*
|
24 |
* @param object $sh Simple History instance.
|
25 |
*/
|
26 |
+
public function __construct($sh)
|
27 |
{
|
28 |
|
29 |
$this->init($sh);
|
34 |
*
|
35 |
* @param object $sh Simple History instance.
|
36 |
*/
|
37 |
+
public function init($sh)
|
38 |
{
|
39 |
|
40 |
$this->sh = $sh;
|
45 |
/**
|
46 |
* Output HTML
|
47 |
*/
|
48 |
+
public function on_sidebar_html()
|
49 |
{
|
50 |
|
51 |
?>
|
dropins/SimpleHistorySidebarStats.php
CHANGED
@@ -13,13 +13,13 @@ class SimpleHistorySidebarStats
|
|
13 |
|
14 |
private $sh;
|
15 |
|
16 |
-
function __construct($sh)
|
17 |
{
|
18 |
|
19 |
$this->init($sh);
|
20 |
}
|
21 |
|
22 |
-
function init($sh)
|
23 |
{
|
24 |
|
25 |
$this->sh = $sh;
|
@@ -37,7 +37,7 @@ class SimpleHistorySidebarStats
|
|
37 |
wp_enqueue_script('simple_history_chart.js', SIMPLE_HISTORY_DIR_URL . 'js/Chart.js', array( 'jquery' ), SIMPLE_HISTORY_VERSION, true);
|
38 |
}
|
39 |
|
40 |
-
function on_admin_footer()
|
41 |
{
|
42 |
|
43 |
?>
|
@@ -141,7 +141,7 @@ class SimpleHistorySidebarStats
|
|
141 |
<?php
|
142 |
}
|
143 |
|
144 |
-
function on_sidebar_html()
|
145 |
{
|
146 |
|
147 |
$num_days = 28;
|
13 |
|
14 |
private $sh;
|
15 |
|
16 |
+
public function __construct($sh)
|
17 |
{
|
18 |
|
19 |
$this->init($sh);
|
20 |
}
|
21 |
|
22 |
+
public function init($sh)
|
23 |
{
|
24 |
|
25 |
$this->sh = $sh;
|
37 |
wp_enqueue_script('simple_history_chart.js', SIMPLE_HISTORY_DIR_URL . 'js/Chart.js', array( 'jquery' ), SIMPLE_HISTORY_VERSION, true);
|
38 |
}
|
39 |
|
40 |
+
public function on_admin_footer()
|
41 |
{
|
42 |
|
43 |
?>
|
141 |
<?php
|
142 |
}
|
143 |
|
144 |
+
public function on_sidebar_html()
|
145 |
{
|
146 |
|
147 |
$num_days = 28;
|
dropins/SimpleHistoryWPCLIDropin.php
CHANGED
@@ -10,11 +10,10 @@ Author: Pär Thernström
|
|
10 |
|
11 |
class SimpleHistoryWPCLIDropin
|
12 |
{
|
13 |
-
|
14 |
// Simple History instance
|
15 |
private $sh;
|
16 |
|
17 |
-
function __construct($sh)
|
18 |
{
|
19 |
|
20 |
$this->sh = $sh;
|
10 |
|
11 |
class SimpleHistoryWPCLIDropin
|
12 |
{
|
|
|
13 |
// Simple History instance
|
14 |
private $sh;
|
15 |
|
16 |
+
public function __construct($sh)
|
17 |
{
|
18 |
|
19 |
$this->sh = $sh;
|
examples/example-dropin.php
CHANGED
@@ -3,16 +3,14 @@
|
|
3 |
// No external calls allowed to test file
|
4 |
exit;
|
5 |
|
6 |
-
|
7 |
/**
|
8 |
* This example shows how to create a simple dropin
|
9 |
* that will add a tab to the simple history settings page
|
10 |
*/
|
11 |
|
12 |
-
// We use the function "
|
13 |
// We call it from inside the filter "simple_history/add_custom_logger".
|
14 |
add_action('simple_history/add_custom_dropin', function ($simpleHistory) {
|
15 |
-
|
16 |
$simpleHistory->register_dropin('AddSettingsPageTab');
|
17 |
});
|
18 |
|
@@ -27,7 +25,7 @@ class AddSettingsPageTab
|
|
27 |
private $sh;
|
28 |
|
29 |
// simple history will pass itself to the constructor
|
30 |
-
function __construct($sh)
|
31 |
{
|
32 |
|
33 |
$this->sh = $sh;
|
@@ -35,23 +33,23 @@ class AddSettingsPageTab
|
|
35 |
$this->init();
|
36 |
}
|
37 |
|
38 |
-
function init()
|
39 |
{
|
40 |
|
41 |
-
add_action('init', array( $this, '
|
42 |
}
|
43 |
|
44 |
-
function
|
45 |
{
|
46 |
|
47 |
$this->sh->registerSettingsTab(array(
|
48 |
'slug' => 'my_unique_settings_tab_slug',
|
49 |
'name' => __('Example tab', 'simple-history'),
|
50 |
-
'function' => array( $this, '
|
51 |
));
|
52 |
}
|
53 |
|
54 |
-
function
|
55 |
{
|
56 |
|
57 |
?>
|
@@ -62,6 +60,4 @@ class AddSettingsPageTab
|
|
62 |
|
63 |
<?php
|
64 |
}
|
65 |
-
}
|
66 |
-
|
67 |
-
|
3 |
// No external calls allowed to test file
|
4 |
exit;
|
5 |
|
|
|
6 |
/**
|
7 |
* This example shows how to create a simple dropin
|
8 |
* that will add a tab to the simple history settings page
|
9 |
*/
|
10 |
|
11 |
+
// We use the function "register_dropin" to tell tell SimpleHistory that our custom logger exists.
|
12 |
// We call it from inside the filter "simple_history/add_custom_logger".
|
13 |
add_action('simple_history/add_custom_dropin', function ($simpleHistory) {
|
|
|
14 |
$simpleHistory->register_dropin('AddSettingsPageTab');
|
15 |
});
|
16 |
|
25 |
private $sh;
|
26 |
|
27 |
// simple history will pass itself to the constructor
|
28 |
+
public function __construct($sh)
|
29 |
{
|
30 |
|
31 |
$this->sh = $sh;
|
33 |
$this->init();
|
34 |
}
|
35 |
|
36 |
+
public function init()
|
37 |
{
|
38 |
|
39 |
+
add_action('init', array( $this, 'addSettingsTab' ));
|
40 |
}
|
41 |
|
42 |
+
public function addSettingsTab()
|
43 |
{
|
44 |
|
45 |
$this->sh->registerSettingsTab(array(
|
46 |
'slug' => 'my_unique_settings_tab_slug',
|
47 |
'name' => __('Example tab', 'simple-history'),
|
48 |
+
'function' => array( $this, 'settingsTabOutput' ),
|
49 |
));
|
50 |
}
|
51 |
|
52 |
+
public function settingsTabOutput()
|
53 |
{
|
54 |
|
55 |
?>
|
60 |
|
61 |
<?php
|
62 |
}
|
63 |
+
}
|
|
|
|
examples/example-logger.php
CHANGED
@@ -3,7 +3,6 @@
|
|
3 |
// No external calls allowed to test file
|
4 |
exit;
|
5 |
|
6 |
-
|
7 |
/**
|
8 |
* This example shows how to create a simple logger that will
|
9 |
* log 404-errors on your website.
|
@@ -12,7 +11,6 @@ exit;
|
|
12 |
// We use the function "register_logger" to tell tell SimpleHistory that our custom logger exists.
|
13 |
// We call it from inside the filter "simple_history/add_custom_logger".
|
14 |
add_action('simple_history/add_custom_logger', function ($simpleHistory) {
|
15 |
-
|
16 |
$simpleHistory->register_logger('FourOhFourLogger');
|
17 |
});
|
18 |
|
@@ -66,11 +64,11 @@ if (class_exists('SimpleLogger')) {
|
|
66 |
* calls a loaded() function. This is where you add your actions
|
67 |
* and other logger functionality.
|
68 |
*/
|
69 |
-
function loaded()
|
70 |
{
|
71 |
|
72 |
// Call a function when WordPress finds a 404 page
|
73 |
-
add_action('404_template', array( $this, '
|
74 |
}
|
75 |
|
76 |
/**
|
@@ -78,7 +76,7 @@ if (class_exists('SimpleLogger')) {
|
|
78 |
* It collects some info and then it logs a warning message
|
79 |
* to the log.
|
80 |
*/
|
81 |
-
function
|
82 |
{
|
83 |
|
84 |
$context = array(
|
3 |
// No external calls allowed to test file
|
4 |
exit;
|
5 |
|
|
|
6 |
/**
|
7 |
* This example shows how to create a simple logger that will
|
8 |
* log 404-errors on your website.
|
11 |
// We use the function "register_logger" to tell tell SimpleHistory that our custom logger exists.
|
12 |
// We call it from inside the filter "simple_history/add_custom_logger".
|
13 |
add_action('simple_history/add_custom_logger', function ($simpleHistory) {
|
|
|
14 |
$simpleHistory->register_logger('FourOhFourLogger');
|
15 |
});
|
16 |
|
64 |
* calls a loaded() function. This is where you add your actions
|
65 |
* and other logger functionality.
|
66 |
*/
|
67 |
+
public function loaded()
|
68 |
{
|
69 |
|
70 |
// Call a function when WordPress finds a 404 page
|
71 |
+
add_action('404_template', array( $this, 'on404Template' ), 10, 1);
|
72 |
}
|
73 |
|
74 |
/**
|
76 |
* It collects some info and then it logs a warning message
|
77 |
* to the log.
|
78 |
*/
|
79 |
+
public function on404Template($template)
|
80 |
{
|
81 |
|
82 |
$context = array(
|
inc/SimpleHistory.php
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
3 |
defined('ABSPATH') or die();
|
4 |
|
5 |
/**
|
@@ -363,7 +365,7 @@ class SimpleHistory
|
|
363 |
|
364 |
restore_current_blog();
|
365 |
} // End foreach().
|
366 |
-
}
|
367 |
|
368 |
/**
|
369 |
* Adds a "View history" item/shortcut to the admin bar
|
@@ -420,7 +422,7 @@ class SimpleHistory
|
|
420 |
];
|
421 |
|
422 |
$wp_admin_bar->add_node($args);
|
423 |
-
}
|
424 |
|
425 |
/**
|
426 |
* Get singleton intance
|
@@ -572,9 +574,7 @@ class SimpleHistory
|
|
572 |
<div class="SimpleHistory-modal__background"></div>
|
573 |
<div class="SimpleHistory-modal__content">
|
574 |
<div class="SimpleHistory-modal__contentInner">
|
575 |
-
<img class="SimpleHistory-modal__contentSpinner" src="<?php echo esc_url(
|
576 |
-
admin_url('/images/spinner.gif')
|
577 |
-
); ?>" alt="">
|
578 |
</div>
|
579 |
<div class="SimpleHistory-modal__contentClose">
|
580 |
<button class="button">✕</button>
|
@@ -599,7 +599,8 @@ class SimpleHistory
|
|
599 |
</li>
|
600 |
</script>
|
601 |
|
602 |
-
<?php
|
|
|
603 |
foreach ($this->instantiatedLoggers as $one_logger) {
|
604 |
if (method_exists($one_logger['instance'], 'adminJS')) {
|
605 |
$one_logger['instance']->adminJS();
|
@@ -893,6 +894,10 @@ class SimpleHistory
|
|
893 |
// SimpleLogger.php must be loaded first and always since the other loggers extend it.
|
894 |
// Include it manually so no risk of anyone using filters or similar disables it.
|
895 |
include_once $loggersDir . 'SimpleLogger.php';
|
|
|
|
|
|
|
|
|
896 |
|
897 |
/**
|
898 |
* Filter the array with absolute paths to logger files to be loaded.
|
@@ -1598,7 +1603,7 @@ class SimpleHistory
|
|
1598 |
|
1599 |
update_option('simple_history_db_version', $db_version);
|
1600 |
}
|
1601 |
-
}
|
1602 |
|
1603 |
/**
|
1604 |
* Check if the database has data/rows
|
@@ -2238,7 +2243,7 @@ Because Simple History was only recently installed, this feed does not display m
|
|
2238 |
* Uses the getLogRowPlainTextOutput of the logger that logged the row
|
2239 |
* with fallback to SimpleLogger if logger is not available.
|
2240 |
*
|
2241 |
-
* @param
|
2242 |
* @return string
|
2243 |
*/
|
2244 |
public function getLogRowPlainTextOutput($row)
|
@@ -2353,7 +2358,7 @@ Because Simple History was only recently installed, this feed does not display m
|
|
2353 |
/**
|
2354 |
* Returns the HTML output for a log row, to be used in the GUI/Activity Feed
|
2355 |
*
|
2356 |
-
* @param
|
2357 |
* @return string
|
2358 |
*/
|
2359 |
public function getLogRowHTMLOutput($oneLogRow, $args)
|
@@ -3118,7 +3123,7 @@ Because Simple History was only recently installed, this feed does not display m
|
|
3118 |
</p>
|
3119 |
</div>
|
3120 |
<?php
|
3121 |
-
}
|
3122 |
|
3123 |
/**
|
3124 |
* https://www.tollmanz.com/invalidation-schemes/
|
@@ -3170,7 +3175,7 @@ Because Simple History was only recently installed, this feed does not display m
|
|
3170 |
}
|
3171 |
|
3172 |
return $count;
|
3173 |
-
}
|
3174 |
|
3175 |
public function get_num_events_per_day_last_n_days($period_days = 28)
|
3176 |
{
|
@@ -3210,7 +3215,7 @@ Because Simple History was only recently installed, this feed does not display m
|
|
3210 |
}
|
3211 |
|
3212 |
return $dates;
|
3213 |
-
}
|
3214 |
|
3215 |
// Number of unique events the last n days
|
3216 |
public function get_unique_events_for_days($days = 7)
|
@@ -3241,7 +3246,7 @@ Because Simple History was only recently installed, this feed does not display m
|
|
3241 |
}
|
3242 |
|
3243 |
return $numEvents;
|
3244 |
-
}
|
3245 |
|
3246 |
/**
|
3247 |
* Output an admin notice about logger slug being to long
|
1 |
<?php
|
2 |
|
3 |
+
// phpcs:disable PSR12.Properties.ConstantVisibility.NotFound
|
4 |
+
|
5 |
defined('ABSPATH') or die();
|
6 |
|
7 |
/**
|
365 |
|
366 |
restore_current_blog();
|
367 |
} // End foreach().
|
368 |
+
}
|
369 |
|
370 |
/**
|
371 |
* Adds a "View history" item/shortcut to the admin bar
|
422 |
];
|
423 |
|
424 |
$wp_admin_bar->add_node($args);
|
425 |
+
}
|
426 |
|
427 |
/**
|
428 |
* Get singleton intance
|
574 |
<div class="SimpleHistory-modal__background"></div>
|
575 |
<div class="SimpleHistory-modal__content">
|
576 |
<div class="SimpleHistory-modal__contentInner">
|
577 |
+
<img class="SimpleHistory-modal__contentSpinner" src="<?php echo esc_url(admin_url('/images/spinner.gif')); ?>" alt="">
|
|
|
|
|
578 |
</div>
|
579 |
<div class="SimpleHistory-modal__contentClose">
|
580 |
<button class="button">✕</button>
|
599 |
</li>
|
600 |
</script>
|
601 |
|
602 |
+
<?php
|
603 |
+
// Call plugins so they can add their js.
|
604 |
foreach ($this->instantiatedLoggers as $one_logger) {
|
605 |
if (method_exists($one_logger['instance'], 'adminJS')) {
|
606 |
$one_logger['instance']->adminJS();
|
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.
|
1603 |
|
1604 |
update_option('simple_history_db_version', $db_version);
|
1605 |
}
|
1606 |
+
}
|
1607 |
|
1608 |
/**
|
1609 |
* Check if the database has data/rows
|
2243 |
* Uses the getLogRowPlainTextOutput of the logger that logged the row
|
2244 |
* with fallback to SimpleLogger if logger is not available.
|
2245 |
*
|
2246 |
+
* @param context $row
|
2247 |
* @return string
|
2248 |
*/
|
2249 |
public function getLogRowPlainTextOutput($row)
|
2358 |
/**
|
2359 |
* Returns the HTML output for a log row, to be used in the GUI/Activity Feed
|
2360 |
*
|
2361 |
+
* @param object $oneLogRow SimpleHistoryLogQuery array with data from SimpleHistoryLogQuery
|
2362 |
* @return string
|
2363 |
*/
|
2364 |
public function getLogRowHTMLOutput($oneLogRow, $args)
|
3123 |
</p>
|
3124 |
</div>
|
3125 |
<?php
|
3126 |
+
}
|
3127 |
|
3128 |
/**
|
3129 |
* https://www.tollmanz.com/invalidation-schemes/
|
3175 |
}
|
3176 |
|
3177 |
return $count;
|
3178 |
+
}
|
3179 |
|
3180 |
public function get_num_events_per_day_last_n_days($period_days = 28)
|
3181 |
{
|
3215 |
}
|
3216 |
|
3217 |
return $dates;
|
3218 |
+
}
|
3219 |
|
3220 |
// Number of unique events the last n days
|
3221 |
public function get_unique_events_for_days($days = 7)
|
3246 |
}
|
3247 |
|
3248 |
return $numEvents;
|
3249 |
+
}
|
3250 |
|
3251 |
/**
|
3252 |
* Output an admin notice about logger slug being to long
|
inc/helpers.php
CHANGED
@@ -167,6 +167,45 @@ function sh_error_log()
|
|
167 |
}
|
168 |
}
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
/**
|
171 |
* Return a name for a callable.
|
172 |
*
|
167 |
}
|
168 |
}
|
169 |
|
170 |
+
/**
|
171 |
+
* Echoes any number of variables for debug purposes.
|
172 |
+
*
|
173 |
+
* Example usage:
|
174 |
+
*
|
175 |
+
* sh_d('Values fromm $_GET', $_GET);
|
176 |
+
* sh_d('$_POST', $_POST);
|
177 |
+
* sh_d('My vars', $varOne, $varTwo, $varXYZ);
|
178 |
+
*
|
179 |
+
* @mixed Vars Variables to output.
|
180 |
+
*/
|
181 |
+
function sh_d()
|
182 |
+
{
|
183 |
+
$output = '';
|
184 |
+
|
185 |
+
foreach (func_get_args() as $var) {
|
186 |
+
$loopOutput = '';
|
187 |
+
if (is_bool($var)) {
|
188 |
+
$bool_string = true === $var ? 'true' : 'false';
|
189 |
+
$loopOutput = "$bool_string (boolean value)";
|
190 |
+
} elseif (is_null($var)) {
|
191 |
+
$loopOutput = ('null (null value)');
|
192 |
+
} else {
|
193 |
+
$loopOutput = print_r($var, true);
|
194 |
+
}
|
195 |
+
|
196 |
+
if ($loopOutput) {
|
197 |
+
$output = $output . sprintf(
|
198 |
+
'
|
199 |
+
<pre>%1$s</pre>
|
200 |
+
',
|
201 |
+
esc_html($loopOutput)
|
202 |
+
);
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
echo $output;
|
207 |
+
}
|
208 |
+
|
209 |
/**
|
210 |
* Return a name for a callable.
|
211 |
*
|
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.37.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.37.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/AvailableUpdatesLogger.php
CHANGED
@@ -26,7 +26,7 @@ if (! class_exists('AvailableUpdatesLogger')) {
|
|
26 |
*
|
27 |
* @return array
|
28 |
*/
|
29 |
-
function getInfo()
|
30 |
{
|
31 |
|
32 |
$arr_info = array(
|
@@ -63,7 +63,7 @@ if (! class_exists('AvailableUpdatesLogger')) {
|
|
63 |
/**
|
64 |
* Called when logger is loaded.
|
65 |
*/
|
66 |
-
function loaded()
|
67 |
{
|
68 |
|
69 |
// When WP is done checking for core updates it sets a site transient called "update_core"
|
@@ -77,7 +77,7 @@ if (! class_exists('AvailableUpdatesLogger')) {
|
|
77 |
add_action('set_site_transient_update_themes', array( $this, 'on_setted_update_update_themes' ), 10, 1);
|
78 |
}
|
79 |
|
80 |
-
function on_setted_update_core_transient($updates)
|
81 |
{
|
82 |
|
83 |
global $wp_version;
|
@@ -117,7 +117,7 @@ if (! class_exists('AvailableUpdatesLogger')) {
|
|
117 |
* WP sets site transient 'update_plugins' when done.
|
118 |
* Log found plugin updates.
|
119 |
*/
|
120 |
-
function on_setted_update_plugins_transient($updates)
|
121 |
{
|
122 |
|
123 |
if (empty($updates->response) || ! is_array($updates->response)) {
|
@@ -194,9 +194,9 @@ if (! class_exists('AvailableUpdatesLogger')) {
|
|
194 |
} // End foreach().
|
195 |
|
196 |
update_option($option_key, $checked_updates);
|
197 |
-
}
|
198 |
|
199 |
-
function on_setted_update_update_themes($updates)
|
200 |
{
|
201 |
|
202 |
if (empty($updates->response) || ! is_array($updates->response)) {
|
@@ -247,12 +247,12 @@ if (! class_exists('AvailableUpdatesLogger')) {
|
|
247 |
} // End foreach().
|
248 |
|
249 |
update_option($option_key, $checked_updates);
|
250 |
-
}
|
251 |
|
252 |
/**
|
253 |
* Append prev and current version of update object as details in the output
|
254 |
*/
|
255 |
-
function getLogRowDetailsOutput($row)
|
256 |
{
|
257 |
|
258 |
$output = '';
|
@@ -304,6 +304,5 @@ if (! class_exists('AvailableUpdatesLogger')) {
|
|
304 |
|
305 |
return $output;
|
306 |
}
|
307 |
-
}
|
308 |
-
|
309 |
-
} // End if().
|
26 |
*
|
27 |
* @return array
|
28 |
*/
|
29 |
+
public function getInfo()
|
30 |
{
|
31 |
|
32 |
$arr_info = array(
|
63 |
/**
|
64 |
* Called when logger is loaded.
|
65 |
*/
|
66 |
+
public function loaded()
|
67 |
{
|
68 |
|
69 |
// When WP is done checking for core updates it sets a site transient called "update_core"
|
77 |
add_action('set_site_transient_update_themes', array( $this, 'on_setted_update_update_themes' ), 10, 1);
|
78 |
}
|
79 |
|
80 |
+
public function on_setted_update_core_transient($updates)
|
81 |
{
|
82 |
|
83 |
global $wp_version;
|
117 |
* WP sets site transient 'update_plugins' when done.
|
118 |
* Log found plugin updates.
|
119 |
*/
|
120 |
+
public function on_setted_update_plugins_transient($updates)
|
121 |
{
|
122 |
|
123 |
if (empty($updates->response) || ! is_array($updates->response)) {
|
194 |
} // End foreach().
|
195 |
|
196 |
update_option($option_key, $checked_updates);
|
197 |
+
}
|
198 |
|
199 |
+
public function on_setted_update_update_themes($updates)
|
200 |
{
|
201 |
|
202 |
if (empty($updates->response) || ! is_array($updates->response)) {
|
247 |
} // End foreach().
|
248 |
|
249 |
update_option($option_key, $checked_updates);
|
250 |
+
}
|
251 |
|
252 |
/**
|
253 |
* Append prev and current version of update object as details in the output
|
254 |
*/
|
255 |
+
public function getLogRowDetailsOutput($row)
|
256 |
{
|
257 |
|
258 |
$output = '';
|
304 |
|
305 |
return $output;
|
306 |
}
|
307 |
+
}
|
308 |
+
}
|
|
loggers/FileEditsLogger.php
CHANGED
@@ -8,7 +8,7 @@ class FileEditsLogger extends SimpleLogger
|
|
8 |
|
9 |
public $slug = __CLASS__;
|
10 |
|
11 |
-
function getInfo()
|
12 |
{
|
13 |
|
14 |
$arr_info = array(
|
@@ -38,7 +38,7 @@ class FileEditsLogger extends SimpleLogger
|
|
38 |
return $arr_info;
|
39 |
}
|
40 |
|
41 |
-
function loaded()
|
42 |
{
|
43 |
add_action('load-theme-editor.php', array( $this, 'on_load_theme_editor' ), 10, 1);
|
44 |
add_action('load-plugin-editor.php', array( $this, 'on_load_plugin_editor' ), 10, 1);
|
@@ -251,4 +251,4 @@ class FileEditsLogger extends SimpleLogger
|
|
251 |
|
252 |
return $out;
|
253 |
}
|
254 |
-
}
|
8 |
|
9 |
public $slug = __CLASS__;
|
10 |
|
11 |
+
public function getInfo()
|
12 |
{
|
13 |
|
14 |
$arr_info = array(
|
38 |
return $arr_info;
|
39 |
}
|
40 |
|
41 |
+
public function loaded()
|
42 |
{
|
43 |
add_action('load-theme-editor.php', array( $this, 'on_load_theme_editor' ), 10, 1);
|
44 |
add_action('load-plugin-editor.php', array( $this, 'on_load_plugin_editor' ), 10, 1);
|
251 |
|
252 |
return $out;
|
253 |
}
|
254 |
+
}
|
loggers/PluginEnableMediaReplaceLogger.php
CHANGED
@@ -18,7 +18,7 @@ class PluginEnableMediaReplaceLogger extends SimpleLogger
|
|
18 |
*
|
19 |
* @return array
|
20 |
*/
|
21 |
-
function getInfo()
|
22 |
{
|
23 |
|
24 |
$arr_info = array(
|
@@ -34,14 +34,14 @@ class PluginEnableMediaReplaceLogger extends SimpleLogger
|
|
34 |
return $arr_info;
|
35 |
}
|
36 |
|
37 |
-
function loaded()
|
38 |
{
|
39 |
|
40 |
// Action that is called when Enable Media Replace loads it's admin options page (both when viewing and when posting new file to it)
|
41 |
add_action('load-media_page_enable-media-replace/enable-media-replace', array( $this, 'on_load_plugin_admin_page' ), 10, 1);
|
42 |
}
|
43 |
|
44 |
-
function on_load_plugin_admin_page()
|
45 |
{
|
46 |
|
47 |
if (empty($_POST)) {
|
18 |
*
|
19 |
* @return array
|
20 |
*/
|
21 |
+
public function getInfo()
|
22 |
{
|
23 |
|
24 |
$arr_info = array(
|
34 |
return $arr_info;
|
35 |
}
|
36 |
|
37 |
+
public function loaded()
|
38 |
{
|
39 |
|
40 |
// Action that is called when Enable Media Replace loads it's admin options page (both when viewing and when posting new file to it)
|
41 |
add_action('load-media_page_enable-media-replace/enable-media-replace', array( $this, 'on_load_plugin_admin_page' ), 10, 1);
|
42 |
}
|
43 |
|
44 |
+
public function on_load_plugin_admin_page()
|
45 |
{
|
46 |
|
47 |
if (empty($_POST)) {
|
loggers/PluginUserSwitchingLogger.php
CHANGED
@@ -18,7 +18,7 @@ class PluginUserSwitchingLogger extends SimpleLogger
|
|
18 |
*
|
19 |
* @return array
|
20 |
*/
|
21 |
-
function getInfo()
|
22 |
{
|
23 |
|
24 |
$arr_info = array(
|
@@ -38,7 +38,7 @@ class PluginUserSwitchingLogger extends SimpleLogger
|
|
38 |
return $arr_info;
|
39 |
}
|
40 |
|
41 |
-
function loaded()
|
42 |
{
|
43 |
|
44 |
add_action('switch_to_user', array( $this, 'on_switch_to_user' ), 10, 2);
|
@@ -46,7 +46,7 @@ class PluginUserSwitchingLogger extends SimpleLogger
|
|
46 |
add_action('switch_off_user', array( $this, 'on_switch_off_user' ), 10, 1);
|
47 |
}
|
48 |
|
49 |
-
function on_switch_to_user($user_id, $old_user_id)
|
50 |
{
|
51 |
|
52 |
$user_to = get_user_by('id', $user_id);
|
@@ -80,7 +80,7 @@ class PluginUserSwitchingLogger extends SimpleLogger
|
|
80 |
* @param int|false $old_user_id The ID of the user being switched from, or false if the user is switching back
|
81 |
* after having been switched off.
|
82 |
*/
|
83 |
-
function on_switch_back_user($user_id, $old_user_id)
|
84 |
{
|
85 |
|
86 |
$user_to = get_user_by('id', $user_id);
|
@@ -117,7 +117,7 @@ class PluginUserSwitchingLogger extends SimpleLogger
|
|
117 |
}
|
118 |
}
|
119 |
|
120 |
-
function on_switch_off_user($user_id)
|
121 |
{
|
122 |
|
123 |
$user = get_user_by('id', $user_id);
|
18 |
*
|
19 |
* @return array
|
20 |
*/
|
21 |
+
public function getInfo()
|
22 |
{
|
23 |
|
24 |
$arr_info = array(
|
38 |
return $arr_info;
|
39 |
}
|
40 |
|
41 |
+
public function loaded()
|
42 |
{
|
43 |
|
44 |
add_action('switch_to_user', array( $this, 'on_switch_to_user' ), 10, 2);
|
46 |
add_action('switch_off_user', array( $this, 'on_switch_off_user' ), 10, 1);
|
47 |
}
|
48 |
|
49 |
+
public function on_switch_to_user($user_id, $old_user_id)
|
50 |
{
|
51 |
|
52 |
$user_to = get_user_by('id', $user_id);
|
80 |
* @param int|false $old_user_id The ID of the user being switched from, or false if the user is switching back
|
81 |
* after having been switched off.
|
82 |
*/
|
83 |
+
public function on_switch_back_user($user_id, $old_user_id)
|
84 |
{
|
85 |
|
86 |
$user_to = get_user_by('id', $user_id);
|
117 |
}
|
118 |
}
|
119 |
|
120 |
+
public function on_switch_off_user($user_id)
|
121 |
{
|
122 |
|
123 |
$user = get_user_by('id', $user_id);
|
loggers/Plugin_ACF.php
CHANGED
@@ -309,7 +309,7 @@ if (! class_exists('Plugin_ACF')) {
|
|
309 |
* @param array $fieldnames_to_field_keys Fieldnames to field keys mapping.
|
310 |
* @return array Modified context.
|
311 |
*/
|
312 |
-
public function add_acf_context($context = array(), $modify_type = '', $relevant_acf_fields = array(), $prev_post_meta, $new_post_meta, $fieldnames_to_field_keys)
|
313 |
{
|
314 |
|
315 |
if (! is_array($context) || empty($modify_type) || empty($relevant_acf_fields)) {
|
@@ -1074,5 +1074,5 @@ if (! class_exists('Plugin_ACF')) {
|
|
1074 |
|
1075 |
return $skip_posttypes;
|
1076 |
}
|
1077 |
-
}
|
1078 |
} // End if().
|
309 |
* @param array $fieldnames_to_field_keys Fieldnames to field keys mapping.
|
310 |
* @return array Modified context.
|
311 |
*/
|
312 |
+
public function add_acf_context($context = array(), $modify_type = '', $relevant_acf_fields = array(), $prev_post_meta = [], $new_post_meta = [], $fieldnames_to_field_keys = [])
|
313 |
{
|
314 |
|
315 |
if (! is_array($context) || empty($modify_type) || empty($relevant_acf_fields)) {
|
1074 |
|
1075 |
return $skip_posttypes;
|
1076 |
}
|
1077 |
+
}
|
1078 |
} // End if().
|
loggers/Plugin_BeaverBuilder.php
CHANGED
@@ -6,11 +6,12 @@ defined('ABSPATH') or die();
|
|
6 |
* Logger for Beaver Builder
|
7 |
*/
|
8 |
if (!class_exists('Plugin_BeaverBuilder')) {
|
|
|
9 |
class Plugin_BeaverBuilder extends SimpleLogger
|
10 |
{
|
11 |
public $slug = __CLASS__;
|
12 |
|
13 |
-
function getInfo()
|
14 |
{
|
15 |
$arr_info = array(
|
16 |
'name' => 'Plugin Beaver Builder',
|
@@ -48,7 +49,7 @@ if (!class_exists('Plugin_BeaverBuilder')) {
|
|
48 |
return $arr_info;
|
49 |
}
|
50 |
|
51 |
-
function loaded()
|
52 |
{
|
53 |
if (!class_exists('FLBuilder')) {
|
54 |
return;
|
@@ -56,29 +57,29 @@ if (!class_exists('Plugin_BeaverBuilder')) {
|
|
56 |
|
57 |
add_action(
|
58 |
'fl_builder_after_save_layout',
|
59 |
-
array($this, '
|
60 |
10,
|
61 |
4
|
62 |
);
|
63 |
add_action(
|
64 |
'fl_builder_after_save_user_template',
|
65 |
-
array($this, '
|
66 |
10,
|
67 |
1
|
68 |
);
|
69 |
add_action(
|
70 |
'fl_builder_after_save_draft',
|
71 |
-
array($this, '
|
72 |
10,
|
73 |
2
|
74 |
);
|
75 |
add_action('fl_builder_admin_settings_save', array(
|
76 |
$this,
|
77 |
-
'
|
78 |
));
|
79 |
}
|
80 |
-
|
81 |
-
function
|
82 |
{
|
83 |
$post = get_post($post_id);
|
84 |
$context = array(
|
@@ -86,8 +87,8 @@ if (!class_exists('Plugin_BeaverBuilder')) {
|
|
86 |
);
|
87 |
$this->noticeMessage('template_saved', $context);
|
88 |
}
|
89 |
-
|
90 |
-
function
|
91 |
{
|
92 |
$context = array(
|
93 |
'layout_name' => $post_id
|
@@ -95,7 +96,7 @@ if (!class_exists('Plugin_BeaverBuilder')) {
|
|
95 |
$this->noticeMessage('draft_saved', $context);
|
96 |
}
|
97 |
|
98 |
-
function
|
99 |
{
|
100 |
$post = get_post($post_id);
|
101 |
$context = array(
|
@@ -106,9 +107,9 @@ if (!class_exists('Plugin_BeaverBuilder')) {
|
|
106 |
}
|
107 |
}
|
108 |
|
109 |
-
function
|
110 |
{
|
111 |
$this->noticeMessage('admin_saved');
|
112 |
}
|
113 |
-
}
|
114 |
} // End if().
|
6 |
* Logger for Beaver Builder
|
7 |
*/
|
8 |
if (!class_exists('Plugin_BeaverBuilder')) {
|
9 |
+
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
|
10 |
class Plugin_BeaverBuilder extends SimpleLogger
|
11 |
{
|
12 |
public $slug = __CLASS__;
|
13 |
|
14 |
+
public function getInfo()
|
15 |
{
|
16 |
$arr_info = array(
|
17 |
'name' => 'Plugin Beaver Builder',
|
49 |
return $arr_info;
|
50 |
}
|
51 |
|
52 |
+
public function loaded()
|
53 |
{
|
54 |
if (!class_exists('FLBuilder')) {
|
55 |
return;
|
57 |
|
58 |
add_action(
|
59 |
'fl_builder_after_save_layout',
|
60 |
+
array($this, 'saveLayout'),
|
61 |
10,
|
62 |
4
|
63 |
);
|
64 |
add_action(
|
65 |
'fl_builder_after_save_user_template',
|
66 |
+
array($this, 'saveTemplate'),
|
67 |
10,
|
68 |
1
|
69 |
);
|
70 |
add_action(
|
71 |
'fl_builder_after_save_draft',
|
72 |
+
array($this, 'saveDraft'),
|
73 |
10,
|
74 |
2
|
75 |
);
|
76 |
add_action('fl_builder_admin_settings_save', array(
|
77 |
$this,
|
78 |
+
'saveAdmin'
|
79 |
));
|
80 |
}
|
81 |
+
|
82 |
+
public function saveTemplate($post_id)
|
83 |
{
|
84 |
$post = get_post($post_id);
|
85 |
$context = array(
|
87 |
);
|
88 |
$this->noticeMessage('template_saved', $context);
|
89 |
}
|
90 |
+
|
91 |
+
public function saveDraft($post_id, $publish)
|
92 |
{
|
93 |
$context = array(
|
94 |
'layout_name' => $post_id
|
96 |
$this->noticeMessage('draft_saved', $context);
|
97 |
}
|
98 |
|
99 |
+
public function saveLayout($post_id, $publish, $data, $settings)
|
100 |
{
|
101 |
$post = get_post($post_id);
|
102 |
$context = array(
|
107 |
}
|
108 |
}
|
109 |
|
110 |
+
public function saveAdmin()
|
111 |
{
|
112 |
$this->noticeMessage('admin_saved');
|
113 |
}
|
114 |
+
}
|
115 |
} // End if().
|
loggers/Plugin_DuplicatePost.php
CHANGED
@@ -9,36 +9,41 @@ defined('ABSPATH') or die();
|
|
9 |
* @package SimpleHistory
|
10 |
* @since 2.13
|
11 |
*/
|
12 |
-
if (!
|
13 |
-
|
14 |
class Plugin_DuplicatePost extends SimpleLogger
|
15 |
{
|
16 |
-
|
17 |
public $slug = __CLASS__;
|
18 |
|
19 |
public function getInfo()
|
20 |
{
|
21 |
-
$arr_info =
|
22 |
'name' => 'Plugin Duplicate Posts',
|
23 |
-
'description' => _x(
|
|
|
|
|
|
|
|
|
24 |
'name_via' => _x('Using plugin Duplicate Posts', 'Logger: Plugin Duplicate Post', 'simple-history'),
|
25 |
'capability' => 'manage_options',
|
26 |
-
'messages' =>
|
27 |
-
'post_duplicated' => _x(
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
30 |
|
31 |
return $arr_info;
|
32 |
}
|
33 |
|
34 |
public function loaded()
|
35 |
{
|
36 |
-
require_once
|
37 |
|
38 |
-
$pluginFilePath = 'duplicate-post/duplicate-post.php';
|
39 |
$isPluginActive = is_plugin_active('duplicate-post/duplicate-post.php');
|
40 |
|
41 |
-
if (
|
42 |
return;
|
43 |
}
|
44 |
|
@@ -47,8 +52,8 @@ if (! class_exists('Plugin_DuplicatePost')) {
|
|
47 |
// is fired with args $new_post_id, $post, $status.
|
48 |
// We add actions with prio 20 so we probably run after
|
49 |
// the plugins own
|
50 |
-
add_action('dp_duplicate_post',
|
51 |
-
add_action('dp_duplicate_page',
|
52 |
}
|
53 |
|
54 |
/**
|
@@ -62,19 +67,16 @@ if (! class_exists('Plugin_DuplicatePost')) {
|
|
62 |
{
|
63 |
$new_post = get_post($newPostID);
|
64 |
|
65 |
-
$context =
|
66 |
'new_post_title' => $new_post->post_title,
|
67 |
'new_post_id' => $new_post->ID,
|
68 |
'duplicated_post_title' => $post->post_title,
|
69 |
'duplicated_post_id' => $post->ID,
|
70 |
// "duplicate_new_post_id" => $newPostID,
|
71 |
// "status" => $status
|
72 |
-
|
73 |
|
74 |
-
$this->infoMessage(
|
75 |
-
'post_duplicated',
|
76 |
-
$context
|
77 |
-
);
|
78 |
}
|
79 |
|
80 |
/**
|
@@ -82,11 +84,12 @@ if (! class_exists('Plugin_DuplicatePost')) {
|
|
82 |
*/
|
83 |
public function getLogRowPlainTextOutput($row)
|
84 |
{
|
85 |
-
|
86 |
$context = $row->context;
|
87 |
$new_post_id = isset($context['new_post_id']) ? $context['new_post_id'] : null;
|
88 |
$duplicated_post_id = isset($context['duplicated_post_id']) ? $context['duplicated_post_id'] : null;
|
89 |
-
$duplicated_post_title = isset($context['duplicated_post_title'])
|
|
|
|
|
90 |
$message_key = isset($context['_message_key']) ? $context['_message_key'] : null;
|
91 |
|
92 |
$message = $row->message;
|
@@ -101,9 +104,11 @@ if (! class_exists('Plugin_DuplicatePost')) {
|
|
101 |
$post_type = isset($postDuplicated->post_type) ? $postDuplicated->post_type : '';
|
102 |
$post_type_obj = get_post_type_object($post_type);
|
103 |
|
104 |
-
if (!
|
105 |
-
if (!
|
106 |
-
$context['duplicated_post_post_type_singular_name'] = strtolower(
|
|
|
|
|
107 |
}
|
108 |
}
|
109 |
|
@@ -113,20 +118,36 @@ if (! class_exists('Plugin_DuplicatePost')) {
|
|
113 |
// If post is not available any longer then we can't link to it, so keep plain message then
|
114 |
// Also keep plain format if user is not allowed to edit post (edit link is empty)
|
115 |
if ($post_is_available && $context['duplicated_post_edit_link']) {
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
118 |
|
119 |
-
$context['new_post_edit_link'] = isset($context['new_post_edit_link'])
|
|
|
|
|
120 |
|
121 |
-
$context['duplicated_post_edit_link'] = isset($context['duplicated_post_edit_link'])
|
|
|
|
|
122 |
|
123 |
-
$context['duplicated_post_title'] = isset($context['duplicated_post_title'])
|
|
|
|
|
124 |
|
125 |
-
$context['duplicated_post_title'] = isset($context['duplicated_post_title'])
|
|
|
|
|
126 |
|
127 |
-
$context['duplicated_post_post_type_singular_name'] = isset(
|
|
|
|
|
|
|
|
|
128 |
|
129 |
return $this->interpolate($message, $context, $row);
|
130 |
}
|
131 |
-
}
|
132 |
} // End if().
|
9 |
* @package SimpleHistory
|
10 |
* @since 2.13
|
11 |
*/
|
12 |
+
if (!class_exists('Plugin_DuplicatePost')) {
|
|
|
13 |
class Plugin_DuplicatePost extends SimpleLogger
|
14 |
{
|
|
|
15 |
public $slug = __CLASS__;
|
16 |
|
17 |
public function getInfo()
|
18 |
{
|
19 |
+
$arr_info = [
|
20 |
'name' => 'Plugin Duplicate Posts',
|
21 |
+
'description' => _x(
|
22 |
+
'Logs posts and pages cloned using plugin Duplicate Post',
|
23 |
+
'Logger: Plugin Duplicate Post',
|
24 |
+
'simple-history'
|
25 |
+
),
|
26 |
'name_via' => _x('Using plugin Duplicate Posts', 'Logger: Plugin Duplicate Post', 'simple-history'),
|
27 |
'capability' => 'manage_options',
|
28 |
+
'messages' => [
|
29 |
+
'post_duplicated' => _x(
|
30 |
+
'Cloned "{duplicated_post_title}" to a new post',
|
31 |
+
'Logger: Plugin Duplicate Post',
|
32 |
+
'simple-history'
|
33 |
+
),
|
34 |
+
],
|
35 |
+
];
|
36 |
|
37 |
return $arr_info;
|
38 |
}
|
39 |
|
40 |
public function loaded()
|
41 |
{
|
42 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
43 |
|
|
|
44 |
$isPluginActive = is_plugin_active('duplicate-post/duplicate-post.php');
|
45 |
|
46 |
+
if (!$isPluginActive) {
|
47 |
return;
|
48 |
}
|
49 |
|
52 |
// is fired with args $new_post_id, $post, $status.
|
53 |
// We add actions with prio 20 so we probably run after
|
54 |
// the plugins own
|
55 |
+
add_action('dp_duplicate_post', [$this, 'onDpDuplicatePost'], 100, 3);
|
56 |
+
add_action('dp_duplicate_page', [$this, 'onDpDuplicatePost'], 100, 3);
|
57 |
}
|
58 |
|
59 |
/**
|
67 |
{
|
68 |
$new_post = get_post($newPostID);
|
69 |
|
70 |
+
$context = [
|
71 |
'new_post_title' => $new_post->post_title,
|
72 |
'new_post_id' => $new_post->ID,
|
73 |
'duplicated_post_title' => $post->post_title,
|
74 |
'duplicated_post_id' => $post->ID,
|
75 |
// "duplicate_new_post_id" => $newPostID,
|
76 |
// "status" => $status
|
77 |
+
];
|
78 |
|
79 |
+
$this->infoMessage('post_duplicated', $context);
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
/**
|
84 |
*/
|
85 |
public function getLogRowPlainTextOutput($row)
|
86 |
{
|
|
|
87 |
$context = $row->context;
|
88 |
$new_post_id = isset($context['new_post_id']) ? $context['new_post_id'] : null;
|
89 |
$duplicated_post_id = isset($context['duplicated_post_id']) ? $context['duplicated_post_id'] : null;
|
90 |
+
$duplicated_post_title = isset($context['duplicated_post_title'])
|
91 |
+
? $context['duplicated_post_title']
|
92 |
+
: null;
|
93 |
$message_key = isset($context['_message_key']) ? $context['_message_key'] : null;
|
94 |
|
95 |
$message = $row->message;
|
104 |
$post_type = isset($postDuplicated->post_type) ? $postDuplicated->post_type : '';
|
105 |
$post_type_obj = get_post_type_object($post_type);
|
106 |
|
107 |
+
if (!is_null($post_type_obj)) {
|
108 |
+
if (!empty($post_type_obj->labels->singular_name)) {
|
109 |
+
$context['duplicated_post_post_type_singular_name'] = strtolower(
|
110 |
+
$post_type_obj->labels->singular_name
|
111 |
+
);
|
112 |
}
|
113 |
}
|
114 |
|
118 |
// If post is not available any longer then we can't link to it, so keep plain message then
|
119 |
// Also keep plain format if user is not allowed to edit post (edit link is empty)
|
120 |
if ($post_is_available && $context['duplicated_post_edit_link']) {
|
121 |
+
$message = _x(
|
122 |
+
'Cloned {duplicated_post_post_type_singular_name} <a href="{duplicated_post_edit_link}">"{duplicated_post_title}"</a> to <a href="{new_post_edit_link}">a new {duplicated_post_post_type_singular_name}</a>',
|
123 |
+
'Logger: Plugin Duplicate Post',
|
124 |
+
'simple-history'
|
125 |
+
);
|
126 |
+
}
|
127 |
|
128 |
+
$context['new_post_edit_link'] = isset($context['new_post_edit_link'])
|
129 |
+
? esc_html($context['new_post_edit_link'])
|
130 |
+
: '';
|
131 |
|
132 |
+
$context['duplicated_post_edit_link'] = isset($context['duplicated_post_edit_link'])
|
133 |
+
? esc_html($context['duplicated_post_edit_link'])
|
134 |
+
: '';
|
135 |
|
136 |
+
$context['duplicated_post_title'] = isset($context['duplicated_post_title'])
|
137 |
+
? esc_html($context['duplicated_post_title'])
|
138 |
+
: '';
|
139 |
|
140 |
+
$context['duplicated_post_title'] = isset($context['duplicated_post_title'])
|
141 |
+
? esc_html($context['duplicated_post_title'])
|
142 |
+
: '';
|
143 |
|
144 |
+
$context['duplicated_post_post_type_singular_name'] = isset(
|
145 |
+
$context['duplicated_post_post_type_singular_name']
|
146 |
+
)
|
147 |
+
? esc_html($context['duplicated_post_post_type_singular_name'])
|
148 |
+
: '';
|
149 |
|
150 |
return $this->interpolate($message, $context, $row);
|
151 |
}
|
152 |
+
}
|
153 |
} // End if().
|
loggers/Plugin_LimitLoginAttempts.php
CHANGED
@@ -7,13 +7,12 @@ defined('ABSPATH') or die();
|
|
7 |
* https://sv.wordpress.org/plugins/limit-login-attempts/
|
8 |
*/
|
9 |
if (! class_exists('Plugin_LimitLoginAttempts')) {
|
10 |
-
|
11 |
class Plugin_LimitLoginAttempts extends SimpleLogger
|
12 |
{
|
13 |
|
14 |
public $slug = __CLASS__;
|
15 |
|
16 |
-
function getInfo()
|
17 |
{
|
18 |
|
19 |
$arr_info = array(
|
@@ -46,7 +45,7 @@ if (! class_exists('Plugin_LimitLoginAttempts')) {
|
|
46 |
return $arr_info;
|
47 |
}
|
48 |
|
49 |
-
function loaded()
|
50 |
{
|
51 |
|
52 |
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
@@ -69,7 +68,7 @@ if (! class_exists('Plugin_LimitLoginAttempts')) {
|
|
69 |
/**
|
70 |
* Fired when plugin options screen is loaded
|
71 |
*/
|
72 |
-
function on_load_settings_page($a)
|
73 |
{
|
74 |
|
75 |
if ($_POST && wp_verify_nonce($_POST['_wpnonce'], 'limit-login-attempts-options')) {
|
@@ -120,7 +119,7 @@ if (! class_exists('Plugin_LimitLoginAttempts')) {
|
|
120 |
* do same checks as plugin itself does
|
121 |
* and log if we match something
|
122 |
*/
|
123 |
-
function on_option_limit_login_lockouts_total($value)
|
124 |
{
|
125 |
|
126 |
global $limit_login_just_lockedout;
|
@@ -190,7 +189,7 @@ if (! class_exists('Plugin_LimitLoginAttempts')) {
|
|
190 |
/**
|
191 |
* Add some extra info
|
192 |
*/
|
193 |
-
function getLogRowDetailsOutput($row)
|
194 |
{
|
195 |
|
196 |
$output = '';
|
@@ -228,6 +227,5 @@ if (! class_exists('Plugin_LimitLoginAttempts')) {
|
|
228 |
|
229 |
return $output;
|
230 |
}
|
231 |
-
}
|
232 |
-
|
233 |
} // End if().
|
7 |
* https://sv.wordpress.org/plugins/limit-login-attempts/
|
8 |
*/
|
9 |
if (! class_exists('Plugin_LimitLoginAttempts')) {
|
|
|
10 |
class Plugin_LimitLoginAttempts extends SimpleLogger
|
11 |
{
|
12 |
|
13 |
public $slug = __CLASS__;
|
14 |
|
15 |
+
public function getInfo()
|
16 |
{
|
17 |
|
18 |
$arr_info = array(
|
45 |
return $arr_info;
|
46 |
}
|
47 |
|
48 |
+
public function loaded()
|
49 |
{
|
50 |
|
51 |
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
68 |
/**
|
69 |
* Fired when plugin options screen is loaded
|
70 |
*/
|
71 |
+
public function on_load_settings_page($a)
|
72 |
{
|
73 |
|
74 |
if ($_POST && wp_verify_nonce($_POST['_wpnonce'], 'limit-login-attempts-options')) {
|
119 |
* do same checks as plugin itself does
|
120 |
* and log if we match something
|
121 |
*/
|
122 |
+
public function on_option_limit_login_lockouts_total($value)
|
123 |
{
|
124 |
|
125 |
global $limit_login_just_lockedout;
|
189 |
/**
|
190 |
* Add some extra info
|
191 |
*/
|
192 |
+
public function getLogRowDetailsOutput($row)
|
193 |
{
|
194 |
|
195 |
$output = '';
|
227 |
|
228 |
return $output;
|
229 |
}
|
230 |
+
}
|
|
|
231 |
} // End if().
|
loggers/Plugin_Redirection.php
CHANGED
@@ -7,7 +7,6 @@ defined('ABSPATH') || die();
|
|
7 |
* https://wordpress.org/plugins/redirection/
|
8 |
*/
|
9 |
if (! class_exists('Plugin_Redirection')) {
|
10 |
-
|
11 |
/**
|
12 |
* Class to log things from the Redirection plugin.
|
13 |
*/
|
@@ -407,6 +406,5 @@ if (! class_exists('Plugin_Redirection')) {
|
|
407 |
|
408 |
return $out;
|
409 |
}
|
410 |
-
}
|
411 |
-
|
412 |
-
} // End if().
|
7 |
* https://wordpress.org/plugins/redirection/
|
8 |
*/
|
9 |
if (! class_exists('Plugin_Redirection')) {
|
|
|
10 |
/**
|
11 |
* Class to log things from the Redirection plugin.
|
12 |
*/
|
406 |
|
407 |
return $out;
|
408 |
}
|
409 |
+
}
|
410 |
+
}
|
|
loggers/Plugin_UltimateMembers_Logger.php
CHANGED
@@ -10,7 +10,6 @@ defined('ABSPATH') or die();
|
|
10 |
*/
|
11 |
class Plugin_UltimateMembers_Logger extends SimpleLogger
|
12 |
{
|
13 |
-
|
14 |
public $slug = __CLASS__;
|
15 |
|
16 |
/**
|
@@ -18,9 +17,8 @@ class Plugin_UltimateMembers_Logger extends SimpleLogger
|
|
18 |
*
|
19 |
* @return array
|
20 |
*/
|
21 |
-
function getInfo()
|
22 |
{
|
23 |
-
|
24 |
$arr_info = array(
|
25 |
'name' => _x('Ultimate Members Logger', 'PluginUltimateMembersLogger', 'simple-history'),
|
26 |
'description' => _x('Logs actions from the Ultimate Members plugin', 'PluginUltimateMembersLogger', 'simple-history'),
|
@@ -33,14 +31,14 @@ class Plugin_UltimateMembers_Logger extends SimpleLogger
|
|
33 |
return $arr_info;
|
34 |
}
|
35 |
|
36 |
-
function loaded()
|
37 |
{
|
38 |
|
39 |
// Action that is called when Enable Media Replace loads it's admin options page (both when viewing and when posting new file to it)
|
40 |
add_action('um_on_login_before_redirect', array( $this, 'on_um_on_login_before_redirect' ), 10, 1);
|
41 |
}
|
42 |
|
43 |
-
function on_um_on_login_before_redirect($user_id)
|
44 |
{
|
45 |
|
46 |
$this->infoMessage('logged_in', array(
|
10 |
*/
|
11 |
class Plugin_UltimateMembers_Logger extends SimpleLogger
|
12 |
{
|
|
|
13 |
public $slug = __CLASS__;
|
14 |
|
15 |
/**
|
17 |
*
|
18 |
* @return array
|
19 |
*/
|
20 |
+
public function getInfo()
|
21 |
{
|
|
|
22 |
$arr_info = array(
|
23 |
'name' => _x('Ultimate Members Logger', 'PluginUltimateMembersLogger', 'simple-history'),
|
24 |
'description' => _x('Logs actions from the Ultimate Members plugin', 'PluginUltimateMembersLogger', 'simple-history'),
|
31 |
return $arr_info;
|
32 |
}
|
33 |
|
34 |
+
public function loaded()
|
35 |
{
|
36 |
|
37 |
// Action that is called when Enable Media Replace loads it's admin options page (both when viewing and when posting new file to it)
|
38 |
add_action('um_on_login_before_redirect', array( $this, 'on_um_on_login_before_redirect' ), 10, 1);
|
39 |
}
|
40 |
|
41 |
+
public function on_um_on_login_before_redirect($user_id)
|
42 |
{
|
43 |
|
44 |
$this->infoMessage('logged_in', array(
|
loggers/SimpleCommentsLogger.php
CHANGED
@@ -7,13 +7,10 @@ defined('ABSPATH') or die();
|
|
7 |
*/
|
8 |
class SimpleCommentsLogger extends SimpleLogger
|
9 |
{
|
10 |
-
|
11 |
-
|
12 |
public $slug = __CLASS__;
|
13 |
|
14 |
-
function __construct($sh)
|
15 |
{
|
16 |
-
|
17 |
parent::__construct($sh);
|
18 |
|
19 |
// Add option to not show spam comments, because to much things getting logged
|
@@ -27,7 +24,7 @@ class SimpleCommentsLogger extends SimpleLogger
|
|
27 |
*
|
28 |
* @param string $where sql query where
|
29 |
*/
|
30 |
-
function maybe_modify_log_query_sql_where($where)
|
31 |
{
|
32 |
|
33 |
// since 19 sept 2016 we do include spam, to skip the subquery
|
@@ -87,7 +84,7 @@ class SimpleCommentsLogger extends SimpleLogger
|
|
87 |
*
|
88 |
* @return array
|
89 |
*/
|
90 |
-
function getInfo()
|
91 |
{
|
92 |
|
93 |
$arr_info = array(
|
@@ -568,7 +565,7 @@ class SimpleCommentsLogger extends SimpleLogger
|
|
568 |
/**
|
569 |
* Get output for detailed log section
|
570 |
*/
|
571 |
-
function getLogRowDetailsOutput($row)
|
572 |
{
|
573 |
|
574 |
$context = $row->context;
|
@@ -599,8 +596,7 @@ class SimpleCommentsLogger extends SimpleLogger
|
|
599 |
$comment_type = isset($context['comment_type']) ? $context['comment_type'] : '';
|
600 |
|
601 |
switch ($comment_type) {
|
602 |
-
case 'trackback'
|
603 |
-
|
604 |
$arr_plugin_keys = array(
|
605 |
'trackback_status' => _x('Status', 'comments logger - detailed output comment status', 'simple-history'),
|
606 |
// "trackback_type" => _x("Trackback type", "comments logger - detailed output comment type", "simple-history"),
|
@@ -610,11 +606,8 @@ class SimpleCommentsLogger extends SimpleLogger
|
|
610 |
);
|
611 |
|
612 |
break;
|
613 |
-
|
614 |
-
case 'pingback';
|
615 |
-
|
616 |
$arr_plugin_keys = array(
|
617 |
-
|
618 |
'pingback_status' => _x('Status', 'comments logger - detailed output comment status', 'simple-history'),
|
619 |
// "pingback_type" => _x("Pingback type", "comments logger - detailed output comment type", "simple-history"),
|
620 |
'pingback_author' => _x('Name', 'comments logger - detailed output author', 'simple-history'),
|
@@ -624,10 +617,8 @@ class SimpleCommentsLogger extends SimpleLogger
|
|
624 |
);
|
625 |
|
626 |
break;
|
627 |
-
|
628 |
-
|
629 |
-
default;
|
630 |
-
|
631 |
$arr_plugin_keys = array(
|
632 |
'comment_status' => _x('Status', 'comments logger - detailed output comment status', 'simple-history'),
|
633 |
// "comment_type" => _x("Comment type", "comments logger - detailed output comment type", "simple-history"),
|
@@ -708,8 +699,7 @@ class SimpleCommentsLogger extends SimpleLogger
|
|
708 |
|
709 |
break;
|
710 |
|
711 |
-
default
|
712 |
-
|
713 |
if (isset($context[ $key ])) {
|
714 |
$desc_output = esc_html($context[ $key ]);
|
715 |
}
|
@@ -768,7 +758,7 @@ class SimpleCommentsLogger extends SimpleLogger
|
|
768 |
return $output;
|
769 |
}
|
770 |
|
771 |
-
function adminCSS()
|
772 |
{
|
773 |
?>
|
774 |
<style>
|
7 |
*/
|
8 |
class SimpleCommentsLogger extends SimpleLogger
|
9 |
{
|
|
|
|
|
10 |
public $slug = __CLASS__;
|
11 |
|
12 |
+
public function __construct($sh)
|
13 |
{
|
|
|
14 |
parent::__construct($sh);
|
15 |
|
16 |
// Add option to not show spam comments, because to much things getting logged
|
24 |
*
|
25 |
* @param string $where sql query where
|
26 |
*/
|
27 |
+
public function maybe_modify_log_query_sql_where($where)
|
28 |
{
|
29 |
|
30 |
// since 19 sept 2016 we do include spam, to skip the subquery
|
84 |
*
|
85 |
* @return array
|
86 |
*/
|
87 |
+
public function getInfo()
|
88 |
{
|
89 |
|
90 |
$arr_info = array(
|
565 |
/**
|
566 |
* Get output for detailed log section
|
567 |
*/
|
568 |
+
public function getLogRowDetailsOutput($row)
|
569 |
{
|
570 |
|
571 |
$context = $row->context;
|
596 |
$comment_type = isset($context['comment_type']) ? $context['comment_type'] : '';
|
597 |
|
598 |
switch ($comment_type) {
|
599 |
+
case 'trackback':
|
|
|
600 |
$arr_plugin_keys = array(
|
601 |
'trackback_status' => _x('Status', 'comments logger - detailed output comment status', 'simple-history'),
|
602 |
// "trackback_type" => _x("Trackback type", "comments logger - detailed output comment type", "simple-history"),
|
606 |
);
|
607 |
|
608 |
break;
|
609 |
+
case 'pingback':
|
|
|
|
|
610 |
$arr_plugin_keys = array(
|
|
|
611 |
'pingback_status' => _x('Status', 'comments logger - detailed output comment status', 'simple-history'),
|
612 |
// "pingback_type" => _x("Pingback type", "comments logger - detailed output comment type", "simple-history"),
|
613 |
'pingback_author' => _x('Name', 'comments logger - detailed output author', 'simple-history'),
|
617 |
);
|
618 |
|
619 |
break;
|
620 |
+
case 'comment':
|
621 |
+
default:
|
|
|
|
|
622 |
$arr_plugin_keys = array(
|
623 |
'comment_status' => _x('Status', 'comments logger - detailed output comment status', 'simple-history'),
|
624 |
// "comment_type" => _x("Comment type", "comments logger - detailed output comment type", "simple-history"),
|
699 |
|
700 |
break;
|
701 |
|
702 |
+
default:
|
|
|
703 |
if (isset($context[ $key ])) {
|
704 |
$desc_output = esc_html($context[ $key ]);
|
705 |
}
|
758 |
return $output;
|
759 |
}
|
760 |
|
761 |
+
public function adminCSS()
|
762 |
{
|
763 |
?>
|
764 |
<style>
|
loggers/SimpleCoreUpdatesLogger.php
CHANGED
@@ -27,7 +27,7 @@ class SimpleCoreUpdatesLogger extends SimpleLogger
|
|
27 |
* @param int $wp_db_version The new $wp_db_version.
|
28 |
* @param int $wp_current_db_version The old (current) $wp_db_version.
|
29 |
*/
|
30 |
-
function on_wp_upgrade($wp_db_version, $wp_current_db_version)
|
31 |
{
|
32 |
|
33 |
$this->debugMessage(
|
@@ -43,7 +43,7 @@ class SimpleCoreUpdatesLogger extends SimpleLogger
|
|
43 |
* We need to store the WordPress version we are updating from.
|
44 |
* 'update_feedback' is a suitable filter.
|
45 |
*/
|
46 |
-
function on_update_feedback()
|
47 |
{
|
48 |
|
49 |
if (! empty($GLOBALS['wp_version']) && ! isset($GLOBALS[ 'simple_history_' . $this->slug . '_wp_version' ])) {
|
@@ -56,7 +56,7 @@ class SimpleCoreUpdatesLogger extends SimpleLogger
|
|
56 |
*
|
57 |
* @return array
|
58 |
*/
|
59 |
-
function getInfo()
|
60 |
{
|
61 |
|
62 |
$arr_info = array(
|
27 |
* @param int $wp_db_version The new $wp_db_version.
|
28 |
* @param int $wp_current_db_version The old (current) $wp_db_version.
|
29 |
*/
|
30 |
+
public function on_wp_upgrade($wp_db_version, $wp_current_db_version)
|
31 |
{
|
32 |
|
33 |
$this->debugMessage(
|
43 |
* We need to store the WordPress version we are updating from.
|
44 |
* 'update_feedback' is a suitable filter.
|
45 |
*/
|
46 |
+
public function on_update_feedback()
|
47 |
{
|
48 |
|
49 |
if (! empty($GLOBALS['wp_version']) && ! isset($GLOBALS[ 'simple_history_' . $this->slug . '_wp_version' ])) {
|
56 |
*
|
57 |
* @return array
|
58 |
*/
|
59 |
+
public function getInfo()
|
60 |
{
|
61 |
|
62 |
$arr_info = array(
|
loggers/SimpleExportLogger.php
CHANGED
@@ -7,8 +7,6 @@ defined('ABSPATH') or die();
|
|
7 |
*/
|
8 |
class SimpleExportLogger extends SimpleLogger
|
9 |
{
|
10 |
-
|
11 |
-
|
12 |
public $slug = __CLASS__;
|
13 |
|
14 |
/**
|
@@ -16,9 +14,8 @@ class SimpleExportLogger extends SimpleLogger
|
|
16 |
*
|
17 |
* @return array
|
18 |
*/
|
19 |
-
function getInfo()
|
20 |
{
|
21 |
-
|
22 |
$arr_info = array(
|
23 |
'name' => __('Export Logger', 'simple-history'),
|
24 |
'description' => __('Logs updates to WordPress export', 'simple-history'),
|
@@ -41,15 +38,14 @@ class SimpleExportLogger extends SimpleLogger
|
|
41 |
return $arr_info;
|
42 |
}
|
43 |
|
44 |
-
function loaded()
|
45 |
{
|
46 |
|
47 |
add_action('export_wp', array( $this, 'on_export_wp' ), 10, 1);
|
48 |
}
|
49 |
|
50 |
-
function on_export_wp($args)
|
51 |
{
|
52 |
-
|
53 |
$this->infoMessage(
|
54 |
'created_export',
|
55 |
array(
|
@@ -57,19 +53,4 @@ class SimpleExportLogger extends SimpleLogger
|
|
57 |
)
|
58 |
);
|
59 |
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Get detailed output
|
63 |
-
*/
|
64 |
-
/*
|
65 |
-
function getLogRowDetailsOutput($row) {
|
66 |
-
|
67 |
-
$context = $row->context;
|
68 |
-
$message_key = $context["_message_key"];
|
69 |
-
$output = "";
|
70 |
-
|
71 |
-
return $output;
|
72 |
-
|
73 |
-
}
|
74 |
-
*/
|
75 |
}
|
7 |
*/
|
8 |
class SimpleExportLogger extends SimpleLogger
|
9 |
{
|
|
|
|
|
10 |
public $slug = __CLASS__;
|
11 |
|
12 |
/**
|
14 |
*
|
15 |
* @return array
|
16 |
*/
|
17 |
+
public function getInfo()
|
18 |
{
|
|
|
19 |
$arr_info = array(
|
20 |
'name' => __('Export Logger', 'simple-history'),
|
21 |
'description' => __('Logs updates to WordPress export', 'simple-history'),
|
38 |
return $arr_info;
|
39 |
}
|
40 |
|
41 |
+
public function loaded()
|
42 |
{
|
43 |
|
44 |
add_action('export_wp', array( $this, 'on_export_wp' ), 10, 1);
|
45 |
}
|
46 |
|
47 |
+
public function on_export_wp($args)
|
48 |
{
|
|
|
49 |
$this->infoMessage(
|
50 |
'created_export',
|
51 |
array(
|
53 |
)
|
54 |
);
|
55 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
loggers/SimpleLegacyLogger.php
CHANGED
@@ -11,7 +11,6 @@ defined('ABSPATH') or die();
|
|
11 |
class SimpleLegacyLogger extends SimpleLogger
|
12 |
{
|
13 |
|
14 |
-
|
15 |
/**
|
16 |
* Unique slug for this logger
|
17 |
* Will be saved in DB and used to associate each log row with its logger
|
@@ -29,7 +28,7 @@ class SimpleLegacyLogger extends SimpleLogger
|
|
29 |
*
|
30 |
* @return array
|
31 |
*/
|
32 |
-
function getInfo()
|
33 |
{
|
34 |
|
35 |
$arr_info = array(
|
11 |
class SimpleLegacyLogger extends SimpleLogger
|
12 |
{
|
13 |
|
|
|
14 |
/**
|
15 |
* Unique slug for this logger
|
16 |
* Will be saved in DB and used to associate each log row with its logger
|
28 |
*
|
29 |
* @return array
|
30 |
*/
|
31 |
+
public function getInfo()
|
32 |
{
|
33 |
|
34 |
$arr_info = array(
|
loggers/SimpleLogger.php
CHANGED
@@ -1489,7 +1489,7 @@ class SimpleLogger
|
|
1489 |
|
1490 |
// Return $this so we can chain methods.
|
1491 |
return $this;
|
1492 |
-
}
|
1493 |
|
1494 |
/**
|
1495 |
* Append new info to the context of history item with id $post_logger->lastInsertID.
|
@@ -1520,7 +1520,7 @@ class SimpleLogger
|
|
1520 |
'value' => $value
|
1521 |
);
|
1522 |
|
1523 |
-
$
|
1524 |
}
|
1525 |
|
1526 |
return true;
|
@@ -1549,7 +1549,7 @@ class SimpleLogger
|
|
1549 |
* Returns additional headers with ip number from context
|
1550 |
*
|
1551 |
* @since 2.0.29
|
1552 |
-
* @param
|
1553 |
* @return array Headers
|
1554 |
*/
|
1555 |
public function get_event_ip_number_headers($row)
|
@@ -1637,58 +1637,3 @@ class SimpleLogger
|
|
1637 |
*/
|
1638 |
}
|
1639 |
}
|
1640 |
-
|
1641 |
-
/**
|
1642 |
-
* Describes log initiator, i.e. who caused to log event to happend
|
1643 |
-
*/
|
1644 |
-
class SimpleLoggerLogInitiators
|
1645 |
-
{
|
1646 |
-
// A wordpress user that at the log event created did exist in the wp database
|
1647 |
-
// May have been deleted when the log is viewed.
|
1648 |
-
const WP_USER = 'wp_user';
|
1649 |
-
|
1650 |
-
// Cron job run = wordpress initiated
|
1651 |
-
// Email sent to customer on webshop = system/wordpress/anonymous web user
|
1652 |
-
// Javascript error occured on website = anonymous web user.
|
1653 |
-
const WEB_USER = 'web_user';
|
1654 |
-
|
1655 |
-
// WordPress core or plugins updated automatically via wp-cron.
|
1656 |
-
const WORDPRESS = 'wp';
|
1657 |
-
|
1658 |
-
// WP CLI / terminal.
|
1659 |
-
const WP_CLI = 'wp_cli';
|
1660 |
-
|
1661 |
-
// I dunno.
|
1662 |
-
const OTHER = 'other';
|
1663 |
-
}
|
1664 |
-
|
1665 |
-
/**
|
1666 |
-
* Describes log event type
|
1667 |
-
* Based on the CRUD-types
|
1668 |
-
* http://en.wikipedia.org/wiki/Create,_read,_update_and_delete
|
1669 |
-
* More may be added later on if needed
|
1670 |
-
* Note: not in use at the moment
|
1671 |
-
*/
|
1672 |
-
class SimpleLoggerLogTypes
|
1673 |
-
{
|
1674 |
-
const CREATE = 'create';
|
1675 |
-
const READ = 'read';
|
1676 |
-
const UPDATE = 'update';
|
1677 |
-
const DELETE = 'delete';
|
1678 |
-
const OTHER = 'other';
|
1679 |
-
}
|
1680 |
-
|
1681 |
-
/**
|
1682 |
-
* Describes log levels
|
1683 |
-
*/
|
1684 |
-
class SimpleLoggerLogLevels
|
1685 |
-
{
|
1686 |
-
const EMERGENCY = 'emergency';
|
1687 |
-
const ALERT = 'alert';
|
1688 |
-
const CRITICAL = 'critical';
|
1689 |
-
const ERROR = 'error';
|
1690 |
-
const WARNING = 'warning';
|
1691 |
-
const NOTICE = 'notice';
|
1692 |
-
const INFO = 'info';
|
1693 |
-
const DEBUG = 'debug';
|
1694 |
-
}
|
1489 |
|
1490 |
// Return $this so we can chain methods.
|
1491 |
return $this;
|
1492 |
+
}
|
1493 |
|
1494 |
/**
|
1495 |
* Append new info to the context of history item with id $post_logger->lastInsertID.
|
1520 |
'value' => $value
|
1521 |
);
|
1522 |
|
1523 |
+
$wpdb->insert($db_table_contexts, $data);
|
1524 |
}
|
1525 |
|
1526 |
return true;
|
1549 |
* Returns additional headers with ip number from context
|
1550 |
*
|
1551 |
* @since 2.0.29
|
1552 |
+
* @param object $row Row with info.
|
1553 |
* @return array Headers
|
1554 |
*/
|
1555 |
public function get_event_ip_number_headers($row)
|
1637 |
*/
|
1638 |
}
|
1639 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loggers/SimpleLoggerLogInitiators.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// phpcs:disable PSR12.Properties.ConstantVisibility.NotFound
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Describes log initiator, i.e. who caused to log event to happend
|
7 |
+
*/
|
8 |
+
class SimpleLoggerLogInitiators
|
9 |
+
{
|
10 |
+
// A wordpress user that at the log event created did exist in the wp database
|
11 |
+
// May have been deleted when the log is viewed.
|
12 |
+
const WP_USER = 'wp_user';
|
13 |
+
|
14 |
+
// Cron job run = wordpress initiated
|
15 |
+
// Email sent to customer on webshop = system/wordpress/anonymous web user
|
16 |
+
// Javascript error occured on website = anonymous web user.
|
17 |
+
const WEB_USER = 'web_user';
|
18 |
+
|
19 |
+
// WordPress core or plugins updated automatically via wp-cron.
|
20 |
+
const WORDPRESS = 'wp';
|
21 |
+
|
22 |
+
// WP CLI / terminal.
|
23 |
+
const WP_CLI = 'wp_cli';
|
24 |
+
|
25 |
+
// I dunno.
|
26 |
+
const OTHER = 'other';
|
27 |
+
}
|
loggers/SimpleLoggerLogLevels.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// phpcs:disable PSR12.Properties.ConstantVisibility.NotFound
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Describes log levels
|
7 |
+
*/
|
8 |
+
class SimpleLoggerLogLevels
|
9 |
+
{
|
10 |
+
const EMERGENCY = 'emergency';
|
11 |
+
const ALERT = 'alert';
|
12 |
+
const CRITICAL = 'critical';
|
13 |
+
const ERROR = 'error';
|
14 |
+
const WARNING = 'warning';
|
15 |
+
const NOTICE = 'notice';
|
16 |
+
const INFO = 'info';
|
17 |
+
const DEBUG = 'debug';
|
18 |
+
}
|
loggers/SimpleLoggerLogTypes.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// phpcs:disable PSR12.Properties.ConstantVisibility.NotFound
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Describes log event type
|
7 |
+
* Based on the CRUD-types
|
8 |
+
* http://en.wikipedia.org/wiki/Create,_read,_update_and_delete
|
9 |
+
* More may be added later on if needed
|
10 |
+
* Note: not in use at the moment
|
11 |
+
*/
|
12 |
+
class SimpleLoggerLogTypes
|
13 |
+
{
|
14 |
+
const CREATE = 'create';
|
15 |
+
const READ = 'read';
|
16 |
+
const UPDATE = 'update';
|
17 |
+
const DELETE = 'delete';
|
18 |
+
const OTHER = 'other';
|
19 |
+
}
|
loggers/SimpleMediaLogger.php
CHANGED
@@ -7,8 +7,6 @@ defined('ABSPATH') or die();
|
|
7 |
*/
|
8 |
class SimpleMediaLogger extends SimpleLogger
|
9 |
{
|
10 |
-
|
11 |
-
|
12 |
public $slug = 'SimpleMediaLogger';
|
13 |
|
14 |
/**
|
@@ -16,7 +14,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
16 |
*
|
17 |
* @return array
|
18 |
*/
|
19 |
-
function getInfo()
|
20 |
{
|
21 |
|
22 |
$arr_info = array(
|
@@ -43,8 +41,8 @@ class SimpleMediaLogger extends SimpleLogger
|
|
43 |
'attachment_deleted'
|
44 |
),
|
45 |
),
|
46 |
-
)
|
47 |
-
)
|
48 |
);
|
49 |
|
50 |
return $arr_info;
|
@@ -53,19 +51,18 @@ class SimpleMediaLogger extends SimpleLogger
|
|
53 |
public function loaded()
|
54 |
{
|
55 |
|
56 |
-
add_action('admin_init', array(
|
57 |
|
58 |
-
add_action('xmlrpc_call_success_mw_newMediaObject', array(
|
59 |
|
60 |
-
add_filter('simple_history/rss_item_link', array(
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
-
|
66 |
-
add_action('
|
67 |
-
add_action('
|
68 |
-
add_action('delete_attachment', array( $this, 'on_delete_attachment' ));
|
69 |
}
|
70 |
|
71 |
/**
|
@@ -76,7 +73,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
76 |
* @param int $id ID of the new attachment.
|
77 |
* @param array $args An array of arguments to add the attachment.
|
78 |
*/
|
79 |
-
function
|
80 |
{
|
81 |
|
82 |
$attachment_post = get_post($attachment_id);
|
@@ -140,9 +137,9 @@ class SimpleMediaLogger extends SimpleLogger
|
|
140 |
/**
|
141 |
* Get output for detailed log section
|
142 |
*
|
143 |
-
* @param
|
144 |
*/
|
145 |
-
function getLogRowDetailsOutput($row)
|
146 |
{
|
147 |
|
148 |
$context = $row->context;
|
@@ -207,15 +204,15 @@ class SimpleMediaLogger extends SimpleLogger
|
|
207 |
if ($attachment_is_available) {
|
208 |
$context['attachment_thumb'] = sprintf(
|
209 |
'%1$s',
|
210 |
-
wp_get_attachment_image($attachment_id, array(
|
211 |
);
|
212 |
}
|
213 |
-
}// End if().
|
214 |
|
215 |
$context['attachment_size_format'] = size_format($row->context['attachment_filesize']);
|
216 |
$context['attachment_filetype_extension'] = strtoupper($filetype['ext']);
|
217 |
|
218 |
-
if (!
|
219 |
if ($is_image) {
|
220 |
$message .= "<a class='SimpleHistoryLogitemThumbnailLink' href='" . $edit_link . "'>";
|
221 |
}
|
@@ -238,7 +235,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
238 |
$message .= '</p>';
|
239 |
|
240 |
$output .= $this->interpolate($message, $context, $row);
|
241 |
-
}// End if().
|
242 |
|
243 |
return $output;
|
244 |
}
|
@@ -246,7 +243,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
246 |
/**
|
247 |
* Called when an attachment is added
|
248 |
*/
|
249 |
-
function
|
250 |
{
|
251 |
|
252 |
$attachment_post = get_post($attachment_id);
|
@@ -278,7 +275,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
278 |
*
|
279 |
* @param int $attachment_id
|
280 |
*/
|
281 |
-
function
|
282 |
{
|
283 |
|
284 |
$attachment_post = get_post($attachment_id);
|
@@ -298,10 +295,10 @@ class SimpleMediaLogger extends SimpleLogger
|
|
298 |
);
|
299 |
}
|
300 |
|
301 |
-
|
302 |
* Called when an attachment is deleted
|
303 |
*/
|
304 |
-
function
|
305 |
{
|
306 |
|
307 |
$attachment_post = get_post($attachment_id);
|
@@ -328,7 +325,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
328 |
* @param string $link
|
329 |
* @param array $row
|
330 |
*/
|
331 |
-
public function
|
332 |
{
|
333 |
|
334 |
if ($row->logger != $this->slug) {
|
7 |
*/
|
8 |
class SimpleMediaLogger extends SimpleLogger
|
9 |
{
|
|
|
|
|
10 |
public $slug = 'SimpleMediaLogger';
|
11 |
|
12 |
/**
|
14 |
*
|
15 |
* @return array
|
16 |
*/
|
17 |
+
public function getInfo()
|
18 |
{
|
19 |
|
20 |
$arr_info = array(
|
41 |
'attachment_deleted'
|
42 |
),
|
43 |
),
|
44 |
+
), // end search array
|
45 |
+
), // end labels
|
46 |
);
|
47 |
|
48 |
return $arr_info;
|
51 |
public function loaded()
|
52 |
{
|
53 |
|
54 |
+
add_action('admin_init', array($this, 'onAdminInit'));
|
55 |
|
56 |
+
add_action('xmlrpc_call_success_mw_newMediaObject', array($this, 'onMwNewMediaObject'), 10, 2);
|
57 |
|
58 |
+
add_filter('simple_history/rss_item_link', array($this, 'filterRssItemLink'), 10, 2);
|
59 |
}
|
60 |
|
61 |
+
public function onAdminInit()
|
62 |
{
|
63 |
+
add_action('add_attachment', array($this, 'onAddAttachment'));
|
64 |
+
add_action('edit_attachment', array($this, 'onEditAttachment'));
|
65 |
+
add_action('delete_attachment', array($this, 'onDeleteAttachment'));
|
|
|
66 |
}
|
67 |
|
68 |
/**
|
73 |
* @param int $id ID of the new attachment.
|
74 |
* @param array $args An array of arguments to add the attachment.
|
75 |
*/
|
76 |
+
public function onMwNewMediaObject($attachment_id, $args)
|
77 |
{
|
78 |
|
79 |
$attachment_post = get_post($attachment_id);
|
137 |
/**
|
138 |
* Get output for detailed log section
|
139 |
*
|
140 |
+
* @param object $row Row.
|
141 |
*/
|
142 |
+
public function getLogRowDetailsOutput($row)
|
143 |
{
|
144 |
|
145 |
$context = $row->context;
|
204 |
if ($attachment_is_available) {
|
205 |
$context['attachment_thumb'] = sprintf(
|
206 |
'%1$s',
|
207 |
+
wp_get_attachment_image($attachment_id, array(350, 500), true) // Placeholder 1.
|
208 |
);
|
209 |
}
|
210 |
+
} // End if().
|
211 |
|
212 |
$context['attachment_size_format'] = size_format($row->context['attachment_filesize']);
|
213 |
$context['attachment_filetype_extension'] = strtoupper($filetype['ext']);
|
214 |
|
215 |
+
if (!empty($context['attachment_thumb'])) {
|
216 |
if ($is_image) {
|
217 |
$message .= "<a class='SimpleHistoryLogitemThumbnailLink' href='" . $edit_link . "'>";
|
218 |
}
|
235 |
$message .= '</p>';
|
236 |
|
237 |
$output .= $this->interpolate($message, $context, $row);
|
238 |
+
} // End if().
|
239 |
|
240 |
return $output;
|
241 |
}
|
243 |
/**
|
244 |
* Called when an attachment is added
|
245 |
*/
|
246 |
+
public function onAddAttachment($attachment_id)
|
247 |
{
|
248 |
|
249 |
$attachment_post = get_post($attachment_id);
|
275 |
*
|
276 |
* @param int $attachment_id
|
277 |
*/
|
278 |
+
public function onEditAttachment($attachment_id)
|
279 |
{
|
280 |
|
281 |
$attachment_post = get_post($attachment_id);
|
295 |
);
|
296 |
}
|
297 |
|
298 |
+
/*
|
299 |
* Called when an attachment is deleted
|
300 |
*/
|
301 |
+
public function onDeleteAttachment($attachment_id)
|
302 |
{
|
303 |
|
304 |
$attachment_post = get_post($attachment_id);
|
325 |
* @param string $link
|
326 |
* @param array $row
|
327 |
*/
|
328 |
+
public function filterRssItemLink($link, $row)
|
329 |
{
|
330 |
|
331 |
if ($row->logger != $this->slug) {
|
loggers/SimpleMenuLogger.php
CHANGED
@@ -7,8 +7,6 @@ defined('ABSPATH') or die();
|
|
7 |
*/
|
8 |
class SimpleMenuLogger extends SimpleLogger
|
9 |
{
|
10 |
-
|
11 |
-
|
12 |
public $slug = __CLASS__;
|
13 |
|
14 |
/**
|
@@ -16,7 +14,7 @@ class SimpleMenuLogger extends SimpleLogger
|
|
16 |
*
|
17 |
* @return array
|
18 |
*/
|
19 |
-
function getInfo()
|
20 |
{
|
21 |
|
22 |
$arr_info = array(
|
@@ -54,7 +52,7 @@ class SimpleMenuLogger extends SimpleLogger
|
|
54 |
return $arr_info;
|
55 |
}
|
56 |
|
57 |
-
function loaded()
|
58 |
{
|
59 |
|
60 |
/*
|
@@ -117,7 +115,7 @@ class SimpleMenuLogger extends SimpleLogger
|
|
117 |
* Can't use action "wp_delete_nav_menu" beacuse
|
118 |
* it's fired after menu is deleted, so we don't have the name in this action
|
119 |
*/
|
120 |
-
function on_load_nav_menus_page_detect_delete()
|
121 |
{
|
122 |
|
123 |
/*
|
@@ -176,7 +174,7 @@ class SimpleMenuLogger extends SimpleLogger
|
|
176 |
}
|
177 |
*/
|
178 |
|
179 |
-
function on_wp_create_nav_menu($term_id, $menu_data)
|
180 |
{
|
181 |
|
182 |
$menu = wp_get_nav_menu_object($term_id);
|
@@ -213,7 +211,7 @@ class SimpleMenuLogger extends SimpleLogger
|
|
213 |
/**
|
214 |
* Detect menu being saved
|
215 |
*/
|
216 |
-
function on_load_nav_menus_page_detect_update()
|
217 |
{
|
218 |
|
219 |
/*
|
@@ -309,7 +307,7 @@ class SimpleMenuLogger extends SimpleLogger
|
|
309 |
/**
|
310 |
* Get detailed output
|
311 |
*/
|
312 |
-
function getLogRowDetailsOutput($row)
|
313 |
{
|
314 |
|
315 |
$context = $row->context;
|
@@ -344,7 +342,7 @@ class SimpleMenuLogger extends SimpleLogger
|
|
344 |
/**
|
345 |
* Log updates to theme menu locations
|
346 |
*/
|
347 |
-
function on_load_nav_menus_page_detect_locations_update()
|
348 |
{
|
349 |
|
350 |
// Check that needed vars are set
|
7 |
*/
|
8 |
class SimpleMenuLogger extends SimpleLogger
|
9 |
{
|
|
|
|
|
10 |
public $slug = __CLASS__;
|
11 |
|
12 |
/**
|
14 |
*
|
15 |
* @return array
|
16 |
*/
|
17 |
+
public function getInfo()
|
18 |
{
|
19 |
|
20 |
$arr_info = array(
|
52 |
return $arr_info;
|
53 |
}
|
54 |
|
55 |
+
public function loaded()
|
56 |
{
|
57 |
|
58 |
/*
|
115 |
* Can't use action "wp_delete_nav_menu" beacuse
|
116 |
* it's fired after menu is deleted, so we don't have the name in this action
|
117 |
*/
|
118 |
+
public function on_load_nav_menus_page_detect_delete()
|
119 |
{
|
120 |
|
121 |
/*
|
174 |
}
|
175 |
*/
|
176 |
|
177 |
+
public function on_wp_create_nav_menu($term_id, $menu_data)
|
178 |
{
|
179 |
|
180 |
$menu = wp_get_nav_menu_object($term_id);
|
211 |
/**
|
212 |
* Detect menu being saved
|
213 |
*/
|
214 |
+
public function on_load_nav_menus_page_detect_update()
|
215 |
{
|
216 |
|
217 |
/*
|
307 |
/**
|
308 |
* Get detailed output
|
309 |
*/
|
310 |
+
public function getLogRowDetailsOutput($row)
|
311 |
{
|
312 |
|
313 |
$context = $row->context;
|
342 |
/**
|
343 |
* Log updates to theme menu locations
|
344 |
*/
|
345 |
+
public function on_load_nav_menus_page_detect_locations_update()
|
346 |
{
|
347 |
|
348 |
// Check that needed vars are set
|
loggers/SimpleOptionsLogger.php
CHANGED
@@ -16,7 +16,7 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
16 |
*
|
17 |
* @return array
|
18 |
*/
|
19 |
-
function getInfo()
|
20 |
{
|
21 |
|
22 |
$arr_info = array(
|
@@ -50,13 +50,13 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
50 |
return $arr_info;
|
51 |
}
|
52 |
|
53 |
-
function loaded()
|
54 |
{
|
55 |
|
56 |
add_action('updated_option', array( $this, 'on_updated_option' ), 10, 3);
|
57 |
}
|
58 |
|
59 |
-
function on_updated_option($option, $old_value, $new_value)
|
60 |
{
|
61 |
|
62 |
if (empty($_SERVER['REQUEST_URI'])) {
|
@@ -183,7 +183,7 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
183 |
/**
|
184 |
* Get detailed output
|
185 |
*/
|
186 |
-
function getLogRowDetailsOutput($row)
|
187 |
{
|
188 |
|
189 |
$context = $row->context;
|
@@ -289,7 +289,7 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
289 |
* value 0 = Your latest post
|
290 |
* value int n = A static page
|
291 |
*/
|
292 |
-
function add_context_for_option_page_on_front($context, $old_value, $new_value, $option, $option_page)
|
293 |
{
|
294 |
|
295 |
if (! empty($old_value) && is_numeric($old_value)) {
|
@@ -311,7 +311,7 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
311 |
return $context;
|
312 |
}
|
313 |
|
314 |
-
function add_context_for_option_page_for_posts($context, $old_value, $new_value, $option, $option_page)
|
315 |
{
|
316 |
|
317 |
// Get same info as for page_on_front
|
@@ -320,7 +320,7 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
320 |
return $context;
|
321 |
}
|
322 |
|
323 |
-
function get_details_output_for_option_page_for_posts($context, $old_value, $new_value, $option, $option_page)
|
324 |
{
|
325 |
|
326 |
$output = call_user_func_array(array( $this, 'get_details_output_for_option_page_on_front' ), func_get_args());
|
@@ -333,7 +333,7 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
333 |
*
|
334 |
* @return string output
|
335 |
*/
|
336 |
-
function get_details_output_for_option_page_on_front($context, $old_value, $new_value, $option, $option_page, $tmpl_row)
|
337 |
{
|
338 |
|
339 |
$output = '';
|
@@ -386,13 +386,12 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
386 |
}
|
387 |
|
388 |
return $output;
|
389 |
-
}
|
390 |
-
|
391 |
|
392 |
/**
|
393 |
* "default_category" = Writing Settings » Default Post Category
|
394 |
*/
|
395 |
-
function add_context_for_option_default_category($context, $old_value, $new_value, $option, $option_page)
|
396 |
{
|
397 |
|
398 |
if (! empty($old_value) && is_numeric($old_value)) {
|
@@ -414,7 +413,7 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
414 |
return $context;
|
415 |
}
|
416 |
|
417 |
-
function add_context_for_option_default_email_category($context, $old_value, $new_value, $option, $option_page)
|
418 |
{
|
419 |
|
420 |
$context = call_user_func_array(array( $this, 'add_context_for_option_default_category' ), func_get_args());
|
@@ -428,7 +427,7 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
428 |
*
|
429 |
* @return string output
|
430 |
*/
|
431 |
-
function get_details_output_for_option_default_category($context, $old_value, $new_value, $option, $option_page, $tmpl_row)
|
432 |
{
|
433 |
|
434 |
$old_category_name = isset($context['old_category_name']) ? $context['old_category_name'] : null;
|
@@ -454,7 +453,7 @@ class SimpleOptionsLogger extends SimpleLogger
|
|
454 |
return $output;
|
455 |
}
|
456 |
|
457 |
-
function get_details_output_for_option_default_email_category($context, $old_value, $new_value, $option, $option_page, $tmpl_row)
|
458 |
{
|
459 |
|
460 |
$output = call_user_func_array(array( $this, 'get_details_output_for_option_default_category' ), func_get_args());
|
16 |
*
|
17 |
* @return array
|
18 |
*/
|
19 |
+
public function getInfo()
|
20 |
{
|
21 |
|
22 |
$arr_info = array(
|
50 |
return $arr_info;
|
51 |
}
|
52 |
|
53 |
+
public function loaded()
|
54 |
{
|
55 |
|
56 |
add_action('updated_option', array( $this, 'on_updated_option' ), 10, 3);
|
57 |
}
|
58 |
|
59 |
+
public function on_updated_option($option, $old_value, $new_value)
|
60 |
{
|
61 |
|
62 |
if (empty($_SERVER['REQUEST_URI'])) {
|
183 |
/**
|
184 |
* Get detailed output
|
185 |
*/
|
186 |
+
public function getLogRowDetailsOutput($row)
|
187 |
{
|
188 |
|
189 |
$context = $row->context;
|
289 |
* value 0 = Your latest post
|
290 |
* value int n = A static page
|
291 |
*/
|
292 |
+
public function add_context_for_option_page_on_front($context, $old_value, $new_value, $option, $option_page)
|
293 |
{
|
294 |
|
295 |
if (! empty($old_value) && is_numeric($old_value)) {
|
311 |
return $context;
|
312 |
}
|
313 |
|
314 |
+
public function add_context_for_option_page_for_posts($context, $old_value, $new_value, $option, $option_page)
|
315 |
{
|
316 |
|
317 |
// Get same info as for page_on_front
|
320 |
return $context;
|
321 |
}
|
322 |
|
323 |
+
public function get_details_output_for_option_page_for_posts($context, $old_value, $new_value, $option, $option_page)
|
324 |
{
|
325 |
|
326 |
$output = call_user_func_array(array( $this, 'get_details_output_for_option_page_on_front' ), func_get_args());
|
333 |
*
|
334 |
* @return string output
|
335 |
*/
|
336 |
+
public function get_details_output_for_option_page_on_front($context, $old_value, $new_value, $option, $option_page, $tmpl_row)
|
337 |
{
|
338 |
|
339 |
$output = '';
|
386 |
}
|
387 |
|
388 |
return $output;
|
389 |
+
}
|
|
|
390 |
|
391 |
/**
|
392 |
* "default_category" = Writing Settings » Default Post Category
|
393 |
*/
|
394 |
+
public function add_context_for_option_default_category($context, $old_value, $new_value, $option, $option_page)
|
395 |
{
|
396 |
|
397 |
if (! empty($old_value) && is_numeric($old_value)) {
|
413 |
return $context;
|
414 |
}
|
415 |
|
416 |
+
public function add_context_for_option_default_email_category($context, $old_value, $new_value, $option, $option_page)
|
417 |
{
|
418 |
|
419 |
$context = call_user_func_array(array( $this, 'add_context_for_option_default_category' ), func_get_args());
|
427 |
*
|
428 |
* @return string output
|
429 |
*/
|
430 |
+
public function get_details_output_for_option_default_category($context, $old_value, $new_value, $option, $option_page, $tmpl_row)
|
431 |
{
|
432 |
|
433 |
$old_category_name = isset($context['old_category_name']) ? $context['old_category_name'] : null;
|
453 |
return $output;
|
454 |
}
|
455 |
|
456 |
+
public function get_details_output_for_option_default_email_category($context, $old_value, $new_value, $option, $option_page, $tmpl_row)
|
457 |
{
|
458 |
|
459 |
$output = call_user_func_array(array( $this, 'get_details_output_for_option_default_category' ), func_get_args());
|
loggers/SimplePluginLogger.php
CHANGED
@@ -3,13 +3,12 @@
|
|
3 |
defined('ABSPATH') || die();
|
4 |
|
5 |
/**
|
6 |
-
* Logs plugin installs, updates, and deletions.
|
7 |
*/
|
8 |
class SimplePluginLogger extends SimpleLogger
|
9 |
{
|
10 |
-
|
11 |
/**
|
12 |
-
* The logger slug.
|
13 |
*
|
14 |
* @var string $slug
|
15 |
*/
|
@@ -31,7 +30,6 @@ class SimplePluginLogger extends SimpleLogger
|
|
31 |
*/
|
32 |
public function getInfo()
|
33 |
{
|
34 |
-
|
35 |
$arr_info = array(
|
36 |
'name' => 'Plugin Logger',
|
37 |
'description' => 'Logs plugin installs, uninstalls and updates',
|
@@ -94,6 +92,17 @@ class SimplePluginLogger extends SimpleLogger
|
|
94 |
'simple-history'
|
95 |
),
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
), // Messages.
|
98 |
'labels' => array(
|
99 |
'search' => array(
|
@@ -132,11 +141,10 @@ class SimplePluginLogger extends SimpleLogger
|
|
132 |
}
|
133 |
|
134 |
/**
|
135 |
-
* Plugin loaded
|
136 |
*/
|
137 |
public function loaded()
|
138 |
{
|
139 |
-
|
140 |
/**
|
141 |
* At least the plugin bulk upgrades fires this action before upgrade
|
142 |
* We use it to fetch the current version of all plugins, before they are upgraded
|
@@ -182,6 +190,172 @@ class SimplePluginLogger extends SimpleLogger
|
|
182 |
// So we hook into gettext and look for the usage of the error that is returned when this happens.
|
183 |
add_filter('gettext', array( $this, 'on_gettext_detect_plugin_error_deactivation_reason' ), 10, 3);
|
184 |
add_filter('gettext', array( $this, 'on_gettext' ), 10, 3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
}
|
186 |
|
187 |
/**
|
@@ -191,7 +365,7 @@ class SimplePluginLogger extends SimpleLogger
|
|
191 |
* @param string $text Text.
|
192 |
* @param string $domain Domin.
|
193 |
*/
|
194 |
-
function on_gettext_detect_plugin_error_deactivation_reason($translation, $text, $domain)
|
195 |
{
|
196 |
|
197 |
global $pagenow;
|
@@ -246,7 +420,7 @@ class SimplePluginLogger extends SimpleLogger
|
|
246 |
* @param string $text Text.
|
247 |
* @param string $domain Domin.
|
248 |
*/
|
249 |
-
function on_gettext($translation, $text, $domain)
|
250 |
{
|
251 |
|
252 |
global $pagenow;
|
@@ -302,12 +476,12 @@ class SimplePluginLogger extends SimpleLogger
|
|
302 |
);
|
303 |
|
304 |
return $translation;
|
305 |
-
}
|
306 |
|
307 |
/**
|
308 |
* Show readme from github in a modal win
|
309 |
*/
|
310 |
-
function ajax_GetGitHubPluginInfo()
|
311 |
{
|
312 |
|
313 |
if (! current_user_can('install_plugins')) {
|
@@ -404,7 +578,7 @@ class SimplePluginLogger extends SimpleLogger
|
|
404 |
* the real name of the plugin, only the dir and main index file.
|
405 |
* So before a plugin is deleted we save all needed info in a transient
|
406 |
*/
|
407 |
-
function on_action_delete_selected()
|
408 |
{
|
409 |
|
410 |
// Same as in plugins.php
|
@@ -431,7 +605,7 @@ class SimplePluginLogger extends SimpleLogger
|
|
431 |
* Saves info about all installed plugins to an option.
|
432 |
* When we are done logging then we remove the option.
|
433 |
*/
|
434 |
-
function save_versions_before_update($bool = null, $hook_extra = null)
|
435 |
{
|
436 |
|
437 |
$plugins = get_plugins();
|
@@ -567,7 +741,7 @@ class SimplePluginLogger extends SimpleLogger
|
|
567 |
* @param array $data {
|
568 |
* Array of bulk item update data.
|
569 |
*/
|
570 |
-
function on_upgrader_process_complete($plugin_upgrader_instance, $arr_data)
|
571 |
{
|
572 |
|
573 |
// Can't use get_plugins() here to get version of plugins updated from
|
@@ -915,14 +1089,13 @@ class SimplePluginLogger extends SimpleLogger
|
|
915 |
}
|
916 |
|
917 |
$this->remove_saved_versions();
|
918 |
-
}
|
919 |
-
|
920 |
|
921 |
/**
|
922 |
* Plugin is activated
|
923 |
* plugin_name is like admin-menu-tree-page-view/index.php
|
924 |
*/
|
925 |
-
function on_activated_plugin($plugin_name, $network_wide)
|
926 |
{
|
927 |
|
928 |
/*
|
@@ -957,13 +1130,13 @@ class SimplePluginLogger extends SimpleLogger
|
|
957 |
}
|
958 |
|
959 |
$this->infoMessage('plugin_activated', $context);
|
960 |
-
}
|
961 |
|
962 |
/**
|
963 |
* Plugin is deactivated
|
964 |
* plugin_name is like admin-menu-tree-page-view/index.php
|
965 |
*/
|
966 |
-
function on_deactivated_plugin($plugin_name)
|
967 |
{
|
968 |
|
969 |
$plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_name, true, false);
|
@@ -984,13 +1157,13 @@ class SimplePluginLogger extends SimpleLogger
|
|
984 |
}
|
985 |
|
986 |
$this->infoMessage('plugin_deactivated', $context);
|
987 |
-
}
|
988 |
|
989 |
|
990 |
/**
|
991 |
* Get output for detailed log section
|
992 |
*/
|
993 |
-
function getLogRowDetailsOutput($row)
|
994 |
{
|
995 |
|
996 |
$context = $row->context;
|
@@ -1120,8 +1293,7 @@ class SimplePluginLogger extends SimpleLogger
|
|
1120 |
admin_url("plugin-install.php?tab=plugin-information&plugin={$plugin_slug}&section=&TB_iframe=true&width=640&height=550"),
|
1121 |
esc_html_x('View plugin info', 'plugin logger: plugin info thickbox title view all info', 'simple-history')
|
1122 |
);
|
1123 |
-
}
|
1124 |
-
elseif (isset($context['plugin_install_source']) && $context['plugin_install_source'] == 'upload' && ! empty($context['plugin_github_url'])) {
|
1125 |
// Can't embed iframe
|
1126 |
// Must use API instead
|
1127 |
// https://api.github.com/repos/<username>/<repo>/readme?callback=<callbackname>
|
@@ -1176,5 +1348,5 @@ class SimplePluginLogger extends SimpleLogger
|
|
1176 |
} // End if().
|
1177 |
|
1178 |
return $output;
|
1179 |
-
}
|
1180 |
-
}
|
3 |
defined('ABSPATH') || die();
|
4 |
|
5 |
/**
|
6 |
+
* Logs plugin related things, for example installs, updates, and deletions.
|
7 |
*/
|
8 |
class SimplePluginLogger extends SimpleLogger
|
9 |
{
|
|
|
10 |
/**
|
11 |
+
* The logger slug.
|
12 |
*
|
13 |
* @var string $slug
|
14 |
*/
|
30 |
*/
|
31 |
public function getInfo()
|
32 |
{
|
|
|
33 |
$arr_info = array(
|
34 |
'name' => 'Plugin Logger',
|
35 |
'description' => 'Logs plugin installs, uninstalls and updates',
|
92 |
'simple-history'
|
93 |
),
|
94 |
|
95 |
+
'plugin_auto_updates_enabled' => _x(
|
96 |
+
'Enabled auto-updates for plugin "{plugin_name}"',
|
97 |
+
'Plugin was enabled for auto-updates',
|
98 |
+
'simple-history'
|
99 |
+
),
|
100 |
+
'plugin_auto_updates_disabled' => _x(
|
101 |
+
'Disabled auto-updates for plugin "{plugin_name}"',
|
102 |
+
'Plugin was enabled for auto-updates',
|
103 |
+
'simple-history'
|
104 |
+
),
|
105 |
+
|
106 |
), // Messages.
|
107 |
'labels' => array(
|
108 |
'search' => array(
|
141 |
}
|
142 |
|
143 |
/**
|
144 |
+
* Plugin loaded.
|
145 |
*/
|
146 |
public function loaded()
|
147 |
{
|
|
|
148 |
/**
|
149 |
* At least the plugin bulk upgrades fires this action before upgrade
|
150 |
* We use it to fetch the current version of all plugins, before they are upgraded
|
190 |
// So we hook into gettext and look for the usage of the error that is returned when this happens.
|
191 |
add_filter('gettext', array( $this, 'on_gettext_detect_plugin_error_deactivation_reason' ), 10, 3);
|
192 |
add_filter('gettext', array( $this, 'on_gettext' ), 10, 3);
|
193 |
+
|
194 |
+
// Detect plugin auto update change.
|
195 |
+
add_action("load-plugins.php", [$this, 'handleAutoUpdateChange']);
|
196 |
+
add_action("wp_ajax_toggle-auto-updates", [$this, 'handleAutoUpdateChange'], 1, 1);
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Detect when a plugin is enable or disabled to be auto updated.
|
201 |
+
* This can be changed from the plugins-page, either from a GET request to
|
202 |
+
* the plugins-page or via an AJAX call.
|
203 |
+
*
|
204 |
+
* The result of the action is stored in
|
205 |
+
* site_option 'auto_update_plugins'.
|
206 |
+
* Check the value of that option after the option is updated.
|
207 |
+
*/
|
208 |
+
public function handleAutoUpdateChange()
|
209 |
+
{
|
210 |
+
$option = 'auto_update_plugins';
|
211 |
+
|
212 |
+
add_filter("update_option_{$option}", function ($old_value, $value, $option) {
|
213 |
+
/**
|
214 |
+
* Option contains array with plugin that are set to be auto updated.
|
215 |
+
* Example:
|
216 |
+
* Array
|
217 |
+
* (
|
218 |
+
* [1] => query-monitor/query-monitor.php
|
219 |
+
* [2] => akismet/akismet.php
|
220 |
+
* [3] => wp-crontrol/wp-crontrol.php
|
221 |
+
* [4] => redirection/redirection.php
|
222 |
+
* )
|
223 |
+
*
|
224 |
+
* $_GET when opening single item enable/disable auto update link in plugin list in new window
|
225 |
+
* Array
|
226 |
+
* (
|
227 |
+
* [action] => disable-auto-update | enable-auto-update
|
228 |
+
* [plugin] => akismet/akismet.php
|
229 |
+
* )
|
230 |
+
*
|
231 |
+
*
|
232 |
+
* $_POST from ajax call when clicking single item enable/disable link in plugin list
|
233 |
+
* [action] => toggle-auto-updates
|
234 |
+
* [state] => disable | enable
|
235 |
+
* [type] => plugin
|
236 |
+
* [asset] => redirection/redirection.php
|
237 |
+
*
|
238 |
+
*
|
239 |
+
* $_POST when selecting multiple plugins and choosing Enable auto updates or Disable auto updates
|
240 |
+
* [action] => enable-auto-update-selected | disable-auto-update-selected
|
241 |
+
* [checked] => Array
|
242 |
+
* (
|
243 |
+
* [0] => query-monitor/query-monitor.php
|
244 |
+
* [1] => redirection/redirection.php
|
245 |
+
* )
|
246 |
+
*/
|
247 |
+
|
248 |
+
$action = $_GET['action'] ?? $_POST['action'] ?? null;
|
249 |
+
|
250 |
+
// Bail if doing ajax and
|
251 |
+
// - action is not toggle-auto-updates
|
252 |
+
// - type is not plugin
|
253 |
+
if (wp_doing_ajax()) {
|
254 |
+
if ($action !== 'toggle-auto-updates') {
|
255 |
+
return;
|
256 |
+
}
|
257 |
+
|
258 |
+
$type = $_POST['type'] ?? null;
|
259 |
+
if ($type !== 'plugin') {
|
260 |
+
return;
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
// Bail if screen and not plugin screen
|
265 |
+
$current_screen = get_current_screen();
|
266 |
+
if (is_a($current_screen, 'WP_Screen') && ($current_screen->base !== 'plugins')) {
|
267 |
+
return;
|
268 |
+
}
|
269 |
+
|
270 |
+
// Enable or disable, string "enable" or "disable".
|
271 |
+
$enableOrDisable = null;
|
272 |
+
|
273 |
+
// Plugin slugs that actions are performed against.
|
274 |
+
$plugins = [];
|
275 |
+
|
276 |
+
if (in_array($action, ['enable-auto-update', 'disable-auto-update'])) {
|
277 |
+
// Opening single item enable/disable auto update link in plugin list in new window.
|
278 |
+
$plugin = $_GET['plugin'] ?? null;
|
279 |
+
|
280 |
+
if ($plugin) {
|
281 |
+
$plugins[] = sanitize_text_field(urldecode($plugin));
|
282 |
+
}
|
283 |
+
|
284 |
+
if ($action === 'enable-auto-update') {
|
285 |
+
$enableOrDisable = 'enable';
|
286 |
+
} elseif ($action === 'disable-auto-update') {
|
287 |
+
$enableOrDisable = 'disable';
|
288 |
+
}
|
289 |
+
} elseif ($action === 'toggle-auto-updates') {
|
290 |
+
// Ajax post call when clicking single item enable/disable link in plugin list.
|
291 |
+
// * [action] => toggle-auto-updates
|
292 |
+
// * [state] => disable | enable
|
293 |
+
// * [type] => plugin
|
294 |
+
// * [asset] => redirection/redirection.php
|
295 |
+
$state = $_POST['state'] ?? null;
|
296 |
+
$asset = $_POST['asset'] ?? null;
|
297 |
+
|
298 |
+
if ($state === 'enable') {
|
299 |
+
$enableOrDisable = 'enable';
|
300 |
+
} elseif ($state === 'disable') {
|
301 |
+
$enableOrDisable = 'disable';
|
302 |
+
}
|
303 |
+
|
304 |
+
if ($asset) {
|
305 |
+
$plugins[] = sanitize_text_field(urldecode($asset));
|
306 |
+
}
|
307 |
+
} elseif (in_array($action, ['enable-auto-update-selected', 'disable-auto-update-selected'])) {
|
308 |
+
// $_POST when checking multiple plugins and choosing Enable auto updates or Disable auto updates.
|
309 |
+
$checked = $_POST['checked'] ?? null;
|
310 |
+
if ($checked) {
|
311 |
+
$plugins = (array) $checked;
|
312 |
+
}
|
313 |
+
|
314 |
+
if ($action === 'enable-auto-update-selected') {
|
315 |
+
$enableOrDisable = 'enable';
|
316 |
+
} elseif ($action === 'disable-auto-update-selected') {
|
317 |
+
$enableOrDisable = 'disable';
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
// Now we have:
|
322 |
+
// - an array of plugin slugs in $plugins
|
323 |
+
// - if plugin auto updates is to be enabled or disabled din $enableOrDisable
|
324 |
+
|
325 |
+
// Bail if required values not set.
|
326 |
+
if (!$plugins || !$enableOrDisable) {
|
327 |
+
return;
|
328 |
+
}
|
329 |
+
|
330 |
+
// Finally log each plugin.
|
331 |
+
foreach ($plugins as $onePluginSlug) {
|
332 |
+
$this->logPluginAutoUpdateEnableOrDisable($onePluginSlug, $enableOrDisable);
|
333 |
+
}
|
334 |
+
}, 10, 3);
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Log plugin that is enable or disabled for auto updates.
|
339 |
+
*
|
340 |
+
* @param string $onePluginSlug slug of plugin, i.e. "hello-dolly/hello.php"
|
341 |
+
* @param string $enableOrDisable String "enable" or "disable"
|
342 |
+
*/
|
343 |
+
public function logPluginAutoUpdateEnableOrDisable($onePluginSlug, $enableOrDisable)
|
344 |
+
{
|
345 |
+
$pluginFile = WP_PLUGIN_DIR . '/' . $onePluginSlug;
|
346 |
+
$pluginData = get_plugin_data($pluginFile, true, false);
|
347 |
+
|
348 |
+
$context = [
|
349 |
+
'plugin_slug' => $onePluginSlug,
|
350 |
+
'plugin_name' => $pluginData['Name'] ?? null,
|
351 |
+
'plugin_version' => $pluginData['Version'] ?? null,
|
352 |
+
];
|
353 |
+
|
354 |
+
if ($enableOrDisable === 'enable') {
|
355 |
+
$this->infoMessage('plugin_auto_updates_enabled', $context);
|
356 |
+
} elseif ($enableOrDisable === 'disable') {
|
357 |
+
$this->infoMessage('plugin_auto_updates_disabled', $context);
|
358 |
+
}
|
359 |
}
|
360 |
|
361 |
/**
|
365 |
* @param string $text Text.
|
366 |
* @param string $domain Domin.
|
367 |
*/
|
368 |
+
public function on_gettext_detect_plugin_error_deactivation_reason($translation, $text, $domain)
|
369 |
{
|
370 |
|
371 |
global $pagenow;
|
420 |
* @param string $text Text.
|
421 |
* @param string $domain Domin.
|
422 |
*/
|
423 |
+
public function on_gettext($translation, $text, $domain)
|
424 |
{
|
425 |
|
426 |
global $pagenow;
|
476 |
);
|
477 |
|
478 |
return $translation;
|
479 |
+
}
|
480 |
|
481 |
/**
|
482 |
* Show readme from github in a modal win
|
483 |
*/
|
484 |
+
public function ajax_GetGitHubPluginInfo()
|
485 |
{
|
486 |
|
487 |
if (! current_user_can('install_plugins')) {
|
578 |
* the real name of the plugin, only the dir and main index file.
|
579 |
* So before a plugin is deleted we save all needed info in a transient
|
580 |
*/
|
581 |
+
public function on_action_delete_selected()
|
582 |
{
|
583 |
|
584 |
// Same as in plugins.php
|
605 |
* Saves info about all installed plugins to an option.
|
606 |
* When we are done logging then we remove the option.
|
607 |
*/
|
608 |
+
public function save_versions_before_update($bool = null, $hook_extra = null)
|
609 |
{
|
610 |
|
611 |
$plugins = get_plugins();
|
741 |
* @param array $data {
|
742 |
* Array of bulk item update data.
|
743 |
*/
|
744 |
+
public function on_upgrader_process_complete($plugin_upgrader_instance, $arr_data)
|
745 |
{
|
746 |
|
747 |
// Can't use get_plugins() here to get version of plugins updated from
|
1089 |
}
|
1090 |
|
1091 |
$this->remove_saved_versions();
|
1092 |
+
}
|
|
|
1093 |
|
1094 |
/**
|
1095 |
* Plugin is activated
|
1096 |
* plugin_name is like admin-menu-tree-page-view/index.php
|
1097 |
*/
|
1098 |
+
public function on_activated_plugin($plugin_name, $network_wide)
|
1099 |
{
|
1100 |
|
1101 |
/*
|
1130 |
}
|
1131 |
|
1132 |
$this->infoMessage('plugin_activated', $context);
|
1133 |
+
}
|
1134 |
|
1135 |
/**
|
1136 |
* Plugin is deactivated
|
1137 |
* plugin_name is like admin-menu-tree-page-view/index.php
|
1138 |
*/
|
1139 |
+
public function on_deactivated_plugin($plugin_name)
|
1140 |
{
|
1141 |
|
1142 |
$plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_name, true, false);
|
1157 |
}
|
1158 |
|
1159 |
$this->infoMessage('plugin_deactivated', $context);
|
1160 |
+
}
|
1161 |
|
1162 |
|
1163 |
/**
|
1164 |
* Get output for detailed log section
|
1165 |
*/
|
1166 |
+
public function getLogRowDetailsOutput($row)
|
1167 |
{
|
1168 |
|
1169 |
$context = $row->context;
|
1293 |
admin_url("plugin-install.php?tab=plugin-information&plugin={$plugin_slug}&section=&TB_iframe=true&width=640&height=550"),
|
1294 |
esc_html_x('View plugin info', 'plugin logger: plugin info thickbox title view all info', 'simple-history')
|
1295 |
);
|
1296 |
+
} elseif (isset($context['plugin_install_source']) && $context['plugin_install_source'] == 'upload' && ! empty($context['plugin_github_url'])) {
|
|
|
1297 |
// Can't embed iframe
|
1298 |
// Must use API instead
|
1299 |
// https://api.github.com/repos/<username>/<repo>/readme?callback=<callbackname>
|
1348 |
} // End if().
|
1349 |
|
1350 |
return $output;
|
1351 |
+
}
|
1352 |
+
}
|
loggers/SimpleThemeLogger.php
CHANGED
@@ -7,7 +7,6 @@ defined('ABSPATH') or die();
|
|
7 |
*/
|
8 |
class SimpleThemeLogger extends SimpleLogger
|
9 |
{
|
10 |
-
|
11 |
public $slug = __CLASS__;
|
12 |
|
13 |
// When swithing themes, this will contain info about the theme we are switching from
|
@@ -18,7 +17,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
18 |
*
|
19 |
* @return array
|
20 |
*/
|
21 |
-
function getInfo()
|
22 |
{
|
23 |
|
24 |
$arr_info = array(
|
@@ -81,7 +80,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
81 |
return $arr_info;
|
82 |
}
|
83 |
|
84 |
-
function loaded()
|
85 |
{
|
86 |
|
87 |
/**
|
@@ -119,7 +118,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
119 |
*
|
120 |
* @param string $transient Deleted transient name.
|
121 |
*/
|
122 |
-
function on_deleted_site_transient_theme_deleted($transient = null)
|
123 |
{
|
124 |
|
125 |
if ('update_themes' !== $transient) {
|
@@ -158,7 +157,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
158 |
}
|
159 |
|
160 |
|
161 |
-
function on_upgrader_process_complete_theme_update($upgrader_instance = null, $arr_data = null)
|
162 |
{
|
163 |
|
164 |
/*
|
@@ -248,7 +247,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
248 |
}
|
249 |
}
|
250 |
|
251 |
-
function on_upgrader_process_complete_theme_install($upgrader_instance = null, $arr_data = null)
|
252 |
{
|
253 |
|
254 |
/*
|
@@ -328,7 +327,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
328 |
);
|
329 |
}
|
330 |
|
331 |
-
function on_page_load_custom_background()
|
332 |
{
|
333 |
|
334 |
if (empty($_POST)) {
|
@@ -359,7 +358,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
359 |
/*
|
360 |
WP_Customize_Manager $this WP_Customize_Manager instance.
|
361 |
*/
|
362 |
-
function on_action_customize_save($customize_manager)
|
363 |
{
|
364 |
|
365 |
/*
|
@@ -539,7 +538,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
539 |
$new_value = $one_setting->post_value();
|
540 |
|
541 |
// If old and new value is different then we log
|
542 |
-
if ($old_value != $new_value && ! in_array($
|
543 |
// if ( $old_value != $new_value ) {
|
544 |
if ($debug) {
|
545 |
echo "\nSetting with id ";
|
@@ -618,7 +617,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
618 |
* When a new theme is about to get switched to
|
619 |
* we save info about the old one
|
620 |
*/
|
621 |
-
function on_page_load_themes()
|
622 |
{
|
623 |
|
624 |
// sf_d($_REQUEST, "request");exit;
|
@@ -647,13 +646,13 @@ class SimpleThemeLogger extends SimpleLogger
|
|
647 |
(
|
648 |
[Name] => Twenty Eleven
|
649 |
[ThemeURI] => http://wordpress.org/themes/twentyeleven
|
650 |
-
[Description] => The 2011 theme for WordPress is sophisticated, lightweight
|
651 |
[Author] => the WordPress team
|
652 |
[AuthorURI] => http://wordpress.org/
|
653 |
[Version] => 1.8
|
654 |
[Template] =>
|
655 |
[Status] =>
|
656 |
-
[Tags] => dark, light, white, black, gray, one-column
|
657 |
[TextDomain] => twentyeleven
|
658 |
[DomainPath] =>
|
659 |
)
|
@@ -680,7 +679,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
680 |
);
|
681 |
}
|
682 |
|
683 |
-
function on_switch_theme($new_name, $new_theme)
|
684 |
{
|
685 |
|
686 |
$prev_theme_data = $this->prev_theme_data;
|
@@ -696,9 +695,8 @@ class SimpleThemeLogger extends SimpleLogger
|
|
696 |
);
|
697 |
}
|
698 |
|
699 |
-
function getLogRowDetailsOutput($row)
|
700 |
{
|
701 |
-
|
702 |
$context = $row->context;
|
703 |
$message_key = $context['_message_key'];
|
704 |
$output = '';
|
@@ -783,7 +781,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
783 |
/**
|
784 |
* Add widget name and sidebar name to output
|
785 |
*/
|
786 |
-
function getLogRowPlainTextOutput($row)
|
787 |
{
|
788 |
|
789 |
$context = $row->context;
|
@@ -865,7 +863,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
865 |
*
|
866 |
* @TODO: first time a widget is added it seems to call this and we get double edit logs that are confusing
|
867 |
*/
|
868 |
-
function on_widget_update_callback($instance, $new_instance, $old_instance, $widget_instance)
|
869 |
{
|
870 |
|
871 |
// sf_d($instance);
|
@@ -1000,7 +998,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
1000 |
/**
|
1001 |
* Widget added
|
1002 |
*/
|
1003 |
-
function on_action_sidebar_admin_setup__detect_widget_add()
|
1004 |
{
|
1005 |
|
1006 |
if (isset($_POST['add_new']) && ! empty($_POST['add_new']) && isset($_POST['sidebar']) && isset($_POST['id_base'])) {
|
@@ -1029,7 +1027,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
1029 |
/*
|
1030 |
* widget deleted
|
1031 |
*/
|
1032 |
-
function on_action_sidebar_admin_setup__detect_widget_delete()
|
1033 |
{
|
1034 |
|
1035 |
// Widget was deleted
|
@@ -1065,7 +1063,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
1065 |
* @param string $sidebar_id ID of sidebar.
|
1066 |
* @return sidebar info or false on failure.
|
1067 |
*/
|
1068 |
-
function getSidebarById($sidebar_id)
|
1069 |
{
|
1070 |
|
1071 |
if (empty($sidebar_id)) {
|
@@ -1092,7 +1090,7 @@ class SimpleThemeLogger extends SimpleLogger
|
|
1092 |
* @param string $id_base
|
1093 |
* @return wp_widget object or false on failure
|
1094 |
*/
|
1095 |
-
function getWidgetByIdBase($widget_id_base)
|
1096 |
{
|
1097 |
|
1098 |
$widget_factory = isset($GLOBALS['wp_widget_factory']) ? $GLOBALS['wp_widget_factory'] : false;
|
7 |
*/
|
8 |
class SimpleThemeLogger extends SimpleLogger
|
9 |
{
|
|
|
10 |
public $slug = __CLASS__;
|
11 |
|
12 |
// When swithing themes, this will contain info about the theme we are switching from
|
17 |
*
|
18 |
* @return array
|
19 |
*/
|
20 |
+
public function getInfo()
|
21 |
{
|
22 |
|
23 |
$arr_info = array(
|
80 |
return $arr_info;
|
81 |
}
|
82 |
|
83 |
+
public function loaded()
|
84 |
{
|
85 |
|
86 |
/**
|
118 |
*
|
119 |
* @param string $transient Deleted transient name.
|
120 |
*/
|
121 |
+
public function on_deleted_site_transient_theme_deleted($transient = null)
|
122 |
{
|
123 |
|
124 |
if ('update_themes' !== $transient) {
|
157 |
}
|
158 |
|
159 |
|
160 |
+
public function on_upgrader_process_complete_theme_update($upgrader_instance = null, $arr_data = null)
|
161 |
{
|
162 |
|
163 |
/*
|
247 |
}
|
248 |
}
|
249 |
|
250 |
+
public function on_upgrader_process_complete_theme_install($upgrader_instance = null, $arr_data = null)
|
251 |
{
|
252 |
|
253 |
/*
|
327 |
);
|
328 |
}
|
329 |
|
330 |
+
public function on_page_load_custom_background()
|
331 |
{
|
332 |
|
333 |
if (empty($_POST)) {
|
358 |
/*
|
359 |
WP_Customize_Manager $this WP_Customize_Manager instance.
|
360 |
*/
|
361 |
+
public function on_action_customize_save($customize_manager)
|
362 |
{
|
363 |
|
364 |
/*
|
538 |
$new_value = $one_setting->post_value();
|
539 |
|
540 |
// If old and new value is different then we log
|
541 |
+
if ($old_value != $new_value && ! in_array($one_setting->id, $arr_changed_settings_ids)) {
|
542 |
// if ( $old_value != $new_value ) {
|
543 |
if ($debug) {
|
544 |
echo "\nSetting with id ";
|
617 |
* When a new theme is about to get switched to
|
618 |
* we save info about the old one
|
619 |
*/
|
620 |
+
public function on_page_load_themes()
|
621 |
{
|
622 |
|
623 |
// sf_d($_REQUEST, "request");exit;
|
646 |
(
|
647 |
[Name] => Twenty Eleven
|
648 |
[ThemeURI] => http://wordpress.org/themes/twentyeleven
|
649 |
+
[Description] => The 2011 theme for WordPress is sophisticated, lightweight...
|
650 |
[Author] => the WordPress team
|
651 |
[AuthorURI] => http://wordpress.org/
|
652 |
[Version] => 1.8
|
653 |
[Template] =>
|
654 |
[Status] =>
|
655 |
+
[Tags] => dark, light, white, black, gray, one-column...
|
656 |
[TextDomain] => twentyeleven
|
657 |
[DomainPath] =>
|
658 |
)
|
679 |
);
|
680 |
}
|
681 |
|
682 |
+
public function on_switch_theme($new_name, $new_theme)
|
683 |
{
|
684 |
|
685 |
$prev_theme_data = $this->prev_theme_data;
|
695 |
);
|
696 |
}
|
697 |
|
698 |
+
public function getLogRowDetailsOutput($row)
|
699 |
{
|
|
|
700 |
$context = $row->context;
|
701 |
$message_key = $context['_message_key'];
|
702 |
$output = '';
|
781 |
/**
|
782 |
* Add widget name and sidebar name to output
|
783 |
*/
|
784 |
+
public function getLogRowPlainTextOutput($row)
|
785 |
{
|
786 |
|
787 |
$context = $row->context;
|
863 |
*
|
864 |
* @TODO: first time a widget is added it seems to call this and we get double edit logs that are confusing
|
865 |
*/
|
866 |
+
public function on_widget_update_callback($instance, $new_instance, $old_instance, $widget_instance)
|
867 |
{
|
868 |
|
869 |
// sf_d($instance);
|
998 |
/**
|
999 |
* Widget added
|
1000 |
*/
|
1001 |
+
public function on_action_sidebar_admin_setup__detect_widget_add()
|
1002 |
{
|
1003 |
|
1004 |
if (isset($_POST['add_new']) && ! empty($_POST['add_new']) && isset($_POST['sidebar']) && isset($_POST['id_base'])) {
|
1027 |
/*
|
1028 |
* widget deleted
|
1029 |
*/
|
1030 |
+
public function on_action_sidebar_admin_setup__detect_widget_delete()
|
1031 |
{
|
1032 |
|
1033 |
// Widget was deleted
|
1063 |
* @param string $sidebar_id ID of sidebar.
|
1064 |
* @return sidebar info or false on failure.
|
1065 |
*/
|
1066 |
+
public function getSidebarById($sidebar_id)
|
1067 |
{
|
1068 |
|
1069 |
if (empty($sidebar_id)) {
|
1090 |
* @param string $id_base
|
1091 |
* @return wp_widget object or false on failure
|
1092 |
*/
|
1093 |
+
public function getWidgetByIdBase($widget_id_base)
|
1094 |
{
|
1095 |
|
1096 |
$widget_factory = isset($GLOBALS['wp_widget_factory']) ? $GLOBALS['wp_widget_factory'] : false;
|
loggers/SimpleUserLogger.php
CHANGED
@@ -113,7 +113,7 @@ class SimpleUserLogger extends SimpleLogger
|
|
113 |
|
114 |
// Plain logins and logouts
|
115 |
add_action('wp_login', array( $this, 'onWpLogin' ), 10, 3);
|
116 |
-
add_action('wp_logout', array( $this, 'onWpLogout' ));
|
117 |
|
118 |
// Failed login attempt to username that exists
|
119 |
add_action('wp_authenticate_user', array( $this, 'onWpAuthenticateUser' ), 10, 2);
|
@@ -307,7 +307,7 @@ class SimpleUserLogger extends SimpleLogger
|
|
307 |
*
|
308 |
* user requests a reset password link
|
309 |
*/
|
310 |
-
public function onRetrievePasswordMessage($message, $key, $user_login, $user_data =
|
311 |
{
|
312 |
|
313 |
if (isset($_GET['action']) && ('lostpassword' == $_GET['action'])) {
|
@@ -570,10 +570,21 @@ class SimpleUserLogger extends SimpleLogger
|
|
570 |
/**
|
571 |
* User logs out
|
572 |
* http://codex.wordpress.org/Plugin_API/Action_Reference/wp_logout
|
|
|
|
|
573 |
*/
|
574 |
-
public function onWpLogout()
|
575 |
{
|
576 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
}
|
578 |
|
579 |
/**
|
113 |
|
114 |
// Plain logins and logouts
|
115 |
add_action('wp_login', array( $this, 'onWpLogin' ), 10, 3);
|
116 |
+
add_action('wp_logout', array( $this, 'onWpLogout' ), 10, 1);
|
117 |
|
118 |
// Failed login attempt to username that exists
|
119 |
add_action('wp_authenticate_user', array( $this, 'onWpAuthenticateUser' ), 10, 2);
|
307 |
*
|
308 |
* user requests a reset password link
|
309 |
*/
|
310 |
+
public function onRetrievePasswordMessage($message, $key, $user_login, $user_data = null)
|
311 |
{
|
312 |
|
313 |
if (isset($_GET['action']) && ('lostpassword' == $_GET['action'])) {
|
570 |
/**
|
571 |
* User logs out
|
572 |
* http://codex.wordpress.org/Plugin_API/Action_Reference/wp_logout
|
573 |
+
*
|
574 |
+
* @param int $user_id ID of the user that was logged out. Added in WP 5.5.
|
575 |
*/
|
576 |
+
public function onWpLogout($user_id = null)
|
577 |
{
|
578 |
+
$context = [];
|
579 |
+
$user = get_userdata($user_id);
|
580 |
+
if (is_a($user, 'WP_User')) {
|
581 |
+
$context['_initiator'] = SimpleLoggerLogInitiators::WP_USER;
|
582 |
+
$context['_user_id'] = $user->ID;
|
583 |
+
$context['_user_login'] = $user->user_login;
|
584 |
+
$context['_user_email'] = $user->user_email;
|
585 |
+
}
|
586 |
+
|
587 |
+
$this->infoMessage('user_logged_out', $context);
|
588 |
}
|
589 |
|
590 |
/**
|
loggers/class-sh-jetpack-logger.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
defined('ABSPATH') || die();
|
10 |
|
11 |
/**
|
12 |
-
* Logger for
|
13 |
*/
|
14 |
class SH_Jetpack_Logger extends SimpleLogger
|
15 |
{
|
@@ -145,4 +145,4 @@ class SH_Jetpack_Logger extends SimpleLogger
|
|
145 |
$context
|
146 |
);
|
147 |
}
|
148 |
-
}
|
9 |
defined('ABSPATH') || die();
|
10 |
|
11 |
/**
|
12 |
+
* Logger for plugin Jetpack.
|
13 |
*/
|
14 |
class SH_Jetpack_Logger extends SimpleLogger
|
15 |
{
|
145 |
$context
|
146 |
);
|
147 |
}
|
148 |
+
}
|
loggers/class-sh-privacy-logger.php
CHANGED
@@ -416,4 +416,4 @@ class SH_Privacy_Logger extends SimpleLogger
|
|
416 |
)
|
417 |
);
|
418 |
}
|
419 |
-
}
|
416 |
)
|
417 |
);
|
418 |
}
|
419 |
+
}
|
loggers/class-sh-translations-logger.php
CHANGED
@@ -13,7 +13,6 @@ defined('ABSPATH') || die();
|
|
13 |
*/
|
14 |
class SH_Translations_Logger extends SimpleLogger
|
15 |
{
|
16 |
-
|
17 |
/**
|
18 |
* Logger slug.
|
19 |
*
|
@@ -134,4 +133,4 @@ class SH_Translations_Logger extends SimpleLogger
|
|
134 |
$name = $this->upgrader->get_name_for_update( $this->language_update );
|
135 |
*/
|
136 |
}
|
137 |
-
}
|
13 |
*/
|
14 |
class SH_Translations_Logger extends SimpleLogger
|
15 |
{
|
|
|
16 |
/**
|
17 |
* Logger slug.
|
18 |
*
|
133 |
$name = $this->upgrader->get_name_for_update( $this->language_update );
|
134 |
*/
|
135 |
}
|
136 |
+
}
|
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 |
|
@@ -147,7 +147,7 @@ to your language then read about how this is done over at the [Polyglots handboo
|
|
147 |
#### Contribute at GitHub
|
148 |
|
149 |
Development of this plugin takes place at GitHub. Please join in with feature requests, bug reports, or even pull requests!
|
150 |
-
https://github.com/bonny/WordPress-Simple-History
|
151 |
|
152 |
#### Donation
|
153 |
|
@@ -189,6 +189,13 @@ Events in the log are stored for 60 days by default. Events older than this will
|
|
189 |
|
190 |
== Changelog ==
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
= 2.36 (August 2020) =
|
193 |
|
194 |
- Fix plus and minus icons in quick diff.
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.37.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 |
|
147 |
#### Contribute at GitHub
|
148 |
|
149 |
Development of this plugin takes place at GitHub. Please join in with feature requests, bug reports, or even pull requests!
|
150 |
+
<a href="https://github.com/bonny/WordPress-Simple-History">https://github.com/bonny/WordPress-Simple-History</a>
|
151 |
|
152 |
#### Donation
|
153 |
|
189 |
|
190 |
== Changelog ==
|
191 |
|
192 |
+
= 2.37 (August 2020) =
|
193 |
+
|
194 |
+
- Added: Enabling or disabling plugin auto-updates is now logged.
|
195 |
+
- Added: Function `sh_d()` that echoes any number of variables to the screen.
|
196 |
+
- Fixed: User logouts did show "other" instead of username of user logging out. Fixes #206, https://wordpress.org/support/topic/suspicious-logged-out-events/, https://wordpress.org/support/topic/login-logout-tracking/.
|
197 |
+
- Updated: lots of code to be formatted more according to PSR12.
|
198 |
+
|
199 |
= 2.36 (August 2020) =
|
200 |
|
201 |
- Fix plus and minus icons in quick diff.
|
templates/settings-style-example.php
CHANGED
@@ -13,7 +13,11 @@ defined('ABSPATH') || die();
|
|
13 |
|
14 |
<ul class="SimpleHistoryLogitems">
|
15 |
|
16 |
-
<li
|
|
|
|
|
|
|
|
|
17 |
|
18 |
<div class="SimpleHistoryLogitem__firstcol">
|
19 |
<div class="SimpleHistoryLogitem__senderImage">
|
@@ -26,6 +30,7 @@ defined('ABSPATH') || die();
|
|
26 |
<div class="SimpleHistoryLogitem__header">
|
27 |
<strong class="SimpleHistoryLogitem__inlineDivided">Jessie</strong>
|
28 |
<span class="SimpleHistoryLogitem__inlineDivided SimpleHistoryLogitem__headerEmail">admin@example.com</span>
|
|
|
29 |
<span class="SimpleHistoryLogitem__permalink SimpleHistoryLogitem__when SimpleHistoryLogitem__inlineDivided"><a class="" href="http://playground-root.ep/wp-admin/index.php?page=simple_history_page#item/665"><time datetime="2014-08-11T21:08:44+00:00" title="2014-08-11T21:08:44+00:00" class="">1 min ago</time></a></span>
|
30 |
</div>
|
31 |
|
@@ -49,7 +54,7 @@ defined('ABSPATH') || die();
|
|
49 |
|
50 |
<p>The <code>inlineDivided</code> class is used to group short pieces of information together, for example meta data:</p>
|
51 |
|
52 |
-
|
53 |
<span class="SimpleHistoryLogitem__inlineDivided">34 kB</span>
|
54 |
<span class="SimpleHistoryLogitem__inlineDivided">PNG</span>
|
55 |
<span class="SimpleHistoryLogitem__inlineDivided">420 × 420</span>
|
@@ -144,7 +149,7 @@ defined('ABSPATH') || die();
|
|
144 |
|
145 |
<div class="SimpleHistoryLogitem__firstcol">
|
146 |
<div class="SimpleHistoryLogitem__senderImage">
|
147 |
-
<img src="http://0.gravatar.com/avatar/eabcdc5ce4112ee4bceff4d7567d43a5?s=38
|
148 |
</div>
|
149 |
</div>
|
150 |
|
@@ -153,7 +158,16 @@ defined('ABSPATH') || die();
|
|
153 |
<div class="SimpleHistoryLogitem__header">
|
154 |
<strong class="SimpleHistoryLogitem__inlineDivided">Jessie</strong>
|
155 |
<span class="SimpleHistoryLogitem__inlineDivided SimpleHistoryLogitem__headerEmail">admin@example.com</span>
|
156 |
-
<span class="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
</div>
|
158 |
|
159 |
<div class="SimpleHistoryLogitem__text">
|
@@ -185,11 +199,11 @@ defined('ABSPATH') || die();
|
|
185 |
|
186 |
$refl = new ReflectionClass('SimpleLoggerLogLevels');
|
187 |
foreach ($refl->getConstants() as $key => $val) {
|
188 |
-
$msg = isset($arr_messages[
|
189 |
echo sprintf($template, $val, $msg);
|
190 |
}
|
191 |
|
192 |
?>
|
193 |
|
194 |
</ul>
|
195 |
-
</div>
|
13 |
|
14 |
<ul class="SimpleHistoryLogitems">
|
15 |
|
16 |
+
<li
|
17 |
+
data-row-id="665"
|
18 |
+
data-occasions-count="0"
|
19 |
+
data-occasions-id="8cdab45b0f40a0c9ffea63683e6edd8a"
|
20 |
+
class="SimpleHistoryLogitem SimpleHistoryLogitem--loglevel-info SimpleHistoryLogitem--logger-SimpleMediaLogger SimpleHistoryLogitem--initiator-wp_user">
|
21 |
|
22 |
<div class="SimpleHistoryLogitem__firstcol">
|
23 |
<div class="SimpleHistoryLogitem__senderImage">
|
30 |
<div class="SimpleHistoryLogitem__header">
|
31 |
<strong class="SimpleHistoryLogitem__inlineDivided">Jessie</strong>
|
32 |
<span class="SimpleHistoryLogitem__inlineDivided SimpleHistoryLogitem__headerEmail">admin@example.com</span>
|
33 |
+
<?php // phpcs:ignore Generic.Files.LineLength ?>
|
34 |
<span class="SimpleHistoryLogitem__permalink SimpleHistoryLogitem__when SimpleHistoryLogitem__inlineDivided"><a class="" href="http://playground-root.ep/wp-admin/index.php?page=simple_history_page#item/665"><time datetime="2014-08-11T21:08:44+00:00" title="2014-08-11T21:08:44+00:00" class="">1 min ago</time></a></span>
|
35 |
</div>
|
36 |
|
54 |
|
55 |
<p>The <code>inlineDivided</code> class is used to group short pieces of information together, for example meta data:</p>
|
56 |
|
57 |
+
<p>
|
58 |
<span class="SimpleHistoryLogitem__inlineDivided">34 kB</span>
|
59 |
<span class="SimpleHistoryLogitem__inlineDivided">PNG</span>
|
60 |
<span class="SimpleHistoryLogitem__inlineDivided">420 × 420</span>
|
149 |
|
150 |
<div class="SimpleHistoryLogitem__firstcol">
|
151 |
<div class="SimpleHistoryLogitem__senderImage">
|
152 |
+
<img src="http://0.gravatar.com/avatar/eabcdc5ce4112ee4bceff4d7567d43a5?s=38" class="avatar avatar-38 photo" height="38" width="38">
|
153 |
</div>
|
154 |
</div>
|
155 |
|
158 |
<div class="SimpleHistoryLogitem__header">
|
159 |
<strong class="SimpleHistoryLogitem__inlineDivided">Jessie</strong>
|
160 |
<span class="SimpleHistoryLogitem__inlineDivided SimpleHistoryLogitem__headerEmail">admin@example.com</span>
|
161 |
+
<span class="
|
162 |
+
SimpleHistoryLogitem__permalink
|
163 |
+
SimpleHistoryLogitem__when SimpleHistoryLogitem__inlineDivided"
|
164 |
+
><a
|
165 |
+
class=""
|
166 |
+
href="#"
|
167 |
+
><time
|
168 |
+
datetime="2014-08-11T21:08:44+00:00"
|
169 |
+
title="2014-08-11T21:08:44+00:00"
|
170 |
+
class="">1 min ago</time></a></span>
|
171 |
</div>
|
172 |
|
173 |
<div class="SimpleHistoryLogitem__text">
|
199 |
|
200 |
$refl = new ReflectionClass('SimpleLoggerLogLevels');
|
201 |
foreach ($refl->getConstants() as $key => $val) {
|
202 |
+
$msg = isset($arr_messages[$val]) ? $arr_messages[$val] : 'This is a message with loglevel';
|
203 |
echo sprintf($template, $val, $msg);
|
204 |
}
|
205 |
|
206 |
?>
|
207 |
|
208 |
</ul>
|
209 |
+
</div>
|