diff --git a/admin/class-h5p-plugin-admin.php b/admin/class-h5p-plugin-admin.php
index 4c9d695..7d99440 100644
--- a/admin/class-h5p-plugin-admin.php
+++ b/admin/class-h5p-plugin-admin.php
@@ -454,6 +454,9 @@ public function display_settings_page() {
$save_content_frequency = filter_input(INPUT_POST, 'save_content_frequency', FILTER_VALIDATE_INT);
update_option('h5p_save_content_frequency', $save_content_frequency);
+ $save_content_storages = filter_input(INPUT_POST, 'save_content_storages', FILTER_VALIDATE_INT);
+ update_option('h5p_save_content_storages', $save_content_storages);
+
$show_toggle_view_others_h5p_contents = filter_input(INPUT_POST, 'show_toggle_view_others_h5p_contents', FILTER_VALIDATE_INT);
update_option('h5p_show_toggle_view_others_h5p_contents', $show_toggle_view_others_h5p_contents);
@@ -496,6 +499,7 @@ public function display_settings_page() {
$track_user = get_option('h5p_track_user', TRUE);
$save_content_state = get_option('h5p_save_content_state', FALSE);
$save_content_frequency = get_option('h5p_save_content_frequency', 30);
+ $save_content_storages = get_option('h5p_save_content_storages', 1);
$show_toggle_view_others_h5p_contents = get_option('h5p_show_toggle_view_others_h5p_contents', 0);
$insert_method = get_option('h5p_insert_method', 'id');
$enable_lrs_content_types = get_option('h5p_enable_lrs_content_types', FALSE);
diff --git a/admin/views/settings.php b/admin/views/settings.php
index 817ca58..6697200 100644
--- a/admin/views/settings.php
+++ b/admin/views/settings.php
@@ -113,13 +113,28 @@
plugin_slug); ?> |
-
-
-
-
+ |
+
+
+ plugin_slug); ?> |
+
+
+ |
+
+
+ plugin_slug); ?> |
+
+
|
diff --git a/public/class-h5p-plugin.php b/public/class-h5p-plugin.php
index 94dbd93..cf5dbb3 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_track_user', TRUE);
add_option('h5p_save_content_state', FALSE);
add_option('h5p_save_content_frequency', 30);
+ add_option('h5p_save_content_storages', 1);
add_option('h5p_site_key', get_option('h5p_h5p_site_uuid', FALSE));
add_option('h5p_show_toggle_view_others_h5p_contents', 0);
add_option('h5p_content_type_cache_updated_at', 0);
@@ -798,6 +799,31 @@ public function get_h5p_url($absolute = FALSE) {
return $absolute ? $url[$id]['abs'] : $url[$id]['rel'];
}
+ /**
+ * Get the storages for save content state.
+ *
+ * @since 1.15.1
+ * @return string
+ */
+ public function get_h5p_save_content_storages() {
+ $save_content_storages = array();
+
+ if (get_option('h5p_save_content_state', FALSE) != TRUE) {
+ return $save_content_storages;
+ }
+
+ $option = get_option('h5p_save_content_storages', FALSE);
+
+ if (($option & H5PSaveContentStorages::DATABASE) === H5PSaveContentStorages::DATABASE) {
+ $save_content_storages['database'] = TRUE;
+ }
+ if (($option & H5PSaveContentStorages::LOCALSTORAGE) === H5PSaveContentStorages::LOCALSTORAGE) {
+ $save_content_storages['localStorage'] = 'WP-bid-' . get_current_blog_id() . '-';
+ }
+
+ return $save_content_storages;
+ }
+
/**
* Get H5P language code from WordPress.
*
@@ -1174,6 +1200,7 @@ public function get_core_settings() {
'contentUserData' => admin_url('admin-ajax.php?token=' . wp_create_nonce('h5p_contentuserdata') . '&action=h5p_contents_user_data&content_id=:contentId&data_type=:dataType&sub_content_id=:subContentId')
),
'saveFreq' => get_option('h5p_save_content_state', FALSE) ? get_option('h5p_save_content_frequency', 30) : FALSE,
+ 'saveContentStorages' => $this->get_h5p_save_content_storages(),
'siteUrl' => get_site_url(),
'l10n' => array(
'H5P' => $core->getLocalization(),
@@ -1604,6 +1631,7 @@ public static function uninstall() {
delete_option('h5p_ext_communication');
delete_option('h5p_save_content_state');
delete_option('h5p_save_content_frequency');
+ delete_option('h5p_save_content_storages');
delete_option('h5p_show_toggle_view_others_h5p_contents');
delete_option('h5p_update_available');
delete_option('h5p_current_update');