diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 4bfed75..cdc7dec 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -42,23 +42,26 @@ jobs: # See the following for PHP compatibility of WordPress versions: # https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ matrix: - wp: - # Three most recent versions of WordPress - - '6.9' - - '6.8' - - '6.7' - php: - # Most recent version of PHP supported by all of the above, plus 7.4 - - '8.4' - - '7.4' include: - # Latest WordPress on latest PHP - # - wp: '6.9' - # php: '8.5' - # Oldest supported WordPress on its newest supported PHP, plus 7.4: - - wp: '6.4' + # Latest: + - wp: '7.0' + php: '8.5' + - wp: '7.0' + php: '7.4' + # Latest -1: + - wp: '6.9' + php: '8.5' + - wp: '6.9' + php: '7.4' + # Latest -2: + - wp: '6.8' + php: '8.4' + - wp: '6.8' + php: '7.4' + # Oldest supported: + - wp: '6.5' php: '8.3' - - wp: '6.4' + - wp: '6.5' php: '7.4' fail-fast: false uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-acceptance-tests.yml@99fbf371962704dbaef452ebe7ea188d5cfb8069 # 2.9.4 diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 07d77b8..bf9fc6f 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -45,23 +45,26 @@ jobs: # See the following for PHP compatibility of WordPress versions: # https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ matrix: - wp: - # Three most recent versions of WordPress - - '6.9' - - '6.8' - - '6.7' - php: - # Most recent version of PHP supported by all of the above, plus 7.4 - - '8.4' - - '7.4' include: - # Latest WordPress on latest PHP + # Latest: + - wp: '7.0' + php: '8.5' + - wp: '7.0' + php: '7.4' + # Latest -1: - wp: '6.9' php: '8.5' - # Oldest supported WordPress on its newest supported PHP, plus 7.4: - - wp: '6.4' + - wp: '6.9' + php: '7.4' + # Latest -2: + - wp: '6.8' + php: '8.4' + - wp: '6.8' + php: '7.4' + # Oldest supported: + - wp: '6.5' php: '8.3' - - wp: '6.4' + - wp: '6.5' php: '7.4' fail-fast: false with: diff --git a/composer.json b/composer.json index 66787ff..ec88f3a 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "require-dev": { "johnbillion/plugin-infrastructure": "2.9.4", "johnbillion/wp-compat": "1.4.0", - "php-stubs/wordpress-stubs": "6.9.0", + "php-stubs/wordpress-stubs": "7.0.0 as 6.9.4", "phpcompatibility/phpcompatibility-wp": "2.1.8", "phpstan/phpstan": "2.1.33", "szepeviktor/phpstan-wordpress": "2.0.3", @@ -78,7 +78,7 @@ "phpcbf -nps --colors --report-code --report-summary --report-width=80 --basepath=./ ." ], "test:phpstan": [ - "phpstan analyze -v --memory-limit=1024M" + "phpstan analyze -v --memory-limit=2G" ], "test:start": [ "tests-start" diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 9bcaf6f..ce65a33 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -2,7 +2,7 @@ - + diff --git a/readme.txt b/readme.txt index d1ba454..ee1cb0d 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: johnbillion, scompt Tags: cron, wp-cron, crontrol, debug, woocommerce -Tested up to: 6.9 +Tested up to: 7.0 Stable tag: 1.21.0 License: GPL v2 or later Donate link: https://github.com/sponsors/johnbillion diff --git a/src/bootstrap.php b/src/bootstrap.php index 9c4f72c..a3eff8b 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -1205,12 +1205,15 @@ function admin_options_page() { $hook = wp_unslash( $_GET['crontrol_name'] ); $message = intval( $_GET['crontrol_message'] ); - printf( - '

%2$s

', - esc_attr( $messages[ $message ][1] ), + wp_admin_notice( sprintf( esc_html( $messages[ $message ][0] ), '' . esc_html( $hook ) . '' + ), + array( + 'id' => 'crontrol-message', + 'type' => $messages[ $message ][1], + 'dismissible' => true, ) ); } @@ -1399,46 +1402,48 @@ function show_cron_status() { } if ( 'UTC' !== date_default_timezone_get() ) { - ?> -
- %1$s

%3$s

', + wp_admin_notice( + sprintf( + '%1$s

%3$s', esc_html__( 'PHP default timezone is not set to UTC. This may cause issues with cron event timings.', 'wp-crontrol' ), 'https://wp-crontrol.com/help/php-default-timezone/', esc_html__( 'More information', 'wp-crontrol' ) - ); - ?> -
- 'crontrol-timezone-warning', + 'type' => 'warning', + ) + ); } $status = test_cron_spawn(); if ( is_wp_error( $status ) ) { if ( 'crontrol_info' === $status->get_error_code() ) { - ?> -
-

get_error_message() ); ?>

-
- get_error_message() ), + array( + 'id' => 'crontrol-status-notice', + 'type' => 'info', + ) + ); } else { - ?> -
- %1$s

%3$s

', + wp_admin_notice( + sprintf( + '%1$s

%3$s', sprintf( /* translators: %s: Error message text. */ esc_html__( 'There was a problem spawning a call to the WP-Cron system on your site. This means WP-Cron events on your site may not work. The problem was: %s', 'wp-crontrol' ), - '

' . esc_html( $status->get_error_message() ) . '' + '

' . esc_html( $status->get_error_message() ) . '' ), 'https://wp-crontrol.com/help/problems-spawning-wp-cron/', esc_html__( 'More information', 'wp-crontrol' ) - ); - ?> -

- 'crontrol-status-error', + 'type' => 'error', + ) + ); } } } @@ -1587,19 +1592,16 @@ function show_cron_form( $editing ) {
-
-

-
%2$s', + sprintf( /* translators: %s: The name of the cron event. */ esc_html__( 'The %s event you are trying to edit does not exist.', 'wp-crontrol' ), '' . esc_html( $edit_id ) . '' - ); - ?> -

-

- Click here to see if it was rescheduled.', 'wp-crontrol' ), @@ -1611,10 +1613,14 @@ function show_cron_form( $editing ) { 'href' => array(), ), ) - ); - ?> -

-
+ ) + ), + array( + 'id' => 'crontrol-event-not-found', + 'type' => 'error', + ) + ); + ?>
integrity_failed() ) { - printf( - '

%1$s

%3$s

', - esc_html__( 'The URL in this event needs to be checked for integrity. This event will not run until you re-save it.', 'wp-crontrol' ), - 'https://wp-crontrol.com/help/check-cron-events/', - esc_html__( 'Read what to do', 'wp-crontrol' ) + wp_admin_notice( + sprintf( + '%1$s

%3$s', + esc_html__( 'The URL in this event needs to be checked for integrity. This event will not run until you re-save it.', 'wp-crontrol' ), + 'https://wp-crontrol.com/help/check-cron-events/', + esc_html__( 'Read what to do', 'wp-crontrol' ) + ), + array( + 'type' => 'error', + 'additional_classes' => array( 'inline' ), + ) ); } ?> @@ -1832,11 +1844,17 @@ function show_cron_form( $editing ) { integrity_failed() ) { - printf( - '

%1$s

%3$s

', - esc_html__( 'The PHP code in this event needs to be checked for integrity. This event will not run until you re-save it.', 'wp-crontrol' ), - 'https://wp-crontrol.com/help/check-cron-events/', - esc_html__( 'Read what to do', 'wp-crontrol' ) + wp_admin_notice( + sprintf( + '%1$s

%3$s', + esc_html__( 'The PHP code in this event needs to be checked for integrity. This event will not run until you re-save it.', 'wp-crontrol' ), + 'https://wp-crontrol.com/help/check-cron-events/', + esc_html__( 'Read what to do', 'wp-crontrol' ) + ), + array( + 'type' => 'error', + 'additional_classes' => array( 'inline' ), + ) ); } ?> @@ -1898,13 +1916,19 @@ function show_cron_form( $editing ) { has_invalid_args() ) { - printf( - '

%1$s

%2$s

', - esc_html__( 'This event has invalid arguments and will not run correctly.', 'wp-crontrol' ), + wp_admin_notice( sprintf( - /* translators: %s: The PHP type of the invalid value */ - esc_html__( 'Arguments should be an array but %s was provided. The event will likely fail with a PHP error when it attempts to run.', 'wp-crontrol' ), - esc_html( gettype( $existing->args ) ) + '%1$s

%2$s', + esc_html__( 'This event has invalid arguments and will not run correctly.', 'wp-crontrol' ), + sprintf( + /* translators: %s: The PHP type of the invalid value */ + esc_html__( 'Arguments should be an array but %s was provided. The event will likely fail with a PHP error when it attempts to run.', 'wp-crontrol' ), + esc_html( gettype( $existing->args ) ) + ) + ), + array( + 'type' => 'error', + 'additional_classes' => array( 'inline' ), ) ); } @@ -2108,7 +2132,6 @@ function admin_manage_page() { if ( isset( $_GET['crontrol_name'], $_GET['crontrol_message'], $messages[ $_GET['crontrol_message'] ] ) ) { $hook = wp_unslash( $_GET['crontrol_name'] ); $message = intval( $_GET['crontrol_message'] ); - $link = ''; if ( MESSAGE_UNKNOWN_ERROR === $message ) { $error = get_message(); @@ -2118,15 +2141,16 @@ function admin_manage_page() { } } - printf( - '

%2$s%3$s

', - esc_attr( $messages[ $message ][1] ), + wp_admin_notice( sprintf( esc_html( $messages[ $message ][0] ), '' . esc_html( $hook ) . '' ), - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - $link + array( + 'id' => 'crontrol-message', + 'type' => $messages[ $message ][1], + 'dismissible' => true, + ) ); } diff --git a/src/event-list-table.php b/src/event-list-table.php index 00d4f5e..9e81b22 100644 --- a/src/event-list-table.php +++ b/src/event-list-table.php @@ -101,11 +101,17 @@ public function prepare_items() { add_action( 'admin_notices', function () { - printf( - '

%1$s

%3$s

', - esc_html__( 'One or more of your cron events needs to be checked for integrity. These events will not run until you check and re-save them.', 'wp-crontrol' ), - 'https://wp-crontrol.com/help/check-cron-events/', - esc_html__( 'Read what to do', 'wp-crontrol' ) + wp_admin_notice( + sprintf( + '%1$s

%3$s', + esc_html__( 'One or more of your cron events needs to be checked for integrity. These events will not run until you check and re-save them.', 'wp-crontrol' ), + 'https://wp-crontrol.com/help/check-cron-events/', + esc_html__( 'Read what to do', 'wp-crontrol' ) + ), + array( + 'id' => 'crontrol-integrity-failures-message', + 'type' => 'error', + ) ); } ); diff --git a/wp-crontrol.php b/wp-crontrol.php index 903d2f1..a32746a 100644 --- a/wp-crontrol.php +++ b/wp-crontrol.php @@ -8,7 +8,7 @@ * Version: 1.21.0 * Text Domain: wp-crontrol * Domain Path: /languages/ - * Requires at least: 6.4 + * Requires at least: 6.5 * Requires PHP: 7.4 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html * License: GPL v2 or later