diff --git a/admin/class-h5p-plugin-admin.php b/admin/class-h5p-plugin-admin.php
index 6ae12d2..9e879ce 100644
--- a/admin/class-h5p-plugin-admin.php
+++ b/admin/class-h5p-plugin-admin.php
@@ -465,6 +465,9 @@ public function display_settings_page() {
$enable_lrs_content_types = filter_input(INPUT_POST, 'enable_lrs_content_types', FILTER_VALIDATE_BOOLEAN);
update_option('h5p_enable_lrs_content_types', $enable_lrs_content_types);
+ $use_system_temp_dir = filter_input(INPUT_POST, 'use_system_temp_dir', FILTER_VALIDATE_BOOLEAN);
+ update_option('h5p_use_system_temp_dir', $use_system_temp_dir);
+
// TODO: Make it possible to change site key
// $site_key = filter_input(INPUT_POST, 'site_key', FILTER_SANITIZE_SPECIAL_CHARS);
// if (preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i', $site_key)) {
@@ -497,6 +500,7 @@ public function display_settings_page() {
$about = get_option('h5p_icon', TRUE);
$track_user = get_option('h5p_track_user', TRUE);
$save_content_state = get_option('h5p_save_content_state', FALSE);
+ $use_system_temp_dir = get_option('h5p_use_system_temp_dir', FALSE);
$save_content_frequency = get_option('h5p_save_content_frequency', 30);
$show_toggle_view_others_h5p_contents = get_option('h5p_show_toggle_view_others_h5p_contents', 0);
$insert_method = get_option('h5p_insert_method', 'id');
diff --git a/admin/views/settings.php b/admin/views/settings.php
index 817ca58..7331c48 100644
--- a/admin/views/settings.php
+++ b/admin/views/settings.php
@@ -189,6 +189,16 @@ class="h5p-settings-disable-hub-checkbox"
+
+ | plugin_slug); ?> |
+
+
+ |
+
+
plugin_slug); ?>
diff --git a/public/class-h5p-plugin.php b/public/class-h5p-plugin.php
index fcf932b..05f9b05 100644
--- a/public/class-h5p-plugin.php
+++ b/public/class-h5p-plugin.php
@@ -388,6 +388,7 @@ public static function update_database() {
add_option('h5p_icon', TRUE);
add_option('h5p_track_user', TRUE);
add_option('h5p_save_content_state', FALSE);
+ add_option('h5p_use_system_temp_dir', FALSE);
add_option('h5p_save_content_frequency', 30);
add_option('h5p_site_key', get_option('h5p_h5p_site_uuid', FALSE));
add_option('h5p_show_toggle_view_others_h5p_contents', 0);
diff --git a/public/class-h5p-wordpress.php b/public/class-h5p-wordpress.php
index c2f01f6..6b1606a 100644
--- a/public/class-h5p-wordpress.php
+++ b/public/class-h5p-wordpress.php
@@ -92,9 +92,13 @@ public function getUploadedH5pFolderPath() {
static $dir;
if (is_null($dir)) {
- $plugin = H5P_Plugin::get_instance();
- $core = $plugin->get_h5p_instance('core');
- $dir = $core->fs->getTmpPath();
+ if (get_option('h5p_use_system_temp_dir', FALSE)) {
+ $dir = sys_get_temp_dir() . "/" . uniqid('h5p-');
+ } else {
+ $plugin = H5P_Plugin::get_instance();
+ $core = $plugin->get_h5p_instance('core');
+ $dir = $core->fs->getTmpPath();
+ }
}
return $dir;
@@ -107,11 +111,14 @@ public function getUploadedH5pPath() {
static $path;
if (is_null($path)) {
- $plugin = H5P_Plugin::get_instance();
- $core = $plugin->get_h5p_instance('core');
- $path = $core->fs->getTmpPath() . '.h5p';
+ if (get_option('h5p_use_system_temp_dir', FALSE)) {
+ $path = sys_get_temp_dir() . '/' . uniqid('h5p-') . '.h5p';
+ } else {
+ $plugin = H5P_Plugin::get_instance();
+ $core = $plugin->get_h5p_instance('core');
+ $path = $core->fs->getTmpPath() . '.h5p';
+ }
}
-
return $path;
}