diff --git a/h5p.classes.php b/h5p.classes.php
index f0850dd..d969a8a 100644
--- a/h5p.classes.php
+++ b/h5p.classes.php
@@ -399,12 +399,20 @@ class H5PValidator {
// Extract and then remove the package file.
$zip = new ZipArchive;
+
+ // Only allow files with the .h5p extension:
+ if (strtolower(substr($tmpPath, -3)) !== 'h5p') {
+ $this->h5pF->setErrorMessage($this->h5pF->t('The file you uploaded is not a valid HTML5 Package (It does not have the .h5p file extension)'));
+ H5PCore::deleteFileTree($tmpDir);
+ return;
+ }
+
if ($zip->open($tmpPath) === true) {
$zip->extractTo($tmpDir);
$zip->close();
}
else {
- $this->h5pF->setErrorMessage($this->h5pF->t('The file you uploaded is not a valid HTML5 Package.'));
+ $this->h5pF->setErrorMessage($this->h5pF->t('The file you uploaded is not a valid HTML5 Package (We are unable to unzip it)'));
H5PCore::deleteFileTree($tmpDir);
return;
}
@@ -430,7 +438,7 @@ class H5PValidator {
$mainH5pData = $this->getJsonData($filePath);
if ($mainH5pData === FALSE) {
$valid = FALSE;
- $this->h5pF->setErrorMessage($this->h5pF->t('Could not find or parse the main h5p.json file'));
+ $this->h5pF->setErrorMessage($this->h5pF->t('Could not parse the main h5p.json file'));
}
else {
$validH5p = $this->isValidH5pData($mainH5pData, $file, $this->h5pRequired, $this->h5pOptional);
@@ -439,7 +447,7 @@ class H5PValidator {
}
else {
$valid = FALSE;
- $this->h5pF->setErrorMessage($this->h5pF->t('Could not find or parse the main h5p.json file'));
+ $this->h5pF->setErrorMessage($this->h5pF->t('The main h5p.json file is not valid'));
}
}
}
@@ -485,8 +493,15 @@ class H5PValidator {
$libraryH5PData = $this->getLibraryData($file, $filePath, $tmpDir);
+ /* library's directory name and machineName in library.json must match */
+ if($libraryH5PData['machineName'] !== $file) {
+ $this->h5pF->setErrorMessage($this->h5pF->t('Library directory name must match machineName in library.json. (Directory: %directoryName , machineName: %machineName)', array('%directoryName' => $file, '%machineName' => $libraryH5PData['machineName'])));
+ $valid = FALSE;
+ continue;
+ }
+
if ($libraryH5PData) {
- $libraries[$file] = $libraryH5PData;
+ $libraries[$libraryH5PData['machineName']] = $libraryH5PData;
}
else {
$valid = FALSE;
@@ -1997,7 +2012,7 @@ class H5PContentValidator {
*/
public function validateLibrary(&$value, $semantics) {
// Check if provided library is within allowed options
- if (in_array($value->library, $semantics->options)) {
+ if (isset($value->library) && in_array($value->library, $semantics->options)) {
if (isset($this->semanticsCache[$value->library])) {
$librarySemantics = $this->semanticsCache[$value->library];
}
diff --git a/js/h5p-embed.js b/js/h5p-embed.js
index ecbef5e..3a3c58b 100644
--- a/js/h5p-embed.js
+++ b/js/h5p-embed.js
@@ -117,7 +117,11 @@ var H5P = H5P || (function () {
embedCode: content.embedCode
};
},
- i18n: content.i18n
+ i18n: content.i18n,
+ showH5PIconInActionBar: function () {
+ // Always show H5P-icon when embedding
+ return true;
+ }
};
};
@@ -168,7 +172,7 @@ var H5P = H5P || (function () {
$classes.addClass('h5p-semi-fullscreen');
iframe.style.position = 'fixed';
- var $disable = $element.prepend('Disable fullscreen').children(':first');
+ var $disable = $element.prepend('').children(':first');
var keyup, disableSemiFullscreen = function () {
$disable.remove();
$body.unbind('keyup', keyup);
diff --git a/js/h5p.js b/js/h5p.js
index 9b9087e..9d57ffb 100644
--- a/js/h5p.js
+++ b/js/h5p.js
@@ -51,7 +51,7 @@ H5P.init = function () {
// Check if we should add and display a fullscreen button for this H5P.
if (contentData.fullScreen == 1) {
- H5P.jQuery('
' + H5P.t('fullscreen') + '
').insertBefore($container).children().click(function () {
+ H5P.jQuery('').prependTo($container).children().click(function () {
H5P.fullScreen($container, instance);
});
};
@@ -75,7 +75,9 @@ H5P.init = function () {
H5P.openEmbedDialog($actions, contentData.embedCode);
});
}
- H5P.jQuery('').appendTo($actions);
+ if (H5PIntegration.showH5PIconInActionBar()) {
+ H5P.jQuery('').appendTo($actions);
+ }
$actions.insertAfter($container);
if (H5P.isFramed) {
@@ -207,7 +209,7 @@ H5P.fullScreen = function ($element, instance, exitCallback, body) {
$classes.addClass('h5p-semi-fullscreen');
H5P.isFullscreen = true;
- var $disable = $container.prepend('Disable fullscreen').children(':first');
+ var $disable = $container.prepend('').children(':first');
var keyup, disableSemiFullscreen = function () {
$disable.remove();
$body.unbind('keyup', keyup);
diff --git a/styles/h5p.css b/styles/h5p.css
index ea2c6b4..61bfe79 100644
--- a/styles/h5p.css
+++ b/styles/h5p.css
@@ -33,6 +33,10 @@ html.h5p-iframe, html.h5p-iframe > body {
background: #fefefe;
font-size: 16px;
line-height: 1.5em;
+ border: 1px solid #EEE;
+ border-bottom: none;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
}
html.h5p-iframe .h5p-content {
width: 100%;
@@ -49,15 +53,17 @@ html.h5p-iframe .h5p-content {
z-index: 101;
width: 100%;
height: 100%;
+ background-color: #FFF;
}
.h5p-content-controls {
margin: 0;
- text-align: right;
- position: relative;
+ position: absolute;
+ right: 0;
+ top: 0;
z-index: 3;
}
-.h5p-iframe > .h5p-fullscreen .h5p-content-controls {
+.h5p-fullscreen .h5p-content-controls {
display: none;
}
@@ -67,49 +73,44 @@ html.h5p-iframe .h5p-content {
.h5p-enable-fullscreen:before, .h5p-disable-fullscreen:before {
font-family: H5PFontAwesome4;
- margin-right: 10px;
- content: "\f0b2";
- font-size: 1.2em;
+
+ font-size: 25px;
+}
+.h5p-enable-fullscreen:before {
+ content: "\f065";
+}
+.h5p-disable-fullscreen:before {
+ content: "\f066";
}
.h5p-enable-fullscreen, .h5p-disable-fullscreen {
display: inline-block;
- line-height: 1.25em;
- padding: 6px 12px;
- border: 0.2em solid #fff;
- border-radius: 0.4em;
- margin: 1em 1.2em;
+ line-height: 25px;
+ width: 25px;
+ height: 25px;
+ padding: 6px 6px;
cursor: pointer;
- color: #fff;
- box-shadow: 0 0 0.5em #999;
- font-size: 12px;
+ color: #EEE;
+ background: rgb(0,0,0);
+ background: rgba(0,0,0,0.3);
text-decoration: none;
- font-family: Verdana, Arial, sans-serif;
-
- background: rgb(100,152,254); /* Old browsers */
- background: -moz-linear-gradient(top, rgba(100,152,254,1) 0%, rgba(4,104,206,1) 100%); /* FF3.6+ */
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(100,152,254,1)), color-stop(100%,rgba(4,104,206,1))); /* Chrome,Safari4+ */
- background: -webkit-linear-gradient(top, rgba(100,152,254,1) 0%,rgba(4,104,206,1) 100%); /* Chrome10+,Safari5.1+ */
- background: -o-linear-gradient(top, rgba(100,152,254,1) 0%,rgba(4,104,206,1) 100%); /* Opera 11.10+ */
- background: -ms-linear-gradient(top, rgba(100,152,254,1) 0%,rgba(4,104,206,1) 100%); /* IE10+ */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6498fe', endColorstr='#0468ce',GradientType=0 ); /* IE6-9 */
+ text-align: center;
}
.h5p-disable-fullscreen {
position: absolute;
- right: 0;
- top: 0;
+ right: 10px;
+ top: 10px;
z-index: 201;
+ background: rgb(0,0,0);
+ background: rgba(0,0,0,0.7);
}
.h5p-enable-fullscreen:hover, .h5p-disable-fullscreen:hover {
text-decoration: none;
+ background: rgba(0,0,0,0.5);
+}
- background: rgb(4,104,206); /* Old browsers */
- background: -moz-linear-gradient(top, rgba(4,104,206,1) 0%, rgba(100,152,254,1) 100%); /* FF3.6+ */
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(4,104,206,1)), color-stop(100%,rgba(100,152,254,1))); /* Chrome,Safari4+ */
- background: -webkit-linear-gradient(top, rgba(4,104,206,1) 0%,rgba(100,152,254,1) 100%); /* Chrome10+,Safari5.1+ */
- background: -o-linear-gradient(top, rgba(4,104,206,1) 0%,rgba(100,152,254,1) 100%); /* Opera 11.10+ */
- background: -ms-linear-gradient(top, rgba(4,104,206,1) 0%,rgba(100,152,254,1) 100%); /* IE10+ */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0468ce', endColorstr='#6498fe',GradientType=0 ); /* IE6-9 */
+.h5p-semi-fullscreen .h5p-content-controls {
+ display: none;
}
div.h5p-fullscreen {
@@ -179,14 +180,20 @@ div.h5p-fullscreen {
cursor: pointer;
}
-.h5p-actions {
+.h5p-content ul.h5p-actions {
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
overflow: hidden;
list-style: none;
- padding: 4px;
- margin: 0.25em 0;
- position: relative;
- z-index: 2;
+ padding: 0px 10px;
+ margin: 0;
+ height: 25px;
font-size: 12px;
+ background: #FAFAFA;
+ border-top: 1px solid #EEE;
+ border-bottom: 1px solid #EEE;
+ clear: both;
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.h5p-fullscreen .h5p-actions, .h5p-semi-fullscreen .h5p-actions {
display: none;