Merge branch 'master' of ssh://stash.amendor.com:7999/h5p/h5p-core-php

namespaces
Frank Ronny Larsen 2013-12-05 12:17:25 +01:00
commit 691a1c8be5
3 changed files with 43 additions and 18 deletions

View File

@ -1641,9 +1641,32 @@ class H5PContentValidator {
// code.
$validkeys = array_merge(array('path', 'mime'), $typevalidkeys);
if (isset($semantics->extraAttributes)) {
$validkeys = array_merge($validkeys, $semantics->extraAttributes);
$validkeys = array_merge($validkeys, $semantics->extraAttributes); // TODO: Validate extraAttributes
}
$this->filterParams($file, $validkeys);
if (isset($file->width)) {
$file->width = intval($file->width);
}
if (isset($file->height)) {
$file->height = intval($file->height);
}
if (isset($file->codecs)) {
$file->codecs = htmlspecialchars($file->codecs, ENT_QUOTES, 'UTF-8', FALSE);
}
if (isset($file->quality)) {
if (!is_object($file->quality) || !isset($file->quality->level) || !isset($file->quality->label)) {
unset($file->quality);
}
else {
$this->filterParams($file->quality, array('level', 'label'));
$file->quality->level = intval($file->quality->level);
$file->quality->label = htmlspecialchars($file->quality->label, ENT_QUOTES, 'UTF-8', FALSE);
}
}
}
/**
@ -1665,7 +1688,7 @@ class H5PContentValidator {
*/
public function validateVideo(&$video, $semantics) {
foreach ($video as &$variant) {
$this->_validateFilelike($variant, $semantics, array('width', 'height'));
$this->_validateFilelike($variant, $semantics, array('width', 'height', 'codecs', 'quality'));
}
}

View File

@ -104,8 +104,8 @@ H5P.init = function () {
* @param {function} exitCallback Callback function called when user exits fullscreen.
* @returns {undefined}
*/
H5P.fullScreenIframe = function (contentId, obj, exitCallback) {
H5P.fullScreen(H5P.jQuery('#iframe-wrapper-' + contentId), obj, exitCallback);
H5P.fullScreenIframe = function (contentId, obj, exitCallback, $body) {
H5P.fullScreen(H5P.jQuery('#h5p-iframe-' + contentId + '-wrapper'), obj, exitCallback, $body);
};
/**
@ -116,7 +116,7 @@ H5P.fullScreenIframe = function (contentId, obj, exitCallback) {
* @returns {undefined}
*/
H5P.resizeIframe = function (contentId, height) {
var iframe = document.getElementById('iframe-' + contentId);
var iframe = document.getElementById('h5p-iframe-' + contentId);
// Don't allow iFrame to grow beyond window height;
if (height > window.innerHeight) {
height = window.innerHeight;
@ -132,13 +132,17 @@ H5P.resizeIframe = function (contentId, height) {
* @param {function} exitCallback Callback function called when user exits fullscreen.
* @returns {undefined}
*/
H5P.fullScreen = function ($el, obj, exitCallback) {
H5P.fullScreen = function ($el, obj, exitCallback, $body) {
if ($body === undefined) {
$body = H5P.$body;
}
if (H5P.isFramed) {
var $classes = H5P.jQuery('html').add(H5P.$body).add($el);
$classes.addClass('h5p-fullscreen');
window.parent.H5P.fullScreenIframe($el.data('content-id'), obj, function () {
$classes.removeClass('h5p-fullscreen');
});
}, $body);
return;
}
@ -160,7 +164,7 @@ H5P.fullScreen = function ($el, obj, exitCallback) {
// H5P.jQuery('#h5pfullscreenreplacementplaceholder').before($el).remove();
$disable.remove();
H5P.isFullscreen = false;
H5P.$body.unbind('keyup', keyup);
$body.unbind('keyup', keyup);
H5P.jQuery(".h5p-iframe").each(function (idx, el) {
H5P.resizeIframe(H5P.jQuery(el).data('content-id'), 0);
@ -182,7 +186,7 @@ H5P.fullScreen = function ($el, obj, exitCallback) {
}
};
$disable.click(disableSemiFullscreen);
H5P.$body.keyup(keyup);
$body.keyup(keyup);
}
else {
var first, eventName = H5P.fullScreenBrowserPrefix + 'fullscreenchange';
@ -467,4 +471,4 @@ if (H5P.jQuery) {
H5P.init();
}
});
}
}

View File

@ -1,10 +1,8 @@
/* Font Awesome font licensed under SIL OFL 1.1 · Code licensed under MIT License */
@font-face {
font-family: 'FontAwesome';
src:url('../fonts/fontawesome-webfont.eot');
src:url('../fonts/FontAwesome.otf?#iefix') format('embedded-opentype'),
url('../fonts/fontawesome-webfont.woff') format('woff'),
url('../fonts/fontawesome-webfont.ttf') format('truetype'),
url('../fonts/fontawesome-webfont.svg') format('svg');
font-family: 'H5PFontAwesome4'; /* Named so to avoid collisions and preserve backwards compatibility! */
src: url('../fonts/fontawesome-webfont.eot?v=4.0.3');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
@ -42,7 +40,7 @@ div.h5p-semi-fullscreen {
}
.h5p-enable-fullscreen:before, .h5p-disable-fullscreen:before {
font-family: FontAwesome;
font-family: H5PFontAwesome4;
margin-right: 10px;
content: "\f0b2";
font-size: 1.2em;
@ -168,4 +166,4 @@ body.h5p-iframe-content div.h5p-content {
}
body.h5p-iframe-content.h5p-fullscreen div.h5p-content {
height: 100%;
}
}