MediaWiki REL1_30
XMPValidate Class Reference

This contains some static methods for validating XMP properties. More...

Inheritance diagram for XMPValidate:
Collaboration diagram for XMPValidate:

Public Member Functions

 __construct (LoggerInterface $logger)
 
 setLogger (LoggerInterface $logger)
 
 validateBoolean ( $info, &$val, $standalone)
 Function to validate boolean properties ( True or False )
 
 validateClosed ( $info, &$val, $standalone)
 function to validate properties with a fixed number of allowed choices.
 
 validateDate ( $info, &$val, $standalone)
 function to validate date properties, and convert to (partial) Exif format.
 
 validateFlash ( $info, &$val, $standalone)
 function to validate and modify flash structure
 
 validateGPS ( $info, &$val, $standalone)
 function to validate, and more importantly translate the XMP DMS form of gps coords to the decimal form we use.
 
 validateInteger ( $info, &$val, $standalone)
 function to validate integers
 
 validateLangCode ( $info, &$val, $standalone)
 function to validate LangCode properties ( en-GB, etc )
 
 validateRating ( $info, &$val, $standalone)
 function to validate rating properties -1, 0-5
 
 validateRational ( $info, &$val, $standalone)
 function to validate rational properties ( 12/10 )
 

Private Attributes

LoggerInterface $logger
 

Detailed Description

This contains some static methods for validating XMP properties.

See XMPInfo and XMPReader classes.

Each of these functions take the same parameters

  • an info array which is a subset of the XMPInfo::items array
  • A value (passed as reference) to validate. This can be either a simple value or an array
  • A boolean to determine if this is validating a simple or complex values

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.

See also
http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart1.pdf starting at pg 28
http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart2.pdf starting at pg 11

Definition at line 47 of file XMPValidate.php.

Constructor & Destructor Documentation

◆ __construct()

XMPValidate::__construct ( LoggerInterface $logger)

Definition at line 54 of file XMPValidate.php.

References setLogger().

Member Function Documentation

◆ setLogger()

XMPValidate::setLogger ( LoggerInterface $logger)

Definition at line 58 of file XMPValidate.php.

References $logger.

Referenced by __construct().

◆ validateBoolean()

XMPValidate::validateBoolean ( $info,
& $val,
$standalone )

Function to validate boolean properties ( True or False )

Parameters
array$infoInformation about current property
mixed&$valCurrent value to validate
bool$standaloneIf this is a simple property or array

Definition at line 68 of file XMPValidate.php.

◆ validateClosed()

XMPValidate::validateClosed ( $info,
& $val,
$standalone )

function to validate properties with a fixed number of allowed choices.

(closed choice)

Parameters
array$infoInformation about current property
mixed&$valCurrent value to validate
bool$standaloneIf this is a simple property or array

Definition at line 165 of file XMPValidate.php.

◆ validateDate()

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

Parameters
array$infoInformation about current property
mixed&$valCurrent 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$standaloneIf this is a simple property or array

Definition at line 259 of file XMPValidate.php.

References $res.

◆ validateFlash()

XMPValidate::validateFlash ( $info,
& $val,
$standalone )

function to validate and modify flash structure

Parameters
array$infoInformation about current property
mixed&$valCurrent value to validate
bool$standaloneIf this is a simple property or array

Definition at line 195 of file XMPValidate.php.

◆ validateGPS()

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.

See also
http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart2.pdf section 1.2.7.4 on page 23
Parameters
array$infoUnused (info about prop)
string&$valGPS string in either DDD,MM,SSk or or DDD,MM.mmk form
bool$standaloneIf its a simple prop (should always be true)

Definition at line 362 of file XMPValidate.php.

◆ validateInteger()

XMPValidate::validateInteger ( $info,
& $val,
$standalone )

function to validate integers

Parameters
array$infoInformation about current property
mixed&$valCurrent value to validate
bool$standaloneIf this is a simple property or array

Definition at line 146 of file XMPValidate.php.

◆ validateLangCode()

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.

See also
BCP 47
https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/ XMP%20SDK%20Release%20cc-2014-12/XMPSpecificationPart1.pdf page 22 (section 8.2.2.4)
Parameters
array$infoInformation about current property
mixed&$valCurrent value to validate
bool$standaloneIf this is a simple property or array

Definition at line 230 of file XMPValidate.php.

◆ validateRating()

XMPValidate::validateRating ( $info,
& $val,
$standalone )

function to validate rating properties -1, 0-5

if its outside of range put it into range.

See also
MWG spec
Parameters
array$infoInformation about current property
mixed&$valCurrent value to validate
bool$standaloneIf this is a simple property or array

Definition at line 107 of file XMPValidate.php.

◆ validateRational()

XMPValidate::validateRational ( $info,
& $val,
$standalone )

function to validate rational properties ( 12/10 )

Parameters
array$infoInformation about current property
mixed&$valCurrent value to validate
bool$standaloneIf this is a simple property or array

Definition at line 86 of file XMPValidate.php.

Member Data Documentation

◆ $logger

LoggerInterface XMPValidate::$logger
private

Definition at line 52 of file XMPValidate.php.

Referenced by setLogger().


The documentation for this class was generated from the following file: