Merge branch 'master' of github.com:h5p/h5p-php-library

pull/61/head
Thomas Marstrander 2019-04-01 12:06:07 +02:00
commit a934d5b3ec
3 changed files with 12 additions and 9 deletions

View File

@ -65,7 +65,7 @@ abstract class H5PMetadata {
',"yearFrom":' . (isset($content->year_from) ? $content->year_from : 'null') . ',"yearFrom":' . (isset($content->year_from) ? $content->year_from : 'null') .
',"yearTo":' . (isset($content->year_to) ? $content->year_to : 'null') . ',"yearTo":' . (isset($content->year_to) ? $content->year_to : 'null') .
',"changes":' . (isset($content->changes) ? $content->changes : 'null') . ',"changes":' . (isset($content->changes) ? $content->changes : 'null') .
',"defaultLanguage":' . (isset($content->default_language) ? $content->default_language : 'null') . ',"defaultLanguage":' . (isset($content->default_language) ? '"' . $content->default_language . '"' : 'null') .
',"authorComments":' . (isset($content->author_comments) ? json_encode($content->author_comments) : 'null') . '}'; ',"authorComments":' . (isset($content->author_comments) ? json_encode($content->author_comments) : 'null') . '}';
} }

View File

@ -1006,28 +1006,29 @@ class H5PValidator {
if (!empty($missingLibraries)) { if (!empty($missingLibraries)) {
// We still have missing libraries, check if our main library has an upgrade (BUT only if we has content) // We still have missing libraries, check if our main library has an upgrade (BUT only if we has content)
$mainDependency = NULL; $mainDependency = NULL;
if (!$skipContent && !empty($mainH5PData)) { if (!$skipContent && !empty($mainH5pData)) {
foreach ($mainH5PData['preloadedDependencies'] as $dep) { foreach ($mainH5pData['preloadedDependencies'] as $dep) {
if ($dep['machineName'] === $mainH5PData['mainLibrary']) { if ($dep['machineName'] === $mainH5pData['mainLibrary']) {
$mainDependency = $dep; $mainDependency = $dep;
} }
} }
} }
if ($skipContent || !$mainDependency || !$this->h5pF->libraryHasUpgrade(array( if ($skipContent || !$mainDependency || !$this->h5pF->libraryHasUpgrade(array(
'machineName' => $mainDependency['mainLibrary'], 'machineName' => $mainDependency['machineName'],
'majorVersion' => $mainDependency['majorVersion'], 'majorVersion' => $mainDependency['majorVersion'],
'minorVersion' => $mainDependency['minorVersion'] 'minorVersion' => $mainDependency['minorVersion']
))) { ))) {
foreach ($missingLibraries as $libString => $library) { foreach ($missingLibraries as $libString => $library) {
$this->h5pF->setErrorMessage($this->h5pF->t('Missing required library @library', array('@library' => $libString)), 'missing-required-library'); $this->h5pF->setErrorMessage($this->h5pF->t('Missing required library @library', array('@library' => $libString)), 'missing-required-library');
$valid = FALSE;
} }
if (!$this->h5pC->mayUpdateLibraries()) { if (!$this->h5pC->mayUpdateLibraries()) {
$this->h5pF->setInfoMessage($this->h5pF->t("Note that the libraries may exist in the file you uploaded, but you're not allowed to upload new libraries. Contact the site administrator about this.")); $this->h5pF->setInfoMessage($this->h5pF->t("Note that the libraries may exist in the file you uploaded, but you're not allowed to upload new libraries. Contact the site administrator about this."));
$valid = FALSE;
} }
} }
} }
$valid = empty($missingLibraries) && $valid;
} }
if (!$valid) { if (!$valid) {
H5PCore::deleteFileTree($tmpDir); H5PCore::deleteFileTree($tmpDir);
@ -1782,7 +1783,7 @@ Class H5PExport {
} }
// Update content.json with content from database // Update content.json with content from database
file_put_contents("{$tmpPath}/content/content.json", $content['params']); file_put_contents("{$tmpPath}/content/content.json", $content['filtered']);
// Make embedType into an array // Make embedType into an array
$embedTypes = explode(', ', $content['embedType']); $embedTypes = explode(', ', $content['embedType']);
@ -2204,6 +2205,7 @@ class H5PCore {
if ($this->exportEnabled) { if ($this->exportEnabled) {
// Recreate export file // Recreate export file
$exporter = new H5PExport($this->h5pF, $this); $exporter = new H5PExport($this->h5pF, $this);
$content['filtered'] = $params;
$exporter->createExportFile($content); $exporter->createExportFile($content);
} }

View File

@ -306,10 +306,11 @@ div.h5p-fullscreen {
.h5p-embed-dialog .h5p-inner, .h5p-embed-dialog .h5p-inner,
.h5p-reuse-dialog .h5p-inner, .h5p-reuse-dialog .h5p-inner,
.h5p-content-user-data-reset-dialog .h5p-inner { .h5p-content-user-data-reset-dialog .h5p-inner {
width: 316px; min-width: 316px;
max-width: 400px;
left: 50%; left: 50%;
top: 50%; top: 50%;
margin: 0 0 0 -158px; transform: translateX(-50%);
} }
.h5p-embed-dialog .h5p-embed-code-container, .h5p-embed-dialog .h5p-embed-code-container,
.h5p-embed-size { .h5p-embed-size {