parent
f090e651e1
commit
64f170b8a3
|
@ -1715,6 +1715,12 @@ abstract class H5PDisplayOptionBehaviour {
|
||||||
|
|
||||||
abstract class H5PHubEndpoints {
|
abstract class H5PHubEndpoints {
|
||||||
const CONTENT_TYPES = 'api.h5p.org/v1/content-types/';
|
const CONTENT_TYPES = 'api.h5p.org/v1/content-types/';
|
||||||
|
const SITES = 'api.h5p.org/v1/sites';
|
||||||
|
|
||||||
|
public static function createURL($endpoint) {
|
||||||
|
$protocol = (extension_loaded('openssl') ? 'https' : 'http');
|
||||||
|
return "{$protocol}://{$endpoint}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2451,9 +2457,7 @@ class H5PCore {
|
||||||
|
|
||||||
// Register site if it is not registered
|
// Register site if it is not registered
|
||||||
if (empty($uuid)) {
|
if (empty($uuid)) {
|
||||||
$protocol = (extension_loaded('openssl') ? 'https' : 'http');
|
$registration = $this->h5pF->fetchExternalData(H5PHubEndpoints::createURL(H5PHubEndpoints::SITES), $registrationData);
|
||||||
$endpoint = 'api.h5p.org/v1/sites';
|
|
||||||
$registration = $this->h5pF->fetchExternalData("{$protocol}://{$endpoint}", $registrationData);
|
|
||||||
|
|
||||||
// Failed retrieving uuid
|
// Failed retrieving uuid
|
||||||
if (!$registration) {
|
if (!$registration) {
|
||||||
|
@ -2860,9 +2864,7 @@ class H5PCore {
|
||||||
|
|
||||||
$postData['current_cache'] = $this->h5pF->getOption('content_type_cache_updated_at', 0);
|
$postData['current_cache'] = $this->h5pF->getOption('content_type_cache_updated_at', 0);
|
||||||
|
|
||||||
$protocol = (extension_loaded('openssl') ? 'https' : 'http');
|
$data = $interface->fetchExternalData(H5PHubEndpoints::createURL(H5PHubEndpoints::CONTENT_TYPES), $postData);
|
||||||
$endpoint = H5PHubEndpoints::CONTENT_TYPES;
|
|
||||||
$data = $interface->fetchExternalData("{$protocol}://{$endpoint}", $postData);
|
|
||||||
|
|
||||||
if (! $this->h5pF->getOption('hub_is_enabled', TRUE)) {
|
if (! $this->h5pF->getOption('hub_is_enabled', TRUE)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in New Issue