* @since 3.0.0 */ namespace Beyondwords\Wordpress\Component\Posts\BulkEdit; /** * Notices * * @since 4.5.0 */ class Notices { /** * Constructor * * @since 6.0.0 Make static. */ public static function init() { add_action('admin_notices', [self::class, 'generatedNotice']); add_action('admin_notices', [self::class, 'deletedNotice']); add_action('admin_notices', [self::class, 'failedNotice']); add_action('admin_notices', [self::class, 'errorNotice']); } /** * Generated audio notice. * * @since 4.1.0 * @since 6.0.0 Make static. */ public static function generatedNotice() { if ( ! isset($_GET['beyondwords_bulk_edit_result_nonce']) || ! isset($_GET['beyondwords_bulk_generated']) ) { return; } if (! wp_verify_nonce(sanitize_key($_GET['beyondwords_bulk_edit_result_nonce']), 'beyondwords_bulk_edit_result')) { // phpcs:ignore Generic.Files.LineLength.TooLong wp_nonce_ays(''); } $count = intval(sanitize_text_field(wp_unslash($_GET['beyondwords_bulk_generated']))); if ($count) { $message = sprintf( /* translators: %d is replaced with the number of posts processed */ _n( 'Audio was requested for %d post.', 'Audio was requested for %d posts.', $count, 'speechkit' ), $count ); ?>