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

Conflicts:
	h5p.classes.php
namespaces
Frank Ronny Larsen 2013-11-13 15:38:32 +01:00
commit 1d46204ac0
2 changed files with 16 additions and 15 deletions

View File

@ -244,7 +244,7 @@ class H5PValidator {
private $h5pOptional = array(
'contentType' => '/^.{1,255}$/',
'author' => '/^.{1,255}$/',
'license' => '/^(cc-by|cc-by-sa|cc-by-nd|cc-by-nc|cc-by-nc-sa|cc-by-nc-nd|pd|cr|MIT)$/',
'license' => '/^(cc-by|cc-by-sa|cc-by-nd|cc-by-nc|cc-by-nc-sa|cc-by-nc-nd|pd|cr|MIT|GPL1|GPL2|GPL3|MPL|MPL2)$/',
'dynamicDependencies' => array(
'machineName' => '/^[\w0-9\-\.]{1,255}$/i',
'majorVersion' => '/^[0-9]{1,5}$/',
@ -268,7 +268,7 @@ class H5PValidator {
private $libraryOptional = array(
'author' => '/^.{1,255}$/',
'license' => '/^(cc-by|cc-by-sa|cc-by-nd|cc-by-nc|cc-by-nc-sa|cc-by-nc-nd|pd|cr|MIT|GPL1|GPL2|GPL3)$/',
'license' => '/^(cc-by|cc-by-sa|cc-by-nd|cc-by-nc|cc-by-nc-sa|cc-by-nc-nd|pd|cr|MIT|GPL1|GPL2|GPL3|MPL|MPL2)$/',
'description' => '/^.{1,}$/',
'dynamicDependencies' => array(
'machineName' => '/^[\w0-9\-\.]{1,255}$/i',
@ -1225,6 +1225,9 @@ class H5PContentValidator {
if (in_array('ul', $tags) || in_array('ol', $tags) && ! in_array('li', $tags)) {
$tags[] = 'li';
}
if (in_array('del', $tags) || in_array('strike', $tags) && ! in_array('s', $tags)) {
$tags[] = 's';
}
// Strip invalid HTML tags.
$text = $this->filter_xss($text, $tags);
}

View File

@ -68,19 +68,17 @@ H5P.init = function () {
// H5Ps living in iframes. Note: Fullscreen button will be added
// inside iFrame if relevant
var $h5pIframes = H5P.jQuery(".h5p-iframe");
$h5pIframes.each(function (idx, iframe) {
var $iframe = H5P.jQuery(iframe),
contentId = $iframe.data('content-id'),
mainLibrary = $iframe.data('class');
// Get iFrame body, and reset it to contain only the normal H5P DIV.
$iframe.contents().find('body')
.html('<div class="h5p-content" data-class="' + mainLibrary + '" data-content-id="' + contentId + '"/>');
// Add scripts required for this iFrame from settings
H5PIntegration.addFilesToIframe($iframe, contentId);
});
if ($h5pIframes.length !== 0) {
$h5pIframes.each(function (idx, iframe) {
var $iframe = H5P.jQuery(iframe),
contentId = $iframe.data('content-id'),
mainLibrary = $iframe.data('class');
iframe.contentDocument.open();
iframe.contentDocument.write('<!doctype html><html><head>' + H5PIntegration.getHeadTags(contentId) + '</head><body><div class="h5p-content" data-class="' + mainLibrary + '" data-content-id="' + contentId + '"/></body></html>');
iframe.contentDocument.close();
});
// TODO: This seems very hacky... why can't we just use the resize event? What happens if we ain't done before the next interval starts?
setInterval(function () {
$h5pIframes.each(function (idx, iframe) {
@ -430,7 +428,7 @@ if (String.prototype.trim === undefined) {
// Finally, we want to run init when document is ready. But not if we're
// in an iFrame. Then we wait for parent to start init().
if (H5P.jQuery && !H5P.isFramed) {
if (H5P.jQuery) {
H5P.jQuery(document).ready(function () {
if (!H5P.initialized) {
H5P.initialized = true;