Revert "HFP-967 Update content validator to handle headers and tables"
This reverts commit 9ee5d2ebe7
.
pull/10/merge
parent
8d01baca8e
commit
edb9e6244c
|
@ -567,7 +567,7 @@ interface H5PFrameworkInterface {
|
||||||
/**
|
/**
|
||||||
* Will trigger after the export file is created.
|
* Will trigger after the export file is created.
|
||||||
*/
|
*/
|
||||||
public function afterExportCreated($content, $filename);
|
public function afterExportCreated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if user has permissions to an action
|
* Check if user has permissions to an action
|
||||||
|
@ -1610,19 +1610,16 @@ Class H5PExport {
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
// Please note that the zip format has no concept of folders, we must
|
// Please note that the zip format has no concept of folders, we must
|
||||||
// use forward slashes to separate our directories.
|
// use forward slashes to separate our directories.
|
||||||
if (file_exists(realpath($file->absolutePath))) {
|
$zip->addFile(realpath($file->absolutePath), $file->relativePath);
|
||||||
$zip->addFile(realpath($file->absolutePath), $file->relativePath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close zip and remove tmp dir
|
// Close zip and remove tmp dir
|
||||||
$zip->close();
|
$zip->close();
|
||||||
H5PCore::deleteFileTree($tmpPath);
|
H5PCore::deleteFileTree($tmpPath);
|
||||||
|
|
||||||
$filename = $content['slug'] . '-' . $content['id'] . '.h5p';
|
|
||||||
try {
|
try {
|
||||||
// Save export
|
// Save export
|
||||||
$this->h5pC->fs->saveExport($tmpFile, $filename);
|
$this->h5pC->fs->saveExport($tmpFile, $content['slug'] . '-' . $content['id'] . '.h5p');
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
$this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage()));
|
$this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage()));
|
||||||
|
@ -1630,7 +1627,7 @@ Class H5PExport {
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
$this->h5pF->afterExportCreated($content, $filename);
|
$this->h5pF->afterExportCreated();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2474,13 +2471,12 @@ class H5PCore {
|
||||||
$this->h5pF->setInfoMessage(
|
$this->h5pF->setInfoMessage(
|
||||||
$this->h5pF->t('Your site was successfully registered with the H5P Hub.')
|
$this->h5pF->t('Your site was successfully registered with the H5P Hub.')
|
||||||
);
|
);
|
||||||
// TODO: Uncomment when key is once again available in H5P Settings
|
$this->h5pF->setInfoMessage(
|
||||||
// $this->h5pF->setInfoMessage(
|
$this->h5pF->t('You have been provided a unique key that identifies you with the Hub when receiving new updates. The key is available for viewing in the "H5P Settings" page.')
|
||||||
// $this->h5pF->t('You have been provided a unique key that identifies you with the Hub when receiving new updates. The key is available for viewing in the "H5P Settings" page.')
|
);
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->h5pF->getOption('send_usage_statistics', TRUE)) {
|
if ($this->h5pF->getOption('h5p_send_usage_statistics', TRUE)) {
|
||||||
$siteData = array_merge(
|
$siteData = array_merge(
|
||||||
$registrationData,
|
$registrationData,
|
||||||
array(
|
array(
|
||||||
|
@ -2780,6 +2776,10 @@ class H5PCore {
|
||||||
* @param null|int $status_code Http response code
|
* @param null|int $status_code Http response code
|
||||||
*/
|
*/
|
||||||
private static function printJson($data, $status_code = NULL) {
|
private static function printJson($data, $status_code = NULL) {
|
||||||
|
if ($status_code !== NULL) {
|
||||||
|
http_response_code($status_code);
|
||||||
|
}
|
||||||
|
|
||||||
header('Cache-Control: no-cache');
|
header('Cache-Control: no-cache');
|
||||||
header('Content-type: application/json; charset=utf-8');
|
header('Content-type: application/json; charset=utf-8');
|
||||||
print json_encode($data);
|
print json_encode($data);
|
||||||
|
@ -2835,9 +2835,19 @@ class H5PCore {
|
||||||
public function updateContentTypeCache($postData = NULL) {
|
public function updateContentTypeCache($postData = NULL) {
|
||||||
$interface = $this->h5pF;
|
$interface = $this->h5pF;
|
||||||
|
|
||||||
// Make sure data is sent!
|
// Set uuid
|
||||||
if (!isset($postData) || !isset($postData['uuid'])) {
|
if (!$postData || !isset($postData['uuid'])) {
|
||||||
return $this->fetchLibrariesMetadata();
|
$site_uuid = $this->h5pF->getOption('site_uuid', '');
|
||||||
|
|
||||||
|
// Register site with site uuid if we don't already have it
|
||||||
|
// and try to update content type cache again when this is done
|
||||||
|
if (empty($site_uuid)) {
|
||||||
|
return $this->fetchLibrariesMetadata();
|
||||||
|
}
|
||||||
|
|
||||||
|
$postData = array(
|
||||||
|
'uuid' => $site_uuid
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$postData['current_cache'] = $this->h5pF->getOption('content_type_cache_updated_at', 0);
|
$postData['current_cache'] = $this->h5pF->getOption('content_type_cache_updated_at', 0);
|
||||||
|
@ -2846,7 +2856,7 @@ class H5PCore {
|
||||||
$endpoint = H5PHubEndpoints::CONTENT_TYPES;
|
$endpoint = H5PHubEndpoints::CONTENT_TYPES;
|
||||||
$data = $interface->fetchExternalData("{$protocol}://{$endpoint}", $postData);
|
$data = $interface->fetchExternalData("{$protocol}://{$endpoint}", $postData);
|
||||||
|
|
||||||
if (! $this->h5pF->getOption('hub_is_enabled', TRUE)) {
|
if (! $this->h5pF->getOption('h5p_hub_is_enabled', TRUE)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3019,7 +3029,7 @@ class H5PContentValidator {
|
||||||
public $h5pF;
|
public $h5pF;
|
||||||
public $h5pC;
|
public $h5pC;
|
||||||
private $typeMap, $libraries, $dependencies, $nextWeight;
|
private $typeMap, $libraries, $dependencies, $nextWeight;
|
||||||
private static $allowed_styleable_tags = array('span', 'p', 'div','h1','h2','h3', 'td');
|
private static $allowed_styleable_tags = array('span', 'p', 'div');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the H5PContentValidator
|
* Constructor for the H5PContentValidator
|
||||||
|
|
Loading…
Reference in New Issue