MediaWiki
1.28.0
|
This contains some static methods for validating XMP properties. More...
Public Member Functions | |
__construct (LoggerInterface $logger) | |
setLogger (LoggerInterface $logger) | |
validateBoolean ($info, &$val, $standalone) | |
Function to validate boolean properties ( True or False ) More... | |
validateClosed ($info, &$val, $standalone) | |
function to validate properties with a fixed number of allowed choices. More... | |
validateDate ($info, &$val, $standalone) | |
function to validate date properties, and convert to (partial) Exif format. More... | |
validateFlash ($info, &$val, $standalone) | |
function to validate and modify flash structure More... | |
validateGPS ($info, &$val, $standalone) | |
function to validate, and more importantly translate the XMP DMS form of gps coords to the decimal form we use. More... | |
validateInteger ($info, &$val, $standalone) | |
function to validate integers More... | |
validateLangCode ($info, &$val, $standalone) | |
function to validate LangCode properties ( en-GB, etc ) More... | |
validateRating ($info, &$val, $standalone) | |
function to validate rating properties -1, 0-5 More... | |
validateRational ($info, &$val, $standalone) | |
function to validate rational properties ( 12/10 ) More... | |
Private Attributes | |
LoggerInterface | $logger |
This contains some static methods for validating XMP properties.
See XMPInfo and XMPReader classes.
Each of these functions take the same parameters
It should be noted that when an array is being validated, typically the validation function is called once for each value, and then once at the end for the entire array.
These validation functions can also be used to modify the data. See the gps and flash one's for example.
Definition at line 46 of file XMPValidate.php.
XMPValidate::__construct | ( | LoggerInterface | $logger | ) |
Definition at line 53 of file XMPValidate.php.
References setLogger().
XMPValidate::setLogger | ( | LoggerInterface | $logger | ) |
XMPValidate::validateBoolean | ( | $info, | |
& | $val, | ||
$standalone | |||
) |
Function to validate boolean properties ( True or False )
array | $info | Information about current property |
mixed | &$val | Current value to validate |
bool | $standalone | If this is a simple property or array |
Definition at line 67 of file XMPValidate.php.
XMPValidate::validateClosed | ( | $info, | |
& | $val, | ||
$standalone | |||
) |
function to validate properties with a fixed number of allowed choices.
(closed choice)
array | $info | Information about current property |
mixed | &$val | Current value to validate |
bool | $standalone | If this is a simple property or array |
Definition at line 164 of file XMPValidate.php.
XMPValidate::validateDate | ( | $info, | |
& | $val, | ||
$standalone | |||
) |
function to validate date properties, and convert to (partial) Exif format.
Dates can be one of the following formats: YYYY YYYY-MM YYYY-MM-DD YYYY-MM-DDThh:mmTZD YYYY-MM-DDThh:mm:ssTZD YYYY-MM-DDThh:mm:ss.sTZD
array | $info | Information about current property |
mixed | &$val | Current value to validate. Converts to TS_EXIF as a side-effect. in cases where there's only a partial date, it will give things like 2011:04. |
bool | $standalone | If this is a simple property or array |
Definition at line 258 of file XMPValidate.php.
References $res, ConvertibleTimestamp\convert(), TS_EXIF, and TS_UNIX.
XMPValidate::validateFlash | ( | $info, | |
& | $val, | ||
$standalone | |||
) |
function to validate and modify flash structure
array | $info | Information about current property |
mixed | &$val | Current value to validate |
bool | $standalone | If this is a simple property or array |
Definition at line 194 of file XMPValidate.php.
XMPValidate::validateGPS | ( | $info, | |
& | $val, | ||
$standalone | |||
) |
function to validate, and more importantly translate the XMP DMS form of gps coords to the decimal form we use.
array | $info | Unused (info about prop) |
string | &$val | GPS string in either DDD,MM,SSk or or DDD,MM.mmk form |
bool | $standalone | If its a simple prop (should always be true) |
Definition at line 361 of file XMPValidate.php.
XMPValidate::validateInteger | ( | $info, | |
& | $val, | ||
$standalone | |||
) |
function to validate integers
array | $info | Information about current property |
mixed | &$val | Current value to validate |
bool | $standalone | If this is a simple property or array |
Definition at line 145 of file XMPValidate.php.
XMPValidate::validateLangCode | ( | $info, | |
& | $val, | ||
$standalone | |||
) |
function to validate LangCode properties ( en-GB, etc )
This is just a naive check to make sure it somewhat looks like a lang code.
array | $info | Information about current property |
mixed | &$val | Current value to validate |
bool | $standalone | If this is a simple property or array |
Definition at line 229 of file XMPValidate.php.
XMPValidate::validateRating | ( | $info, | |
& | $val, | ||
$standalone | |||
) |
function to validate rating properties -1, 0-5
if its outside of range put it into range.
array | $info | Information about current property |
mixed | &$val | Current value to validate |
bool | $standalone | If this is a simple property or array |
Definition at line 106 of file XMPValidate.php.
XMPValidate::validateRational | ( | $info, | |
& | $val, | ||
$standalone | |||
) |
function to validate rational properties ( 12/10 )
array | $info | Information about current property |
mixed | &$val | Current value to validate |
bool | $standalone | If this is a simple property or array |
Definition at line 85 of file XMPValidate.php.
|
private |
Definition at line 51 of file XMPValidate.php.
Referenced by setLogger().