From f207c3be9b037ad770147a587341e1d122b1f466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20J=C3=B8rgensen?= Date: Tue, 23 Sep 2014 10:44:22 +0200 Subject: [PATCH 1/4] Setting language on export to 'und' if not defined --- h5p.classes.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/h5p.classes.php b/h5p.classes.php index 4a386a7..51ffcec 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1251,7 +1251,9 @@ Class H5PExport { // Build h5p.json $h5pJson = array ( 'title' => $content['title'], - 'language' => $content['language'], + // TODO - stop using 'und', this is not the preferred way. + // Either remove language from the json if not existing, or use "language": null + 'language' => isset($content['language']) ? $content['language'] : 'und', 'mainLibrary' => $content['library']['name'], 'embedTypes' => $embedTypes, ); From 212f8c6f0fa62f4ee99fcfa755cfa588391c4c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20J=C3=B8rgensen?= Date: Tue, 23 Sep 2014 12:00:21 +0200 Subject: [PATCH 2/4] Added H5P.htmlspecialchars() --- js/h5p.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/h5p.js b/js/h5p.js index 3b5db69..0500cc9 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -975,6 +975,13 @@ H5P.setFinished = function (contentId, points, maxPoints) { } }; +/** + * Mimics how php's htmlspecialchars works (the way we use it) + */ +H5P.htmlspecialchars = function(string) { + return string.toString().replace(//g, '>').replace(/'/g, ''').replace(/"/g, '"'); +}; + // Add indexOf to browsers that lack them. (IEs) if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (needle) { From 24be95a78ef29bf8c7adee3fb3669e28aa3561fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20J=C3=B8rgensen?= Date: Tue, 23 Sep 2014 12:59:08 +0200 Subject: [PATCH 3/4] Bumped core version because of the new function added --- h5p.classes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/h5p.classes.php b/h5p.classes.php index 4a386a7..ae8116f 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1344,7 +1344,7 @@ class H5PCore { public static $coreApi = array( 'majorVersion' => 1, - 'minorVersion' => 3 + 'minorVersion' => 4 ); public static $styles = array( 'styles/h5p.css', From 7e669884cee4e295b84e99941111ab498b7c12e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20J=C3=B8rgensen?= Date: Tue, 23 Sep 2014 13:01:39 +0200 Subject: [PATCH 4/4] Correct capitalization of H5P.htmlspecialchars function --- js/h5p.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/h5p.js b/js/h5p.js index 0500cc9..73f833a 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -978,7 +978,7 @@ H5P.setFinished = function (contentId, points, maxPoints) { /** * Mimics how php's htmlspecialchars works (the way we use it) */ -H5P.htmlspecialchars = function(string) { +H5P.htmlSpecialChars = function(string) { return string.toString().replace(//g, '>').replace(/'/g, ''').replace(/"/g, '"'); };