Merge branch 'master' of github.com:h5p/h5p-php-library
commit
39d7ddc6b8
|
@ -580,7 +580,7 @@ class H5PValidator {
|
||||||
// Schemas used to validate the h5p files
|
// Schemas used to validate the h5p files
|
||||||
private $h5pRequired = array(
|
private $h5pRequired = array(
|
||||||
'title' => '/^.{1,255}$/',
|
'title' => '/^.{1,255}$/',
|
||||||
'language' => '/^[/-,a-z]{1,5}$/',
|
'language' => '/^[-a-zA-Z]{1,10}$/',
|
||||||
'preloadedDependencies' => array(
|
'preloadedDependencies' => array(
|
||||||
'machineName' => '/^[\w0-9\-\.]{1,255}$/i',
|
'machineName' => '/^[\w0-9\-\.]{1,255}$/i',
|
||||||
'majorVersion' => '/^[0-9]{1,5}$/',
|
'majorVersion' => '/^[0-9]{1,5}$/',
|
||||||
|
@ -1725,7 +1725,7 @@ class H5PCore {
|
||||||
public static $defaultContentWhitelist = 'json png jpg jpeg gif bmp tif tiff svg eot ttf woff woff2 otf webm mp4 ogg mp3 txt pdf rtf doc docx xls xlsx ppt pptx odt ods odp xml csv diff patch swf md textile';
|
public static $defaultContentWhitelist = 'json png jpg jpeg gif bmp tif tiff svg eot ttf woff woff2 otf webm mp4 ogg mp3 txt pdf rtf doc docx xls xlsx ppt pptx odt ods odp xml csv diff patch swf md textile';
|
||||||
public static $defaultLibraryWhitelistExtras = 'js css';
|
public static $defaultLibraryWhitelistExtras = 'js css';
|
||||||
|
|
||||||
public $librariesJsonData, $contentJsonData, $mainJsonData, $h5pF, $fs, $development_mode, $h5pD, $disableFileCheck;
|
public $librariesJsonData, $contentJsonData, $mainJsonData, $h5pF, $fs, $h5pD, $disableFileCheck;
|
||||||
const SECONDS_IN_WEEK = 604800;
|
const SECONDS_IN_WEEK = 604800;
|
||||||
|
|
||||||
private $exportEnabled;
|
private $exportEnabled;
|
||||||
|
@ -1761,23 +1761,17 @@ class H5PCore {
|
||||||
* @param string $url To file storage directory.
|
* @param string $url To file storage directory.
|
||||||
* @param string $language code. Defaults to english.
|
* @param string $language code. Defaults to english.
|
||||||
* @param boolean $export enabled?
|
* @param boolean $export enabled?
|
||||||
* @param int $development_mode mode.
|
|
||||||
*/
|
*/
|
||||||
public function __construct(H5PFrameworkInterface $H5PFramework, $path, $url, $language = 'en', $export = FALSE, $development_mode = H5PDevelopment::MODE_NONE) {
|
public function __construct(H5PFrameworkInterface $H5PFramework, $path, $url, $language = 'en', $export = FALSE) {
|
||||||
$this->h5pF = $H5PFramework;
|
$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->url = $url;
|
||||||
$this->exportEnabled = $export;
|
$this->exportEnabled = $export;
|
||||||
$this->development_mode = $development_mode;
|
|
||||||
|
|
||||||
$this->aggregateAssets = FALSE; // Off by default.. for now
|
$this->aggregateAssets = FALSE; // Off by default.. for now
|
||||||
|
|
||||||
if ($development_mode & H5PDevelopment::MODE_LIBRARY) {
|
|
||||||
$this->h5pD = new H5PDevelopment($this->h5pF, $path . '/', $language);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->detectSiteType();
|
$this->detectSiteType();
|
||||||
$this->fullPluginPath = preg_replace('/\/[^\/]+[\/]?$/', '' , dirname(__FILE__));
|
$this->fullPluginPath = preg_replace('/\/[^\/]+[\/]?$/', '' , dirname(__FILE__));
|
||||||
|
|
||||||
|
@ -1785,6 +1779,8 @@ class H5PCore {
|
||||||
$this->relativePathRegExp = '/^((\.\.\/){1,2})(.*content\/)?(\d+|editor)\/(.+)$/';
|
$this->relativePathRegExp = '/^((\.\.\/){1,2})(.*content\/)?(\d+|editor)\/(.+)$/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save content and clear cache.
|
* Save content and clear cache.
|
||||||
*
|
*
|
||||||
|
@ -1827,7 +1823,7 @@ class H5PCore {
|
||||||
unset($content['libraryId'], $content['libraryName'], $content['libraryEmbedTypes'], $content['libraryFullscreen']);
|
unset($content['libraryId'], $content['libraryName'], $content['libraryEmbedTypes'], $content['libraryFullscreen']);
|
||||||
|
|
||||||
// // TODO: Move to filterParameters?
|
// // TODO: Move to filterParameters?
|
||||||
// if ($this->development_mode & H5PDevelopment::MODE_CONTENT) {
|
// if (isset($this->h5pD)) {
|
||||||
// // TODO: Remove Drupal specific stuff
|
// // TODO: Remove Drupal specific stuff
|
||||||
// $json_content_path = file_create_path(file_directory_path() . '/' . variable_get('h5p_default_path', 'h5p') . '/content/' . $id . '/content.json');
|
// $json_content_path = file_create_path(file_directory_path() . '/' . variable_get('h5p_default_path', 'h5p') . '/content/' . $id . '/content.json');
|
||||||
// if (file_exists($json_content_path) === TRUE) {
|
// if (file_exists($json_content_path) === TRUE) {
|
||||||
|
@ -1937,7 +1933,7 @@ class H5PCore {
|
||||||
public function loadContentDependencies($id, $type = NULL) {
|
public function loadContentDependencies($id, $type = NULL) {
|
||||||
$dependencies = $this->h5pF->loadContentDependencies($id, $type);
|
$dependencies = $this->h5pF->loadContentDependencies($id, $type);
|
||||||
|
|
||||||
if ($this->development_mode & H5PDevelopment::MODE_LIBRARY) {
|
if (isset($this->h5pD)) {
|
||||||
$developmentLibraries = $this->h5pD->getLibraries();
|
$developmentLibraries = $this->h5pD->getLibraries();
|
||||||
|
|
||||||
foreach ($dependencies as $key => $dependency) {
|
foreach ($dependencies as $key => $dependency) {
|
||||||
|
@ -2086,7 +2082,7 @@ class H5PCore {
|
||||||
*/
|
*/
|
||||||
public function loadLibrarySemantics($name, $majorVersion, $minorVersion) {
|
public function loadLibrarySemantics($name, $majorVersion, $minorVersion) {
|
||||||
$semantics = NULL;
|
$semantics = NULL;
|
||||||
if ($this->development_mode & H5PDevelopment::MODE_LIBRARY) {
|
if (isset($this->h5pD)) {
|
||||||
// Try to load from dev lib
|
// Try to load from dev lib
|
||||||
$semantics = $this->h5pD->getSemantics($name, $majorVersion, $minorVersion);
|
$semantics = $this->h5pD->getSemantics($name, $majorVersion, $minorVersion);
|
||||||
}
|
}
|
||||||
|
@ -2114,7 +2110,7 @@ class H5PCore {
|
||||||
*/
|
*/
|
||||||
public function loadLibrary($name, $majorVersion, $minorVersion) {
|
public function loadLibrary($name, $majorVersion, $minorVersion) {
|
||||||
$library = NULL;
|
$library = NULL;
|
||||||
if ($this->development_mode & H5PDevelopment::MODE_LIBRARY) {
|
if (isset($this->h5pD)) {
|
||||||
// Try to load from dev
|
// Try to load from dev
|
||||||
$library = $this->h5pD->getLibrary($name, $majorVersion, $minorVersion);
|
$library = $this->h5pD->getLibrary($name, $majorVersion, $minorVersion);
|
||||||
if ($library !== NULL) {
|
if ($library !== NULL) {
|
||||||
|
|
|
@ -19,6 +19,9 @@ H5P.ActionBar = (function ($, EventDispatcher) {
|
||||||
* @param {string} customClass Instead of type class
|
* @param {string} customClass Instead of type class
|
||||||
*/
|
*/
|
||||||
var addActionButton = function (type, customClass) {
|
var addActionButton = function (type, customClass) {
|
||||||
|
/**
|
||||||
|
* Handles selection of action
|
||||||
|
*/
|
||||||
var handler = function () {
|
var handler = function () {
|
||||||
self.trigger(type);
|
self.trigger(type);
|
||||||
};
|
};
|
||||||
|
@ -78,8 +81,8 @@ H5P.ActionBar = (function ($, EventDispatcher) {
|
||||||
*/
|
*/
|
||||||
self.hasActions = function () {
|
self.hasActions = function () {
|
||||||
return hasActions;
|
return hasActions;
|
||||||
}
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
ActionBar.prototype = Object.create(EventDispatcher.prototype);
|
ActionBar.prototype = Object.create(EventDispatcher.prototype);
|
||||||
ActionBar.prototype.constructor = ActionBar;
|
ActionBar.prototype.constructor = ActionBar;
|
||||||
|
|
Loading…
Reference in New Issue