diff --git a/dmometasettings.php b/dmometasettings.php index 30c83c4..e968ed4 100644 --- a/dmometasettings.php +++ b/dmometasettings.php @@ -37,6 +37,14 @@ public function set_defaults() if (!get_option('dxw_members_only_max_age')) { add_option('dxw_members_only_max_age', 0); } + + if (!get_option('dxw_members_only_max_age_static')) { + add_option('dxw_members_only_max_age_static', 0); + } + + if (!get_option('dxw_members_only_max_age_public')) { + add_option('dxw_members_only_max_age_public', 86400); + } } /** diff --git a/redirect.php b/redirect.php index b858b7b..4434b6b 100644 --- a/redirect.php +++ b/redirect.php @@ -128,6 +128,8 @@ function dxw_members_only_referrer_in_allow_list() } $max_age = absint(get_option('dxw_members_only_max_age')); + $max_age_static = absint(get_option('dxw_members_only_max_age_static')); + $max_age_static = absint(get_option('dxw_members_only_max_age_public')); do_action('dxw_members_only_redirect'); if ( @@ -155,14 +157,14 @@ function dxw_members_only_referrer_in_allow_list() // IP whitelist if (dxw_members_only_current_ip_in_whitelist()) { - header('Cache-Control: private, max-age=' . $max_age); + header('Cache-Control: private, max-age=' . $max_age_static); dxw_members_only_serve_uploads(); return; } // Referrer whitelist if (dxw_members_only_referrer_in_allow_list()) { - header('Cache-Control: private, max-age=' . $max_age); + header('Cache-Control: private, max-age=' . $max_age_static); dxw_members_only_serve_uploads(); return; } @@ -204,7 +206,7 @@ function dxw_members_only_referrer_in_allow_list() } if ($hit) { - header('Cache-Control: public'); + header('Cache-Control: public, max-age=' . $max_age_public); dxw_members_only_serve_uploads(); return; } diff --git a/settings.php b/settings.php index 6b4a142..33d937a 100644 --- a/settings.php +++ b/settings.php @@ -117,11 +117,12 @@ function dxw_members_only_options_page() -

+

+

- +
Defaults to 0 if not set. @@ -129,6 +130,26 @@ function dxw_members_only_options_page()
+ + + + + +
+ + Defaults to 0 if not set. +
+ + + + + + +
+ + Defaults to 86400 if not set. +
+