set minversion and maxversion for themes in view/theme/themename/php/theme.php instead of separate file.

This commit is contained in:
Mario Vavti 2017-02-27 10:13:08 +01:00
parent 4f07abe655
commit 0f208fb36b
6 changed files with 13 additions and 7 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 = '';
}

View File

@ -471,6 +471,8 @@ function get_theme_info($theme){
'description' => '',
'author' => array(),
'version' => '',
'minversion' => '',
'maxversion' => '',
'compat' => '',
'credits' => '',
'maintainer' => array(),

View File

@ -1 +0,0 @@
2.2

View File

@ -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