PluginProbe
Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity / 3.3.10
Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity v3.3.10
3.3.10 3.3.9 3.3.8 trunk 1.0 1.1.0 1.10.0 1.11.0 1.11.1 1.12.0 1.13.0 1.14.0 1.15.0 1.16.0 1.17.0 1.17.1 1.18.0 1.19.0 1.2.0 1.20.0 1.20.1 1.3.0 1.3.1 1.4.0 1.5.0 All 68 releases
← All changes | logtivity.php +22 -10 3.3.8 → 3.3.10 View file →
@@ -4,11 +4,13 @@
4 4 * Plugin Name: Logtivity
5 5 * Plugin URI: https://logtivity.io
6 6 * Description: Record activity logs and errors logs across all your WordPress sites.
7 7 * Author: Logtivity
8 - * Version: 3.3.8
8 + * Version: 3.3.10
9 + * License: GPL-2.0-or-later
10 + * License URI: https://www.gnu.org/licenses/gpl-2.0.html
9 11 * Text Domain: logtivity
10 - * Requires at least: 4.7
12 + * Requires at least: 6.6
11 13 * Requires PHP: 7.4
12 14 */
13 15
14 16 /**
@@ -36,9 +38,9 @@
36 38 // phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
37 39 // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
38 40
39 41 if (!defined('LOGTIVITY_VERSION')) {
40 - define('LOGTIVITY_VERSION', '3.3.8');
42 + define('LOGTIVITY_VERSION', '3.3.10');
41 43 }
42 44
43 45 class Logtivity
44 46 {
@@ -210,9 +212,10 @@
210 212 return in_array($capability, [Logtivity::ACCESS_LOGS, Logtivity::ACCESS_SETTINGS]);
211 213 }
212 214 );
213 215
214 - if ($administrator = get_role('administrator')) {
216 + $administrator = get_role('administrator');
217 + if ($administrator) {
215 218 if (array_search(Logtivity::ACCESS_LOGS, $capabilities) === false) {
216 219 $administrator->add_cap(Logtivity::ACCESS_LOGS);
217 220 }
218 221
@@ -384,10 +387,12 @@
384 387 public function setLogtivityToLoadFirst(): void
385 388 {
386 389 $path = str_replace(WP_PLUGIN_DIR . '/', '', __FILE__);
387 390
388 - if ($plugins = get_option('active_plugins')) {
389 - if ($key = array_search($path, $plugins)) {
391 + $plugins = get_option('active_plugins');
392 + if ($plugins) {
393 + $key = array_search($path, $plugins);
394 + if ($key !== false) {
390 395 array_splice($plugins, $key, 1);
391 396 array_unshift($plugins, $path);
392 397 update_option('active_plugins', $plugins);
393 398 }
@@ -417,9 +422,9 @@
417 422 * @return void
418 423 */
419 424 public function activated(): void
420 425 {
421 - add_option('logtivity_activate', true);
426 + add_option('logtivity_activate', true, '', 'no');
422 427
423 428 $this->checkCapabilities();
424 429
425 430 if (apply_filters('logtivity_hide_settings_page', false)) {
@@ -440,11 +445,12 @@
440 445 {
441 446 if (get_option('logtivity_activate')) {
442 447 delete_option('logtivity_activate');
443 448
449 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- activate-multi is a core activation redirect flag.
444 450 if (!isset($_GET['activate-multi'])) {
445 451 $page = (new Logtivity_Options())->isWhiteLabelMode() ? 'lgtvy-logs' : 'logtivity';
446 - wp_redirect(admin_url('admin.php?page=' . $page));
452 + wp_safe_redirect(admin_url('admin.php?page=' . $page));
447 453 exit;
448 454 }
449 455 }
450 456 }
@@ -454,8 +460,9 @@
454 460 */
455 461 public function welcomeMessage(): void
456 462 {
457 463 if (get_transient('logtivity-welcome-notice')) {
464 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- logtivity_view() renders trusted plugin templates.
458 465 echo logtivity_view('activation');
459 466
460 467 delete_transient('logtivity-welcome-notice');
461 468 }
@@ -471,8 +478,9 @@
471 478 && logtivity_has_site_url_changed()
472 479 && (new Logtivity_Options())->isWhiteLabelMode() == false
473 480 && !get_transient('dismissed-logtivity-site-url-has-changed-notice')
474 481 ) {
482 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- logtivity_view() renders trusted plugin templates.
475 483 echo logtivity_view('site-url-changed-notice');
476 484 }
477 485 }
478 486
@@ -495,14 +503,18 @@
495 503 );
496 504 wp_enqueue_script(
497 505 'logtivity_admin_js',
498 506 plugin_dir_url(__FILE__) . 'assets/app.js',
499 - false,
500 - $this->version
507 + ['jquery'],
508 + $this->version,
509 + true
501 510 );
502 511 wp_localize_script('logtivity_admin_js', 'logtivityAdminA11y', [
503 512 'loadingLogs' => __('Loading logs...', 'logtivity'),
504 513 'loadLogsError' => __('Unable to load logs. Please try again.', 'logtivity'),
514 + ]);
515 + wp_localize_script('logtivity_admin_js', 'logtivityAdmin', [
516 + 'dismissNonce' => wp_create_nonce('logtivity_dismiss_notice'),
505 517 ]);
506 518 }
507 519 }
508 520