X7ROOT File Manager
Current Path:
/opt/alt/php54/usr/share/pear/Symfony/Component/Validator/Constraints
opt
/
alt
/
php54
/
usr
/
share
/
pear
/
Symfony
/
Component
/
Validator
/
Constraints
/
??
..
??
AbstractComparison.php
(1.09 KB)
??
AbstractComparisonValidator.php
(2.22 KB)
??
All.php
(1.52 KB)
??
AllValidator.php
(1.14 KB)
??
Blank.php
(511 B)
??
BlankValidator.php
(775 B)
??
Callback.php
(1.61 KB)
??
CallbackValidator.php
(2.42 KB)
??
CardScheme.php
(699 B)
??
CardSchemeValidator.php
(3.97 KB)
??
Choice.php
(1.08 KB)
??
ChoiceValidator.php
(2.87 KB)
??
Collection
??
Collection.php
(2.73 KB)
??
CollectionValidator.php
(2.14 KB)
??
Count.php
(1.48 KB)
??
CountValidator.php
(1.82 KB)
??
Country.php
(520 B)
??
CountryValidator.php
(1.25 KB)
??
Currency.php
(522 B)
??
CurrencyValidator.php
(1.25 KB)
??
Date.php
(514 B)
??
DateTime.php
(522 B)
??
DateTimeValidator.php
(510 B)
??
DateValidator.php
(1.25 KB)
??
Email.php
(584 B)
??
EmailValidator.php
(1.98 KB)
??
EqualTo.php
(489 B)
??
EqualToValidator.php
(588 B)
??
Existence.php
(559 B)
??
Expression.php
(1.07 KB)
??
ExpressionValidator.php
(2.45 KB)
??
False.php
(511 B)
??
FalseValidator.php
(797 B)
??
File.php
(1.53 KB)
??
FileValidator.php
(6.11 KB)
??
GreaterThan.php
(497 B)
??
GreaterThanOrEqual.php
(516 B)
??
GreaterThanOrEqualValidator.php
(631 B)
??
GreaterThanValidator.php
(610 B)
??
GroupSequence.php
(630 B)
??
GroupSequenceProvider.php
(399 B)
??
Iban.php
(479 B)
??
IbanValidator.php
(1.92 KB)
??
IdenticalTo.php
(523 B)
??
IdenticalToValidator.php
(598 B)
??
Image.php
(1.91 KB)
??
ImageValidator.php
(5.64 KB)
??
Ip.php
(1.99 KB)
??
IpValidator.php
(2.64 KB)
??
Isbn.php
(1.29 KB)
??
IsbnValidator.php
(2.86 KB)
??
Issn.php
(578 B)
??
IssnValidator.php
(1.8 KB)
??
Language.php
(522 B)
??
LanguageValidator.php
(1.25 KB)
??
Length.php
(1.54 KB)
??
LengthValidator.php
(2.21 KB)
??
LessThan.php
(491 B)
??
LessThanOrEqual.php
(510 B)
??
LessThanOrEqualValidator.php
(625 B)
??
LessThanValidator.php
(604 B)
??
Locale.php
(518 B)
??
LocaleValidator.php
(1.24 KB)
??
Luhn.php
(476 B)
??
LuhnValidator.php
(1.9 KB)
??
NotBlank.php
(518 B)
??
NotBlankValidator.php
(766 B)
??
NotEqualTo.php
(496 B)
??
NotEqualToValidator.php
(597 B)
??
NotIdenticalTo.php
(530 B)
??
NotIdenticalToValidator.php
(604 B)
??
NotNull.php
(516 B)
??
NotNullValidator.php
(728 B)
??
Null.php
(509 B)
??
NullValidator.php
(929 B)
??
Optional.php
(404 B)
??
Range.php
(1.06 KB)
??
RangeValidator.php
(1.38 KB)
??
Regex.php
(2.39 KB)
??
RegexValidator.php
(1.24 KB)
??
Required.php
(404 B)
??
Time.php
(514 B)
??
TimeValidator.php
(1.21 KB)
??
True.php
(509 B)
??
TrueValidator.php
(821 B)
??
Type.php
(774 B)
??
TypeValidator.php
(1.39 KB)
??
Url.php
(560 B)
??
UrlValidator.php
(3.59 KB)
??
Valid.php
(907 B)
Editing: ImageValidator.php
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; /** * Validates whether a value is a valid image file and is valid * against minWidth, maxWidth, minHeight and maxHeight constraints * * @author Benjamin Dulau <benjamin.dulau@gmail.com> */ class ImageValidator extends FileValidator { /** * {@inheritDoc} */ public function validate($value, Constraint $constraint) { $violations = count($this->context->getViolations()); parent::validate($value, $constraint); $failed = count($this->context->getViolations()) !== $violations; if ($failed || null === $value || '' === $value) { return; } if (null === $constraint->minWidth && null === $constraint->maxWidth && null === $constraint->minHeight && null === $constraint->maxHeight && null === $constraint->minRatio && null === $constraint->maxRatio && $constraint->allowSquare && $constraint->allowLandscape && $constraint->allowPortrait) { return; } $size = @getimagesize($value); if (empty($size) || ($size[0] === 0) || ($size[1] === 0)) { $this->context->addViolation($constraint->sizeNotDetectedMessage); return; } $width = $size[0]; $height = $size[1]; if ($constraint->minWidth) { if (!ctype_digit((string) $constraint->minWidth)) { throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum width', $constraint->minWidth)); } if ($width < $constraint->minWidth) { $this->context->addViolation($constraint->minWidthMessage, array( '{{ width }}' => $width, '{{ min_width }}' => $constraint->minWidth )); return; } } if ($constraint->maxWidth) { if (!ctype_digit((string) $constraint->maxWidth)) { throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum width', $constraint->maxWidth)); } if ($width > $constraint->maxWidth) { $this->context->addViolation($constraint->maxWidthMessage, array( '{{ width }}' => $width, '{{ max_width }}' => $constraint->maxWidth )); return; } } if ($constraint->minHeight) { if (!ctype_digit((string) $constraint->minHeight)) { throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum height', $constraint->minHeight)); } if ($height < $constraint->minHeight) { $this->context->addViolation($constraint->minHeightMessage, array( '{{ height }}' => $height, '{{ min_height }}' => $constraint->minHeight )); return; } } if ($constraint->maxHeight) { if (!ctype_digit((string) $constraint->maxHeight)) { throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum height', $constraint->maxHeight)); } if ($height > $constraint->maxHeight) { $this->context->addViolation($constraint->maxHeightMessage, array( '{{ height }}' => $height, '{{ max_height }}' => $constraint->maxHeight )); } } $ratio = $width / $height; if (null !== $constraint->minRatio) { if (!is_numeric((string) $constraint->minRatio)) { throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum ratio', $constraint->minRatio)); } if ($ratio < $constraint->minRatio) { $this->context->addViolation($constraint->minRatioMessage, array( '{{ ratio }}' => $ratio, '{{ min_ratio }}' => $constraint->minRatio )); } } if (null !== $constraint->maxRatio) { if (!is_numeric((string) $constraint->maxRatio)) { throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum ratio', $constraint->maxRatio)); } if ($ratio > $constraint->maxRatio) { $this->context->addViolation($constraint->maxRatioMessage, array( '{{ ratio }}' => $ratio, '{{ max_ratio }}' => $constraint->maxRatio )); } } if (!$constraint->allowSquare && $width == $height) { $this->context->addViolation($constraint->allowSquareMessage, array( '{{ width }}' => $width, '{{ height }}' => $height )); } if (!$constraint->allowLandscape && $width > $height) { $this->context->addViolation($constraint->allowLandscapeMessage, array( '{{ width }}' => $width, '{{ height }}' => $height )); } if (!$constraint->allowPortrait && $width < $height) { $this->context->addViolation($constraint->allowPortraitMessage, array( '{{ width }}' => $width, '{{ height }}' => $height )); } } }
Upload File
Create Folder