From 4649597e0df01049460ef74055c200d655fb3c34 Mon Sep 17 00:00:00 2001 From: dizzy Date: Mon, 22 Jul 2024 11:47:24 -0700 Subject: [PATCH 1/7] Moderate redesign to feedback and get started pages (#1125) * remove about section from get started, rename About page to Help and reorganize the contents of said page to de-emphasize the about section * re-order steps in Get Started page and add some line breaks for clarity * redirect to get started on plugin activation * show all tracking settings by default * break up extremely long function calls into multiple lines * try to fix tests * fix random failure * add more text to the get started page * translate the added text * inaccuracy in changelog * add convenience script to connect to the mariadb database * update expected screenshots * translate text --- CHANGELOG.md | 4 +- README.md | 2 +- assets/css/admin-style.css | 9 +- classes/WpMatomo.php | 8 + classes/WpMatomo/Admin/Menu.php | 4 +- classes/WpMatomo/Admin/views/get_started.php | 53 ++- classes/WpMatomo/Admin/views/info.php | 29 +- classes/WpMatomo/Admin/views/info_help.php | 6 +- .../WpMatomo/Admin/views/info_matomo_desc.php | 26 ++ classes/WpMatomo/Admin/views/info_shared.php | 19 +- classes/WpMatomo/Admin/views/tracking.php | 324 +++++++++++++++--- package.json | 3 +- .../desktop_firefox/mwp-admin.about.png | 4 +- .../desktop_firefox/mwp-admin.about.trunk.png | 4 +- ...in.diagnostics.system-report.7.2.trunk.png | 4 +- ...wp-admin.diagnostics.system-report.8.1.png | 4 +- ...in.diagnostics.system-report.8.1.trunk.png | 4 +- .../mwp-admin.diagnostics.troubleshooting.png | 4 +- ...dmin.diagnostics.troubleshooting.trunk.png | 4 +- .../desktop_firefox/mwp-admin.get-started.png | 4 +- .../mwp-admin.get-started.trunk.png | 4 +- .../mwp-admin.settings.advanced.png | 4 +- .../mwp-admin.settings.advanced.trunk.png | 4 +- .../mwp-admin.settings.exclusions.png | 4 +- .../mwp-admin.settings.exclusions.trunk.png | 4 +- .../mwp-admin.settings.geolocation.png | 4 +- .../mwp-admin.settings.geolocation.trunk.png | 4 +- .../mwp-admin.settings.tracking.7.2.png | 4 +- .../mwp-admin.settings.tracking.7.2.trunk.png | 4 +- .../mwp-admin.settings.tracking.8.1.png | 4 +- .../mwp-admin.settings.tracking.8.1.trunk.png | 4 +- .../mwp-admin.summary.thismonth.png | 4 +- .../mwp-admin.summary.thismonth.trunk.png | 4 +- .../wpmatomo/admin/test-getstarted.php | 1 - .../wpmatomo/wpstatistics/test-import.php | 4 +- 35 files changed, 429 insertions(+), 147 deletions(-) create mode 100644 classes/WpMatomo/Admin/views/info_matomo_desc.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b97d11f8..de4f20f9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ == Changelog === = 5.1.2 = -* Incomplete bug fix: the clickjacking or replay attack fix for functionality that hides notifications for users was incomplete. +* Incomplete bug fix: the session hijacking or replay attack fix for functionality that hides notifications for users was incomplete. * Bug fix: the wp-statistics import is broken when the newest version of wp-statistics is installed. = 5.1.1 = @@ -9,7 +9,7 @@ * Bug fix: system report error notice should only be shown to superusers. * Bug fix: patch Matomo core to fix an iconv() notice that can occur during geolocation. * Allow re-running updates from a specific version in troubleshooting page to help when WordPress fails to update the plugin completely. -* Very minor security fix: functionality that hides notifications for users is no longer able to be used in clickjacking or replay attacks. +* Very minor security fix: functionality that hides notifications for users is no longer able to be used in session hijacking or replay attacks. = 5.1.0 = * Upgrade Matomo core to version 5.1.0 (changes: https://matomo.org/changelog/matomo-5-1-0/). diff --git a/README.md b/README.md index 985c0e6ff..174d64acf 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ First ensure the database you want to inspect (mariadb or mysql) is the one that environment. Then, while the local environment is running in one shell, open another and run the command: ```bash -npm run compose -- run mariadb mariadb -h mariadb -u root -p +npm run mariadb mariadb ``` Enter `pass` for the password. diff --git a/assets/css/admin-style.css b/assets/css/admin-style.css index 512f04d6d..bbec45934 100644 --- a/assets/css/admin-style.css +++ b/assets/css/admin-style.css @@ -1,9 +1,14 @@ -.matomo-tracking-form th { - width: 30%; +.matomo-tracking-form tr { + padding: 6px 0; } .matomo-tracking-form th { width: 30%; + vertical-align: top; +} + +.matomo-tracking-form th label { + vertical-align: baseline; } .matomo-systemreport-comment { diff --git a/classes/WpMatomo.php b/classes/WpMatomo.php index 210afe8dd..e683943a8 100644 --- a/classes/WpMatomo.php +++ b/classes/WpMatomo.php @@ -64,6 +64,7 @@ public function __construct() { } add_action( 'init', [ $this, 'init_plugin' ] ); + add_action( 'activated_plugin', [ $this, 'on_plugin_activated' ] ); $capabilities = new Capabilities( self::$settings ); $capabilities->register_hooks(); @@ -277,4 +278,11 @@ public static function is_async_archiving_manually_disabled() { private static function is_async_archiving_disabled_by_setting() { return self::$settings->is_async_archiving_disabled_by_option(); } + + public function on_plugin_activated( $plugin ) { + if ( is_admin() && plugin_basename( MATOMO_ANALYTICS_FILE ) === $plugin ) { + wp_safe_redirect( home_url( '/wp-admin/admin.php?page=matomo-get-started' ) ); + exit; + } + } } diff --git a/classes/WpMatomo/Admin/Menu.php b/classes/WpMatomo/Admin/Menu.php index a85564004..b7a188a09 100644 --- a/classes/WpMatomo/Admin/Menu.php +++ b/classes/WpMatomo/Admin/Menu.php @@ -213,8 +213,8 @@ public function add_menu() { } add_submenu_page( self::$parent_slug, - __( 'About', 'matomo' ), - __( 'About', 'matomo' ), + __( 'Help', 'matomo' ), + __( 'Help', 'matomo' ), Capabilities::KEY_VIEW, self::SLUG_ABOUT, [ diff --git a/classes/WpMatomo/Admin/views/get_started.php b/classes/WpMatomo/Admin/views/get_started.php index 82e27f1e8..17e11c713 100644 --- a/classes/WpMatomo/Admin/views/get_started.php +++ b/classes/WpMatomo/Admin/views/get_started.php @@ -41,46 +41,65 @@ } ?> +

+ +

+ +
+ +

+ +

+ +

1.

+ +

+ +

+ +

+ [matomo_opt_out]' ); ?> + ', '' ); ?> +

+ +

+ +

+

+ ', '', '', '' ); ?> +

+ is_tracking_enabled() ) { ?> -

1. 2.

-

1.

+

2.

+ +

:

-
+
-

2.

- - [matomo_opt_out]', '', '' ); ?> +

3.

- - ', '', '', '' ); ?> +

-

3.

+ value="">


- - - diff --git a/classes/WpMatomo/Admin/views/info.php b/classes/WpMatomo/Admin/views/info.php index 47246a456..3cd112dfe 100644 --- a/classes/WpMatomo/Admin/views/info.php +++ b/classes/WpMatomo/Admin/views/info.php @@ -21,12 +21,21 @@
- +

+ + + + +
+ + + +



- Matomo will always cost you nothing to use, but that doesn't mean it costs us nothing to make. - Matomo needs your continued support to grow and thrive. ', - '', + esc_html__( 'Matomo will always cost you nothing to use, but that if you\'d like to support Matomo in a more meaningful way, take a look at our %1$spremium plugins%2$s.', 'matomo' ), '', '' ); ?> - Every penny will help.

- - -

- - - - -