From 0f208fb36bca5e3395d34ce3553d98bab389ddd3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 27 Feb 2017 10:13:08 +0100 Subject: set minversion and maxversion for themes in view/theme/themename/php/theme.php instead of separate file. --- Zotlabs/Module/Admin/Site.php | 5 +++-- Zotlabs/Module/Settings/Display.php | 5 +++-- Zotlabs/Render/Theme.php | 5 +++-- include/plugin.php | 2 ++ view/theme/redbasic/.MINVERSION | 1 - view/theme/redbasic/php/theme.php | 2 ++ 6 files changed, 13 insertions(+), 7 deletions(-) delete mode 100644 view/theme/redbasic/.MINVERSION diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 3bb384ec5..b71e63030 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -164,8 +164,9 @@ class Site { $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)) { + $info = get_theme_info($f); + $compatible = check_plugin_versions($info); + if(!$compatible) { $theme_choices[$f] = $theme_choices_mobile[$f] = sprintf(t('%s - (Incompatible)'), $f); continue; } diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index d5be07a81..ee404daba 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -131,8 +131,9 @@ class Display { 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)) { + $info = get_theme_info($th); + $compatible = check_plugin_versions($info); + if(!$compatible) { $mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f); continue; } diff --git a/Zotlabs/Render/Theme.php b/Zotlabs/Render/Theme.php index 53bcfe664..7464a0db2 100644 --- a/Zotlabs/Render/Theme.php +++ b/Zotlabs/Render/Theme.php @@ -70,8 +70,9 @@ class Theme { $chosen_theme = $_GET['theme_preview']; // Check if $chosen_theme is compatible with core. If not fall back to default - $min_version = ((file_exists('view/theme/' . $chosen_theme . '/.MINVERSION')) ? file_get_contents('view/theme/' . $chosen_theme . '/.MINVERSION') : 0); - if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $info = get_theme_info($chosen_theme); + $compatible = check_plugin_versions($info); + if(!$compatible) { $chosen_theme = ''; } diff --git a/include/plugin.php b/include/plugin.php index 045efb805..29474735e 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -471,6 +471,8 @@ function get_theme_info($theme){ 'description' => '', 'author' => array(), 'version' => '', + 'minversion' => '', + 'maxversion' => '', 'compat' => '', 'credits' => '', 'maintainer' => array(), diff --git a/view/theme/redbasic/.MINVERSION b/view/theme/redbasic/.MINVERSION deleted file mode 100644 index 8bbe6cf74..000000000 --- a/view/theme/redbasic/.MINVERSION +++ /dev/null @@ -1 +0,0 @@ -2.2 diff --git a/view/theme/redbasic/php/theme.php b/view/theme/redbasic/php/theme.php index 0f0c43484..ac762502b 100644 --- a/view/theme/redbasic/php/theme.php +++ b/view/theme/redbasic/php/theme.php @@ -4,6 +4,8 @@ * * Name: Redbasic * * Description: Hubzilla standard theme * * Version: 2.0 + * * MinVersion: 2.2 + * * MaxVersion: 3.0 * * Author: Fabrixxm * * Maintainer: Mike Macgirvin * * Maintainer: Mario Vavti -- cgit v1.2.3