Add the schema to the database

namespaces
Svein-Tore Griff With 2013-01-25 15:14:29 +01:00
parent 784d5caeb3
commit 905afe7dde
1 changed files with 14 additions and 0 deletions

View File

@ -300,6 +300,20 @@ class h5pValidator {
continue; continue;
} }
// validate json if a schema file is provided
$schemaPath = $file_path . DIRECTORY_SEPARATOR . 'schema.json';
if (file_exists($schemaPath)) {
$schema = $this->getJsonData($schemaPath);
if ($schema === FALSE) {
$this->h5pF->setErrorMessage($this->h5pF->t('Invalid schema.json file has been included in the library %name', array('%name' => $file)));
$valid = FALSE;
continue;
}
else {
$h5pData->schema = $schema;
}
}
$validLibrary = $this->isValidH5pData($h5pData, $file, $this->libraryRequired, $this->libraryOptional); $validLibrary = $this->isValidH5pData($h5pData, $file, $this->libraryRequired, $this->libraryOptional);
if (isset($h5pData['preloadedJs'])) { if (isset($h5pData['preloadedJs'])) {