You are here

protected function AvailabilityCalendarsStylesFormValidator::validateLengthValue in Availability Calendars 6.2

Same name and namespace in other branches
  1. 7.2 availability_calendars.styles.inc \AvailabilityCalendarsStylesFormValidator::validateLengthValue()

Check for a CSS length declaration: We check for a part of http://www.w3.org/TR/CSS21/syndata.html#numbers and http://www.w3.org/TR/CSS21/syndata.html#length-units:

  • only non-signed pixel values are allowed

Parameters

string $value:

Return value

boolean

1 call to AvailabilityCalendarsStylesFormValidator::validateLengthValue()
AvailabilityCalendarsStylesFormValidator::lengthField in ./availability_calendars.styles.inc

File

./availability_calendars.styles.inc, line 414

Class

AvailabilityCalendarsStylesFormValidator

Code

protected function validateLengthValue($value) {
  $pattern = '/^(\\d*\\.)?\\d+(px)?$/';
  return preg_match($pattern, $value) === 1;
}