diff options
author | Mario Vavti <mario@mariovavti.com> | 2017-02-26 21:01:20 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-02-26 21:22:19 +0100 |
commit | 8a69a5c3c7bd0188228d5c1c8580e5331a66e2da (patch) | |
tree | cc9bc98e5bec71d5e443c0f6d79038ba74807c1b /Zotlabs/Module | |
parent | e819727b09f0b0eded552813c8336664b1dd1e1f (diff) | |
download | volse-hubzilla-8a69a5c3c7bd0188228d5c1c8580e5331a66e2da.tar.gz volse-hubzilla-8a69a5c3c7bd0188228d5c1c8580e5331a66e2da.tar.bz2 volse-hubzilla-8a69a5c3c7bd0188228d5c1c8580e5331a66e2da.zip |
add a minversion to the theme and fallback to default if requirement is not met. mark incompatible themes in the theme selector
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Admin/Site.php | 9 | ||||
-rw-r--r-- | Zotlabs/Module/Admin/Themes.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Display.php | 12 |
3 files changed, 18 insertions, 5 deletions
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 829ca71e4..3bb384ec5 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -163,6 +163,13 @@ class Site { foreach($files as $file) { $vars = ''; $f = basename($file); + + $min_version = ((file_exists('view/theme/' . $f . '/.MINVERSION')) ? file_get_contents('view/theme/' . $f . '/.MINVERSION') : 0); + if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $theme_choices[$f] = $theme_choices_mobile[$f] = sprintf(t('%s - (Incompatible)'), $f); + continue; + } + if (file_exists($file . '/library')) continue; if (file_exists($file . '/mobile')) @@ -310,4 +317,4 @@ class Site { )); } -}
\ No newline at end of file +} diff --git a/Zotlabs/Module/Admin/Themes.php b/Zotlabs/Module/Admin/Themes.php index 63a9a1670..fc908ec8b 100644 --- a/Zotlabs/Module/Admin/Themes.php +++ b/Zotlabs/Module/Admin/Themes.php @@ -230,4 +230,4 @@ class Themes { -}
\ No newline at end of file +} diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index 67cecf1f5..d5be07a81 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -130,12 +130,19 @@ class Display { if($allowed_themes) { foreach($allowed_themes as $th) { $f = $th; + + $min_version = ((file_exists('view/theme/' . $th . '/.MINVERSION')) ? file_get_contents('view/theme/' . $th . '/.MINVERSION') : 0); + if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f); + continue; + } + $is_experimental = file_exists('view/theme/' . $th . '/experimental'); $unsupported = file_exists('view/theme/' . $th . '/unsupported'); $is_mobile = file_exists('view/theme/' . $th . '/mobile'); $is_library = file_exists('view/theme/'. $th . '/library'); - $mobile_themes["---"] = t("No special theme for mobile devices"); - + $mobile_themes['---'] = t("No special theme for mobile devices"); + if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ $theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f); if (! $is_library) { @@ -147,7 +154,6 @@ class Display { } } } - } } |