From b4c3f588c3408d424b8e2d04c7a4b45e79271a50 Mon Sep 17 00:00:00 2001 From: Luiz Bills Date: Sun, 21 Jan 2024 15:57:12 -0300 Subject: [PATCH] Don't hide admin notices of WP Crontrol plugin --- changelog.txt | 4 ++++ composer.lock | 12 ++++++------ includes/tweaks/hide-admin-notices.php | 18 ++++++++++++++++++ readme.txt | 6 +++++- wp-tweaks.php | 2 +- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/changelog.txt b/changelog.txt index ea76be5..a3e74c3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ += 2.3.4 - 2024-01-21 = + +- Don't hide admin notices of WP Crontrol plugin. + = 2.3.3 - 2024-01-12 = - More fixes related to admin notices. Sorry. diff --git a/composer.lock b/composer.lock index 3fea4e4..abcdd28 100644 --- a/composer.lock +++ b/composer.lock @@ -100,16 +100,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.55", + "version": "1.10.56", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949" + "reference": "27816a01aea996191ee14d010f325434c0ee76fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa", + "reference": "27816a01aea996191ee14d010f325434c0ee76fa", "shasum": "" }, "require": { @@ -158,7 +158,7 @@ "type": "tidelift" } ], - "time": "2024-01-08T12:32:40+00:00" + "time": "2024-01-15T10:43:00+00:00" }, { "name": "symfony/polyfill-php73", @@ -312,5 +312,5 @@ "ext-mbstring": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/includes/tweaks/hide-admin-notices.php b/includes/tweaks/hide-admin-notices.php index cf80709..f509070 100644 --- a/includes/tweaks/hide-admin-notices.php +++ b/includes/tweaks/hide-admin-notices.php @@ -27,6 +27,7 @@ function wp_tweaks_hide_admin_notices () { display: none; } + /* allowlist */ #wpwrap .wrap .updated, #wpwrap .wrap .notice.update-message, #wpwrap .wrap .notice[id="message"], @@ -48,3 +49,20 @@ function wp_tweaks_hide_admin_notices () { ob_get_clean() ); } + +// don't hide WP Crontrol notices +add_filter( 'wp_tweaks_hide_admin_notices_css_rules', function ( $css ) { + if ( defined( "Crontrol\\WP_CRONTROL_VERSION" ) ) { + $custom_css = " + #wpwrap .wrap .notice#crontrol-late-message, + #wpwrap .wrap .notice#crontrol-status-notice, + #wpwrap .wrap .notice#crontrol-status-error, + #wpwrap .wrap .notice#crontrol-timezon-warning, + #wpwrap .wrap .notice#crontrol-event-not-found, + #wpwrap .wrap .notice#crontrol-message, + "; + $find = '/* allowlist */'; + $css = str_replace( $find, "{$find}{$custom_css}", $css ); + } + return $css; +} ); diff --git a/readme.txt b/readme.txt index cdbc8b1..a1cc42a 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Donate link: https://www.luizpb.com/donate/ Requires at least: 4.0 Tested up to: 6.4 Requires PHP: 7.4 -Stable tag: 2.3.3 +Stable tag: 2.3.4 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -55,6 +55,10 @@ Support this plugin on [https://luizpb.com/donate/](https://luizpb.com/donate/) == Changelog == += 2.3.4 - 2024-01-21 = + +- Don't hide admin notices of WP Crontrol plugin. + = 2.3.3 - 2024-01-12 = - More fixes related to admin notices. Sorry. diff --git a/wp-tweaks.php b/wp-tweaks.php index 03c5262..df043c4 100644 --- a/wp-tweaks.php +++ b/wp-tweaks.php @@ -3,7 +3,7 @@ * Plugin Name: WP Tweaks * Plugin URI: https://github.com/luizbills/wp-tweaks * Description: Several opinionated WordPress tweaks focused in security and performance. - * Version: 2.3.3 + * Version: 2.3.4 * Requires at least: 4.0 * Requires PHP: 7.4 * Author: Luiz Bills