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

namespaces
Pål Jørgensen 2014-11-03 07:00:05 +01:00
commit 48dd1333a8
2 changed files with 22 additions and 11 deletions

View File

@ -1526,7 +1526,7 @@ class H5PCore {
public static $coreApi = array( public static $coreApi = array(
'majorVersion' => 1, 'majorVersion' => 1,
'minorVersion' => 3 'minorVersion' => 4
); );
public static $styles = array( public static $styles = array(
'styles/h5p.css', 'styles/h5p.css',
@ -1648,19 +1648,23 @@ class H5PCore {
// Update content dependencies. // Update content dependencies.
$content['dependencies'] = $validator->getDependencies(); $content['dependencies'] = $validator->getDependencies();
$this->h5pF->deleteLibraryUsage($content['id']);
$this->h5pF->saveLibraryUsage($content['id'], $content['dependencies']);
if ($this->exportEnabled) { // Sometimes the parameters are filtered before content has been created
// Recreate export file if ($content['id']) {
$exporter = new H5PExport($this->h5pF, $this); $this->h5pF->deleteLibraryUsage($content['id']);
$exporter->createExportFile($content); $this->h5pF->saveLibraryUsage($content['id'], $content['dependencies']);
// TODO: Should we rather create the file once first accessed, like imagecache? if ($this->exportEnabled) {
// Recreate export file
$exporter = new H5PExport($this->h5pF, $this);
$exporter->createExportFile($content);
// TODO: Should we rather create the file once first accessed, like imagecache?
}
// Cache.
$this->h5pF->setFilteredParameters($content['id'], $params);
} }
// Cache.
$this->h5pF->setFilteredParameters($content['id'], $params);
return $params; return $params;
} }

View File

@ -1099,3 +1099,10 @@ if (H5P.jQuery) {
} }
}); });
} }
/**
* Mimics how php's htmlspecialchars works (the way we use it)
*/
H5P.htmlSpecialChars = function(string) {
return string.toString().replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/'/g, '&#039;').replace(/"/g, '&quot;');
};