<?php
/**
 * Email Template (Plain Text): Two-Factor Authentication Code
 *
 * This template can be overridden by copying it to:
 * your-theme/guard-dog/emails/plain/two-factor-code-plain.php
 *
 * Available variables:
 * @var string $code The 6-digit verification code
 * @var WP_User $user The user object
 * @var string $site_name The site name
 * @var int $expiry_minutes Code expiration time in minutes (default: 10)
 *
 * @package GuardDog
 * @since 1.8.5
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
// $expiry_minutes is a local variable in a template file, not a global variable
// The Plugin Checker incorrectly flags local template variables as globals
// This variable is scoped to this template file and does not pollute the global namespace

// Set default expiry if not provided
if ( ! isset( $expiry_minutes ) ) {
	$expiry_minutes = 10;
}
// phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound

// Translators: %s is the site name.
echo esc_html( sprintf( __( '[%s] Two-Factor Authentication Code', 'guard-dog' ), $site_name ) );
echo "\n";
echo esc_html( str_repeat( '=', 60 ) );
echo "\n\n";

// Translators: %s is the user's display name.
echo esc_html( sprintf( __( 'Hello %s,', 'guard-dog' ), $user->display_name ) );
echo "\n\n";

echo esc_html__( 'You have requested a two-factor authentication code to log in to your account.', 'guard-dog' );
echo "\n\n";

echo esc_html__( 'Your Verification Code:', 'guard-dog' );
echo "\n\n";
echo '    ' . esc_html( $code );
echo "\n\n";

echo esc_html( sprintf(
	// Translators: %d is the expiration time in minutes.
	_n( 
		'This code will expire in %d minute.', 
		'This code will expire in %d minutes.', 
		$expiry_minutes, 
		'guard-dog' 
	), 
	$expiry_minutes 
) );
echo "\n\n";

echo esc_html__( 'Security Notice:', 'guard-dog' );
echo "\n";
echo esc_html__( 'If you did not request this code, please ignore this email and consider changing your password.', 'guard-dog' );
echo "\n\n";

echo esc_html( str_repeat( '-', 60 ) );
echo "\n";
// Translators: %s is the site name.
echo esc_html( sprintf( __( 'This email was sent from %s', 'guard-dog' ), $site_name ) );
echo "\n";
echo esc_html__( 'Please do not reply to this email.', 'guard-dog' );
echo "\n";

