HEX
Server: LiteSpeed
System: Linux baran.dnsprotection.me 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: ddir12 (3618)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: /home/ddir12/up/elementor-pro/modules/atomic-form/file-upload/validators/max-count-validator.php
<?php
namespace ElementorPro\Modules\AtomicForm\File_Upload\Validators;

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

class Max_Count_Validator implements Validator {

	private int $max;

	public function __construct( int $max ) {
		$this->max = $max;
	}

	public function validate( array $files ): ?string {
		if ( $this->max <= 0 || count( $files ) <= $this->max ) {
			return null;
		}

		return sprintf(
			/* translators: %d: maximum number of files. */
			_n( 'You can upload only %d file.', 'You can upload only %d files.', $this->max, 'elementor-pro' ),
			$this->max
		);
	}
}