<?php
/**
 * Error Message Settings
 *
 * @package EASYFUA
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

	$lang        = easyfua_lang();
	$option_name = 'easyfua_settings' . $lang;
	$settings    = get_option( $option_name );
?>
	<h2><?php esc_html_e( 'Error Messages', 'easy-file-upload-approval' ); ?></h2>
	<table class="form-table">
		<tbody>
			<tr valign="top">
				<th scope="row"><?php esc_html_e( 'Required', 'easy-file-upload-approval' ); ?></th>
				<td>
					<input type="text"
					name="<?php echo esc_attr( $option_name ); ?>[error_required]"
					class="regular-text"
					placeholder="<?php esc_attr_e( 'Please upload a file before submitting.', 'easy-file-upload-approval' ); ?>"
					value="<?php echo esc_attr( easyfua_settings( 'error_required' ) ); ?>">
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php esc_html_e( 'File exceeds server limit', 'easy-file-upload-approval' ); ?></th>
				<td>
					<input type="text"
					name="<?php echo esc_attr( $option_name ); ?>[error_server_limit]"
					class="regular-text"
					placeholder="<?php esc_attr_e( 'The uploaded file exceeds the maximum upload size of your server.', 'easy-file-upload-approval' ); ?>"
					value="<?php echo esc_attr( easyfua_settings( 'error_server_limit' ) ); ?>">
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php esc_html_e( 'Failed to Upload', 'easy-file-upload-approval' ); ?></th>
				<td>
					<input type="text"
					name="<?php echo esc_attr( $option_name ); ?>[error_failed_to_upload]"
					class="regular-text"
					placeholder="<?php esc_attr_e( 'Uploading a file fails for any reason', 'easy-file-upload-approval' ); ?>"
					value="<?php echo esc_attr( easyfua_settings( 'error_failed_to_upload' ) ); ?>">
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php esc_html_e( 'Files too large', 'easy-file-upload-approval' ); ?></th>
				<td>
					<input type="text"
					name="<?php echo esc_attr( $option_name ); ?>[error_files_too_large]"
					class="regular-text"
					placeholder="<?php esc_attr_e( 'Uploaded file is too large', 'easy-file-upload-approval' ); ?>"
					value="<?php echo esc_attr( easyfua_settings( 'error_files_too_large' ) ); ?>">
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php esc_html_e( 'Invalid file Type', 'easy-file-upload-approval' ); ?></th>
				<td>
					<input type="text"
					name="<?php echo esc_attr( $option_name ); ?>[error_invalid_file]"
					class="regular-text"
					placeholder="<?php esc_attr_e( 'Uploaded file is not allowed for file type', 'easy-file-upload-approval' ); ?>"
					value="<?php echo esc_attr( easyfua_settings( 'error_invalid_file' ) ); ?>"></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php esc_html_e( 'Minimum File', 'easy-file-upload-approval' ); ?></th>
				<td>
					<input type="text"
					name="<?php echo esc_attr( $option_name ); ?>[error_min_file]"
					class="regular-text"
					value="<?php echo esc_attr( easyfua_settings( 'error_min_file' ) ); ?>"
					placeholder="<?php esc_attr_e( 'The minimum file upload is', 'easy-file-upload-approval' ); ?>">
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php esc_html_e( 'Max File Limit', 'easy-file-upload-approval' ); ?></th>
				<td>
					<input type="text"
					name="<?php echo esc_attr( $option_name ); ?>[error_max_file]"
					class="regular-text"
					value="<?php echo esc_attr( easyfua_settings( 'error_max_file' ) ); ?>">
					<p class="description">
						<?php
							// translators: %count% will be replaced by total number of files.
							esc_html_e( 'Default: `Note : Some of the files are not uploaded ( Only %count% files allowed )`', 'easy-file-upload-approval' );
						?>
					</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php esc_html_e( 'Upload Restriction', 'easy-file-upload-approval' ); ?></th>
				<td>
					<input <?php disabled( easyfua_settings( 'login_required' ) !== 'yes' ); ?>
					type="text"
					name="<?php echo esc_attr( $option_name ); ?>[error_upload_restriction]"
					class="regular-text"
					value="<?php echo esc_attr( easyfua_settings( 'error_upload_restriction' ) ); ?>"
					placeholder="<?php esc_attr_e( 'You are not allowed to upload files.', 'easy-file-upload-approval' ); ?>">
					<p class="description">
						<?php esc_html_e( 'This error appears if the user is required to log in before uploading files.', 'easy-file-upload-approval' ); ?>
					</p>
				</td>
			</tr>

			<?php if ( easyfua_fs()->is__premium_only() && easyfua_is_premium() ) : ?>
				<tr valign="top">
					<th colspan="2" style="padding:0 0;">
						<p class="description">Note: %s will be replace by number according to the value specified in Options.</p>
					</th>
				</tr>
				<tr valign="top">
					<th scope="row"><?php esc_html_e( 'Max Number of Files', 'easy-file-upload-approval' ); ?></th>
					<td>
						<input type="text"
						name="<?php echo esc_attr( $option_name ); ?>[error_max_files]"
						class="regular-text"
						value="<?php echo esc_attr( easyfua_settings( 'error_max_files' ) ); ?>"
						placeholder="<?php esc_attr_e( 'Please enter error message.', 'easy-file-upload-approval' ); ?>">
						<p class="description"><?php esc_html_e( 'default: "You have reached the maximum number of files ( Only %s files allowed )"', 'easy-file-upload-approval' ); ?></p>
					</td>
				</tr>
				<tr valign="top">
					<th scope="row"><?php esc_html_e( 'Total Size Limit', 'easy-file-upload-approval' ); ?></th>
					<td>
						<input type="text"
						name="<?php echo esc_attr( $option_name ); ?>[error_size_limit]"
						class="regular-text"
						value="<?php echo esc_attr( easyfua_settings( 'error_size_limit' ) ); ?>"
						placeholder="<?php esc_attr_e( 'Please enter error message.', 'easy-file-upload-approval' ); ?>">
						<p class="description"><?php esc_html_e( 'default: "The total file(s) size exceeding the max size limit of %s."', 'easy-file-upload-approval' ); ?></p>
					</td>
				</tr>
			<?php endif; ?>

		</tbody>
	</table>