Skip to content

Commit d8601dc

Browse files
authored
some tweaks for WP 7 compatibility (#1401)
* update tested up to version to 7.0.0 and update php tested against in tests.yml to 7.4 * allow css to differentiate between wp version < 7 or >= 7 and add utility styles to use WP colors regardless of version * bump test against version in e2e test build * update expected screenshots * rename files for new php version used in tests * fix some failing e2e tests * add phpcs ignore
1 parent d6dc6c6 commit d8601dc

57 files changed

Lines changed: 79 additions & 22 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
fail-fast: false
4141
matrix:
4242
wp-versions: [ 'latest' ]
43-
php-versions: [ '7.2', '8.1' ]
43+
php-versions: [ '7.4', '8.1' ]
4444
multisite: [ "singlesite", "multisite" ]
4545
include:
4646
- wp-versions: '5.2'
@@ -170,7 +170,7 @@ jobs:
170170
fail-fast: false
171171
matrix:
172172
wp-versions: [ 'latest' ]
173-
php-versions: [ '7.2', '8.1' ]
173+
php-versions: [ '7.4', '8.1' ]
174174
include:
175175
- wp-versions: 'trunk'
176176
php-versions: '7.4'

assets/css/admin-style.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,3 +312,39 @@ table.matomo-tracking-form th {
312312
font-size: 0.9em;
313313
margin-top: 24px;
314314
}
315+
316+
.matomo-primary-color-fg {
317+
color: #2271b1;
318+
}
319+
320+
.matomo-secondary-color-fg {
321+
color: #f6f7f7;
322+
}
323+
324+
.matomo-primary-color-bg {
325+
background-color: #2271b1;
326+
}
327+
328+
.matomo-secondary-color-bg {
329+
background-color: #f6f7f7;
330+
}
331+
332+
.mtm-wp-gte-7 .matomo-primary-color-fg {
333+
color: var(--wp-admin-theme-color, #3858e9);
334+
}
335+
336+
.mtm-wp-gte-7 .matomo-secondary-color-fg {
337+
color: white;
338+
}
339+
340+
.mtm-wp-gte-7 .matomo-primary-color-bg {
341+
background-color: var(--wp-admin-theme-color, #3858e9);
342+
}
343+
344+
.mtm-wp-gte-7 .matomo-secondary-color-bg {
345+
background-color: white;
346+
}
347+
348+
.mtm-wp-gte-7 .matomo-toggle input:checked + .slider {
349+
background-color: var(--wp-admin-theme-color, #3858e9);
350+
}

classes/WpMatomo/Admin/Admin.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function register_hooks() {
4343
}
4444

4545
add_action( 'admin_enqueue_scripts', [ $this, 'load_scripts' ] );
46+
add_filter( 'admin_body_class', [ $this, 'on_admin_body_class' ], 9999 );
4647
}
4748

4849
public static function is_matomo_admin() {
@@ -81,4 +82,20 @@ public function load_scripts() {
8182
]
8283
);
8384
}
85+
86+
public function on_admin_body_class( $classes ) {
87+
$raw_version = get_bloginfo( 'version' );
88+
if ( ! $raw_version ) {
89+
return $classes;
90+
}
91+
92+
$version_parts = explode( '-', $raw_version );
93+
$version = count( $version_parts ) > 1 ? $version_parts[0] : $raw_version;
94+
95+
if ( version_compare( $version, '7.0', '>=' ) ) {
96+
$classes .= 'mtm-wp-gte-7';
97+
}
98+
99+
return $classes;
100+
}
84101
}

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: matomoteam
33
Tags: analytics,privacy-friendly,gdpr,behavior,conversion,wordpress analytics,google analytics,woocommerce analytics,matomo,statistics,stats,ecommerce
44
Requires at least: 4.8
5-
Tested up to: 6.9.4
5+
Tested up to: 7.0.0
66
Stable tag: 5.10.0
77
Requires PHP: 7.2.5
88
License: GPLv3 or later

tests/e2e/baseline/desktop_chrome/matomo-lang.profile-lang.mwp-admin.7.2.png renamed to tests/e2e/baseline/desktop_chrome/matomo-lang.profile-lang.mwp-admin.7.4.png

File renamed without changes.

tests/e2e/baseline/desktop_chrome/matomo-lang.site-lang.mwp-admin.7.2.png renamed to tests/e2e/baseline/desktop_chrome/matomo-lang.site-lang.mwp-admin.7.4.png

File renamed without changes.

tests/e2e/baseline/desktop_chrome/mwp-admin.about.7.2.png renamed to tests/e2e/baseline/desktop_chrome/mwp-admin.about.7.4.png

File renamed without changes.

tests/e2e/baseline/desktop_chrome/mwp-admin.diagnostics.system-report.7.2.png renamed to tests/e2e/baseline/desktop_chrome/mwp-admin.diagnostics.system-report.7.4.png

File renamed without changes.

tests/e2e/baseline/desktop_chrome/mwp-admin.diagnostics.troubleshooting.7.2.png renamed to tests/e2e/baseline/desktop_chrome/mwp-admin.diagnostics.troubleshooting.7.4.png

File renamed without changes.

tests/e2e/baseline/desktop_chrome/mwp-admin.get-started.7.2.png renamed to tests/e2e/baseline/desktop_chrome/mwp-admin.get-started.7.4.png

File renamed without changes.

0 commit comments

Comments
 (0)