<?php
/**
 * EXAMPLE: Customized Two-Factor Authentication Code Email (Plain Text)
 *
 * This is an example of how you might customize the plain text version
 * of the two-factor authentication code email.
 *
 * To use this example:
 * 1. Copy this file to: your-theme/guard-dog/emails/plain/two-factor-code-plain.php
 * 2. Customize the text content to match your brand voice
 * 3. The plugin will automatically use your customized version
 *
 * 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
// These are local variables in a template file, not global variables
// The Plugin Checker incorrectly flags local template variables as globals
// These variables are scoped to this template file and do not pollute the global namespace

// Set default expiry if not provided
if ( ! isset( $expiry_minutes ) ) {
	$expiry_minutes = 10;
}

// Example: Get support email from settings
$support_email = get_option( 'admin_email' );
// phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound

echo esc_html( str_repeat( '=', 70 ) );
echo "\n";
// Translators: %s is the site name.
echo esc_html( sprintf( __( '%s - SECURITY VERIFICATION CODE', 'guard-dog' ), strtoupper( $site_name ) ) );
echo "\n";
echo esc_html( str_repeat( '=', 70 ) );
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__( 'We received a request to verify your identity. Please use the verification', 'guard-dog' );
echo "\n";
echo esc_html__( 'code below to complete your login:', 'guard-dog' );
echo "\n\n";

echo esc_html( str_repeat( '-', 70 ) );
echo "\n";
echo esc_html__( 'YOUR VERIFICATION CODE:', 'guard-dog' );
echo "\n\n";
echo '        ' . esc_html( $code );
echo "\n";
echo esc_html( str_repeat( '-', 70 ) );
echo "\n\n";

echo esc_html__( 'QUICK TIPS:', 'guard-dog' );
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";

echo '  • ' . esc_html__( 'Enter the code exactly as shown above', 'guard-dog' );
echo "\n";

echo '  • ' . esc_html__( 'Do not share this code with anyone', 'guard-dog' );
echo "\n\n";

echo esc_html( str_repeat( '!', 70 ) );
echo "\n";
echo esc_html__( 'SECURITY NOTICE:', 'guard-dog' );
echo "\n";
echo esc_html__( 'If you did not attempt to log in, please ignore this email and consider', 'guard-dog' );
echo "\n";
echo esc_html__( 'changing your password immediately.', 'guard-dog' );
echo "\n";
echo esc_html( str_repeat( '!', 70 ) );
echo "\n\n";

// Support information
if ( $support_email ) {
	echo esc_html__( 'NEED HELP?', 'guard-dog' );
	echo "\n";
	// Translators: %s is the support email address.
	echo esc_html( sprintf( __( 'Contact us at: %s', 'guard-dog' ), $support_email ) );
	echo "\n\n";
}

// Footer
echo esc_html( str_repeat( '-', 70 ) );
echo "\n";
echo esc_html( $site_name );
echo "\n";
echo esc_html( home_url() );
echo "\n";
if ( $support_email ) {
	echo esc_html( $support_email );
	echo "\n";
}
echo "\n";
echo esc_html__( 'This is an automated security email. Please do not reply to this message.', 'guard-dog' );
echo "\n";
// Translators: %1$s is the current year, %2$s is the site name.
echo esc_html( sprintf( __( '© %1$s %2$s. All rights reserved.', 'guard-dog' ), gmdate( 'Y' ), $site_name ) );
echo "\n";
echo esc_html( str_repeat( '=', 70 ) );
echo "\n";

