mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-73830 h5plib_v124: Upgrade H5P core library to 1.24.3
This commit is contained in:
parent
9cd77c4130
commit
20916ff72a
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMid meet">
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>
|
||||
<json>
|
||||
<![CDATA[
|
||||
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
/**
|
||||
* File info?
|
||||
*/
|
||||
@ -10,13 +9,13 @@ namespace Moodle;
|
||||
* operations using PHP's standard file operation functions.
|
||||
*
|
||||
* Some implementations of H5P that doesn't use the standard file system will
|
||||
* want to create their own implementation of the H5PFileStorage interface.
|
||||
* want to create their own implementation of the \H5P\FileStorage interface.
|
||||
*
|
||||
* @package H5P
|
||||
* @copyright 2016 Joubel AS
|
||||
* @license MIT
|
||||
*/
|
||||
class H5PDefaultStorage implements H5PFileStorage {
|
||||
class H5PDefaultStorage implements \H5PFileStorage {
|
||||
private $path, $alteditorpath;
|
||||
|
||||
/**
|
||||
@ -40,10 +39,10 @@ class H5PDefaultStorage implements H5PFileStorage {
|
||||
* Library properties
|
||||
*/
|
||||
public function saveLibrary($library) {
|
||||
$dest = $this->path . '/libraries/' . H5PCore::libraryToString($library, TRUE);
|
||||
$dest = $this->path . '/libraries/' . \H5PCore::libraryToString($library, TRUE);
|
||||
|
||||
// Make sure destination dir doesn't exist
|
||||
H5PCore::deleteFileTree($dest);
|
||||
\H5PCore::deleteFileTree($dest);
|
||||
|
||||
// Move library folder
|
||||
self::copyFileTree($library['uploadDirectory'], $dest);
|
||||
@ -61,7 +60,7 @@ class H5PDefaultStorage implements H5PFileStorage {
|
||||
$dest = "{$this->path}/content/{$content['id']}";
|
||||
|
||||
// Remove any old content
|
||||
H5PCore::deleteFileTree($dest);
|
||||
\H5PCore::deleteFileTree($dest);
|
||||
|
||||
self::copyFileTree($source, $dest);
|
||||
}
|
||||
@ -73,7 +72,7 @@ class H5PDefaultStorage implements H5PFileStorage {
|
||||
* Content properties
|
||||
*/
|
||||
public function deleteContent($content) {
|
||||
H5PCore::deleteFileTree("{$this->path}/content/{$content['id']}");
|
||||
\H5PCore::deleteFileTree("{$this->path}/content/{$content['id']}");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -134,7 +133,7 @@ class H5PDefaultStorage implements H5PFileStorage {
|
||||
* Folder that library resides in
|
||||
*/
|
||||
public function exportLibrary($library, $target, $developmentPath=NULL) {
|
||||
$folder = H5PCore::libraryToString($library, TRUE);
|
||||
$folder = \H5PCore::libraryToString($library, TRUE);
|
||||
$srcPath = ($developmentPath === NULL ? "/libraries/{$folder}" : $developmentPath);
|
||||
self::copyFileTree("{$this->path}{$srcPath}", "{$target}/{$folder}");
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
/**
|
||||
* This is a data layer which uses the file system so it isn't specific to any framework.
|
||||
*/
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
/**
|
||||
* The base class for H5P events. Extend to track H5P events in your system.
|
||||
*
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
/**
|
||||
* File info?
|
||||
*/
|
||||
|
@ -1,7 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
/**
|
||||
* Utility class for handling metadata
|
||||
*/
|
||||
|
@ -1,9 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
use ZipArchive;
|
||||
|
||||
/**
|
||||
* Interface defining functions the h5p library needs the framework to implement
|
||||
*/
|
||||
@ -2062,7 +2057,7 @@ class H5PCore {
|
||||
*
|
||||
* @param H5PFrameworkInterface $H5PFramework
|
||||
* The frameworks implementation of the H5PFrameworkInterface
|
||||
* @param string|H5PFileStorage $path H5P file storage directory or class.
|
||||
* @param string|\H5PFileStorage $path H5P file storage directory or class.
|
||||
* @param string $url To file storage directory.
|
||||
* @param string $language code. Defaults to english.
|
||||
* @param boolean $export enabled?
|
||||
@ -2070,7 +2065,7 @@ class H5PCore {
|
||||
public function __construct(H5PFrameworkInterface $H5PFramework, $path, $url, $language = 'en', $export = FALSE) {
|
||||
$this->h5pF = $H5PFramework;
|
||||
|
||||
$this->fs = ($path instanceof H5PFileStorage ? $path : new H5PDefaultStorage($path));
|
||||
$this->fs = ($path instanceof \H5PFileStorage ? $path : new \H5PDefaultStorage($path));
|
||||
|
||||
$this->url = $url;
|
||||
$this->exportEnabled = $export;
|
||||
@ -2437,7 +2432,7 @@ class H5PCore {
|
||||
// Using content dependencies
|
||||
foreach ($dependencies as $dependency) {
|
||||
if (isset($dependency['path']) === FALSE) {
|
||||
$dependency['path'] = $this->getDependencyPath($dependency);
|
||||
$dependency['path'] = 'libraries/' . H5PCore::libraryToString($dependency, TRUE);
|
||||
$dependency['preloadedJs'] = explode(',', $dependency['preloadedJs']);
|
||||
$dependency['preloadedCss'] = explode(',', $dependency['preloadedCss']);
|
||||
}
|
||||
@ -2457,16 +2452,6 @@ class H5PCore {
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the dependency.
|
||||
*
|
||||
* @param stdClass $dependency
|
||||
* @return string
|
||||
*/
|
||||
protected function getDependencyPath(array $dependency): string {
|
||||
return H5PCore::libraryToString($dependency, TRUE);
|
||||
}
|
||||
|
||||
private static function getDependenciesHash(&$dependencies) {
|
||||
// Build hash of dependencies
|
||||
$toHash = array();
|
||||
@ -3217,23 +3202,21 @@ class H5PCore {
|
||||
* @return string
|
||||
*/
|
||||
private static function hashToken($action, $time_factor) {
|
||||
global $SESSION;
|
||||
|
||||
if (!isset($SESSION->h5p_token)) {
|
||||
if (!isset($_SESSION['h5p_token'])) {
|
||||
// Create an unique key which is used to create action tokens for this session.
|
||||
if (function_exists('random_bytes')) {
|
||||
$SESSION->h5p_token = base64_encode(random_bytes(15));
|
||||
$_SESSION['h5p_token'] = base64_encode(random_bytes(15));
|
||||
}
|
||||
else if (function_exists('openssl_random_pseudo_bytes')) {
|
||||
$SESSION->h5p_token = base64_encode(openssl_random_pseudo_bytes(15));
|
||||
$_SESSION['h5p_token'] = base64_encode(openssl_random_pseudo_bytes(15));
|
||||
}
|
||||
else {
|
||||
$SESSION->h5p_token = uniqid('', TRUE);
|
||||
$_SESSION['h5p_token'] = uniqid('', TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// Create hash and return
|
||||
return substr(hash('md5', $action . $time_factor . $SESSION->h5p_token), -16, 13);
|
||||
return substr(hash('md5', $action . $time_factor . $_SESSION['h5p_token']), -16, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 345 150" enable-background="new 0 0 345 150" xml:space="preserve" preserveAspectRatio="xMinYMid meet">
|
||||
viewBox="0 0 345 150" enable-background="new 0 0 345 150" xml:space="preserve">
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M325.7,14.7C317.6,6.9,305.3,3,289,3h-43.5H234v31h-66l-5.4,22.2c4.5-2.1,10.9-4.2,15.3-5.3
|
||||
c4.4-1.1,8.8-0.9,13.1-0.9c14.6,0,26.5,4.5,35.6,13.3c9.1,8.8,13.6,20,13.6,33.4c0,9.4-2.3,18.5-7,27.2c-4.7,8.7-11.3,15.4-19.9,20
|
||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
11
h5p/h5plib/v124/joubel/core/js/jquery.js
vendored
11
h5p/h5plib/v124/joubel/core/js/jquery.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user