From 9da1d8c9e48c93b6c36c04fc7048533cfee9fc0e Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Fri, 8 Sep 2017 16:35:55 -0700 Subject: [PATCH] PHPCS fixes --- includes/functions.php | 5 ++++- includes/run.php | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/functions.php b/includes/functions.php index 11c3a24..f667ff0 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -30,7 +30,9 @@ function schedule_cli_command( $command, $timestamp = null ) { return new WP_Error( 'invalid-timestamp', __( 'Timestamp is in the past.', 'wp-cli-cron-control-offload' ) ); } - $event_args = array( 'command' => $command ); + $event_args = array( + 'command' => $command, + ); $scheduled = wp_schedule_single_event( $timestamp, ACTION, $event_args ); @@ -59,6 +61,7 @@ function validate_command( $command ) { $first_command = explode( ' ', $command ); $first_command = array_shift( $first_command ); if ( ! is_command_allowed( $first_command ) ) { + /* translators: 1: Disallowed command */ return new WP_Error( 'blocked-command', sprintf( __( '`%1$s` not allowed', 'wp-cli-cron-control-offload' ), $first_command ) ); } diff --git a/includes/run.php b/includes/run.php index b6965a2..a5a5ac0 100644 --- a/includes/run.php +++ b/includes/run.php @@ -16,11 +16,13 @@ namespace Automattic\WP\WP_CLI_Cron_Control_Offload; function run_event( $command ) { if ( ! defined( 'WP_CLI' ) || ! \WP_CLI ) { // TODO: reschedule at least once or twice. + /* translators: 1: Plugin's prefix for log messages, 2. WP-CLI command that would have run */ trigger_error( sprintf( __( '%1$s: Attempted to run event without WP-CLI loaded. (%2$s)', 'wp-cli-cron-control-offload' ), MESSAGE_PREFIX, var_export( $command, true ) ), E_USER_WARNING ); return; } if ( ! validate_command( $command ) ) { + /* translators: 1: Plugin's prefix for log messages, 2. WP-CLI command that would have run */ trigger_error( sprintf( __( '%1$s: Attempted to run blocked WP-CLI command. (%2$s)', 'wp-cli-cron-control-offload' ), MESSAGE_PREFIX, var_export( $command, true ) ), E_USER_WARNING ); return; } @@ -37,6 +39,7 @@ function run_event( $command ) { // Command failed. if ( ! is_object( $output ) || is_wp_error( $output ) ) { + /* translators: 1: Plugin's prefix for log messages, 2. Command error that caused failure */ trigger_error( sprintf( __( '%1$s: WP-CLI command failed. (%2$s)', 'wp-cli-cron-control-offload' ), MESSAGE_PREFIX, var_export( $command, true ) ), E_USER_WARNING ); $message = is_wp_error( $output ) ? $output->get_error_message() : var_export( $output, true ); -- GitLab