validator elfinder max size file

@param $attribute
@param $value
@param $parameters
@param $validator
@return bool
765797
public function validateElfinderMax($attribute, $value, $parameters, $validator)
    {
        $size = $parameters[0] * 1024; // parameters kB to B
        if ( File::size($value) > $size ) {
            return false;
        }
        return true;
    }
144836
protected function validateDigits($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'digits');

        return $this->validateNumeric($attribute, $value)
            && strlen((string) $value) == $parameters[0];
    }
326943
protected function validateAfter($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'after');

        if ($format = $this->getDateFormat($attribute)) {
            return $this->validateAfterWithFormat($format, $value, $parameters);
        }

        if (!($date = strtotime($parameters[0]))) {
            return strtotime($value) > strtotime($this->getValue($parameters[0]));
        } else {
            return strtotime($value) > $date;
        }
    }
505852
protected function validateBefore($attribute, $value, $parameters)
	{
		if ( ! ($date = strtotime($parameters[0])))
		{
			return strtotime($value) < strtotime($this->getValue($parameters[0]));
		}
		else
		{
			return strtotime($value) < $date;
		}
	}
360369
protected function validateIsbn($attribute, $value, $parameters)
    {
        // Prepare value for validation
        $value = str_replace([' ', '-', '‐', '.'], '', $value);

        // Length of value
        $length = strlen($value);

        // Validate either ISBN10 or ISBN13
        if ($length == 10) {
            return $this->validateIsbn10($attribute, $value, $parameters);
        } elseif ($length == 13) {
            return $this->validateIsbn13($attribute, $value, $parameters);
        }

        return false;
    }
279033
public function passes($attribute, $value, $parameters, $validator)
    {
        return Str::is(Str::lower($parameters[0]), Str::lower(parse_url($value, PHP_URL_PATH)));
    }
892091
protected function validateRegex($attribute, $value, $parameters)
    {
        if (! is_string($value) && ! is_numeric($value)) {
            return false;
        }

        $this->requireParameterCount(1, $parameters, 'regex');

        return preg_match($parameters[0], $value);
    }
1183229
public function validateClamav($attribute, $value, $parameters)
    {
        $file = $this->getFilePath($value);
        $clamavSocket = $this->getClamavSocket();

        // Create a new socket instance
        $socket = (new Factory())->createClient($clamavSocket);

        // Create a new instance of the Client
        $quahog = new Client($socket, self::CLAMAV_SOCKET_READ_TIMEOUT, PHP_NORMAL_READ);

        // Check if the file is readable
        if (! is_readable($file)) {
            throw new ClamavValidatorException(sprintf('The file "%s" is not readable', $file));
        }

        // Scan the file
        $result = $quahog->scanResourceStream(fopen($file, 'rb'));

        if (self::CLAMAV_STATUS_ERROR === $result['status']) {
            throw new ClamavValidatorException($result['reason']);
        }

        // Check if scan result is not clean
        return !(self::CLAMAV_STATUS_OK !== $result['status']);
    }
152990
protected function compareDates($attribute, $value, $parameters, $operator)
    {
        if (! is_string($value) && ! is_numeric($value) && ! $value instanceof DateTimeInterface) {
            return false;
        }

        if ($format = $this->getDateFormat($attribute)) {
            return $this->checkDateTimeOrder($format, $value, $parameters[0], $operator);
        }

        if (! $date = $this->getDateTimestamp($parameters[0])) {
            $date = $this->getDateTimestamp($this->getValue($parameters[0]));
        }

        return $this->compare($this->getDateTimestamp($value), $date, $operator);
    }
739438
protected function validateDateFormat( $attribute, $value, $parameters )
	{
		$this->requireParameterCount( 1, $parameters, 'date_format' );

		if ( !is_string( $value ) && !is_numeric( $value ) )
		{
			return false;
		}

		$parsed = date_parse_from_format( $parameters[0], $value );

		return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0;
	}
1343485
public function validateMimetypes($attribute, $value, $parameters)
    {
        if (! $this->isValidFileInstance($value)) {
            return false;
        }

        if ($this->shouldBlockPhpUpload($value, $parameters)) {
            return false;
        }

        return $value->getPath() !== '' &&
                (in_array($value->getMimeType(), $parameters) ||
                 in_array(explode('/', $value->getMimeType())[0].'/*', $parameters));
    }
788334
protected function validateIsbn10($attribute, $value, $parameters)
    {
        // Prepare value for validation
        $value = str_replace([' ', '-', '‐', '.'], '', $value);

        // Make sure value is exactly 10 characters
        //
        // Sometimes an ISBN10 number can end on an "X". Therefore we
        // only validate the first 9 characeters as numeric.
        if (strlen($value) != 10 || ! is_numeric(substr($value, -10, 9))) {
            return false;
        }

        // Grab "check digit" for later use
        // Also handle when "X" is the "check digit" instead of an integer
        $checkDigit = substr($value, -1);
        $checkDigit = (strtoupper($checkDigit) == 'X') ? 10 : $checkDigit;

        // Generate checksum
        $sum = 0;
        for ($i = 0; $i < 9; $i++) {
            $sum += ($value[$i] * (10 - $i));
        }

        // Add "check digit" to checksum
        $sum += $checkDigit;

        // Verify checksum
        return ($sum % 11) == 0;
    }
1155221
protected function validateDateFormat($attribute, $value, $parameters)
	{
		$parsed = date_parse_from_format($parameters[0], $value);

		return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0;
	}
692707
public function validateRequiredWithoutAll($attribute, $value, $parameters)
    {
        if ($this->allFailingRequired($parameters)) {
            return $this->validateRequired($attribute, $value);
        }

        return true;
    }
164695
public function validateBeforeOrEqual($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'before_or_equal');

        return $this->compareDates($attribute, $value, $parameters, '<=');
    }
431613
public function validateSweetcaptcha($attribute, $value, $parameters)
    {

        if (Input::has('scvalue'))
        {	
        	$sweetcaptcha = app()->make('SweetCaptcha');        	
        	return $sweetcaptcha->check(array('sckey' => $value, 'scvalue' => Input::get('scvalue'))) == "true";
    	}
    	else
    		return false;
    }
535016
public function validateNameOnCreate($attribute, $value, $parameters)
    {
        $groupId = Input::get('group');
        $typeId  = Input::get('type');
        $exists  = Foundation::make('antares.customfields.model.view')
                ->query()
                ->where('group_id', $groupId)
                ->where('type_id', $typeId)
                ->where('name', $value)
                ->exists();
        if ($exists) {
            $this->setCustomMessages(['name-on-create' => trans('antares/customfields::validator.create.name-non-unique')]);
            $this->addFailure($attribute, 'name-on-create', []);
            return false;
        }


        return true;
    }