Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
Moodle\H5PContentValidator Class Reference

Public Member Functions

 __construct ($H5PFramework, $H5PCore)
 Constructor for the H5PContentValidator.
 
 addon ($library)
 Add Addon library.
 
 filterParams (&$params, $whitelist)
 Check params for a whitelist of allowed properties.
 
 getCopyrightSemantics ()
 
 getDependencies ()
 Get the flat dependency tree.
 
 getMetadataSemantics ()
 
 validateAudio (&$audio, $semantics)
 Validate given audio data.
 
 validateBoolean (&$bool)
 Validate given value against boolean semantics.
 
 validateContentFiles ($contentPath, $isLibrary=FALSE)
 Validates content files.
 
 validateFile (&$file, $semantics)
 Validate given file data.
 
 validateGroup (&$group, $semantics, $flatten=TRUE)
 Validate given group value against group semantics.
 
 validateImage (&$image, $semantics)
 Validate given image data.
 
 validateLibrary (&$value, $semantics)
 Validate given library value against library semantics.
 
 validateList (&$list, $semantics)
 Validate given list value against list semantics.
 
 validateMetadata ($metadata)
 Validate metadata.
 
 validateNumber (&$number, $semantics)
 Validate given value against number semantics.
 
 validateSelect (&$select, $semantics)
 Validate select values.
 
 validateText (&$text, $semantics)
 Validate given text value against text semantics.
 
 validateVideo (&$video, $semantics)
 Validate given video data.
 

Public Attributes

 $h5pC
 
 $h5pF
 
return $uri
 

Protected Attributes

bool $allowedStyles
 Allowed styles status.
 

Constructor & Destructor Documentation

◆ __construct()

Moodle\H5PContentValidator::__construct ( $H5PFramework,
$H5PCore )

Constructor for the H5PContentValidator.

Parameters
object$H5PFrameworkThe frameworks implementation of the H5PFrameworkInterface
object$H5PCoreThe main H5PCore instance

Member Function Documentation

◆ filterParams()

Moodle\H5PContentValidator::filterParams ( & $params,
$whitelist )

Check params for a whitelist of allowed properties.

Parameters
array/object$params
array$whitelist

◆ getDependencies()

Moodle\H5PContentValidator::getDependencies ( )

Get the flat dependency tree.

Return values
array

◆ validateAudio()

Moodle\H5PContentValidator::validateAudio ( & $audio,
$semantics )

Validate given audio data.

Parameters
$audio
$semantics

◆ validateBoolean()

Moodle\H5PContentValidator::validateBoolean ( & $bool)

Validate given value against boolean semantics.

Parameters
$bool
Return values
bool

◆ validateContentFiles()

Moodle\H5PContentValidator::validateContentFiles ( $contentPath,
$isLibrary = FALSE )

Validates content files.

Parameters
string$contentPathThe path containing content files to validate.
bool$isLibrary
Return values
boolTRUE if all files are valid TRUE if all files are valid FALSE if one or more files fail validation. Error message should be set accordingly by validator.

◆ validateFile()

Moodle\H5PContentValidator::validateFile ( & $file,
$semantics )

Validate given file data.

Parameters
$file
$semantics

◆ validateGroup()

Moodle\H5PContentValidator::validateGroup ( & $group,
$semantics,
$flatten = TRUE )

Validate given group value against group semantics.

Will recurse into validating each group member.

Parameters
$group
$semantics
bool$flatten

◆ validateImage()

Moodle\H5PContentValidator::validateImage ( & $image,
$semantics )

Validate given image data.

Parameters
$image
$semantics

◆ validateLibrary()

Moodle\H5PContentValidator::validateLibrary ( & $value,
$semantics )

Validate given library value against library semantics.

Check if provided library is within allowed options.

Will recurse into validating the library's semantics too.

Parameters
$value
$semantics

◆ validateList()

Moodle\H5PContentValidator::validateList ( & $list,
$semantics )

Validate given list value against list semantics.

Will recurse into validating each item in the list according to the type.

Parameters
$list
$semantics

◆ validateMetadata()

Moodle\H5PContentValidator::validateMetadata ( $metadata)

Validate metadata.

Parameters
array$metadata
Return values
arrayValidated & filtered

◆ validateNumber()

Moodle\H5PContentValidator::validateNumber ( & $number,
$semantics )

Validate given value against number semantics.

Parameters
$number
$semantics

◆ validateSelect()

Moodle\H5PContentValidator::validateSelect ( & $select,
$semantics )

Validate select values.

Parameters
$select
$semantics

◆ validateText()

Moodle\H5PContentValidator::validateText ( & $text,
$semantics )

Validate given text value against text semantics.

Parameters
$text
$semantics

◆ validateVideo()

Moodle\H5PContentValidator::validateVideo ( & $video,
$semantics )

Validate given video data.

Parameters
$video
$semantics

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