add a minversion to the theme and fallback to default if requirement is not met. mark incompatible themes in the theme selector
This commit is contained in:
parent
e819727b09
commit
8a69a5c3c7
@ -163,6 +163,13 @@ class Site {
|
|||||||
foreach($files as $file) {
|
foreach($files as $file) {
|
||||||
$vars = '';
|
$vars = '';
|
||||||
$f = basename($file);
|
$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'))
|
if (file_exists($file . '/library'))
|
||||||
continue;
|
continue;
|
||||||
if (file_exists($file . '/mobile'))
|
if (file_exists($file . '/mobile'))
|
||||||
|
@ -130,11 +130,18 @@ class Display {
|
|||||||
if($allowed_themes) {
|
if($allowed_themes) {
|
||||||
foreach($allowed_themes as $th) {
|
foreach($allowed_themes as $th) {
|
||||||
$f = $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');
|
$is_experimental = file_exists('view/theme/' . $th . '/experimental');
|
||||||
$unsupported = file_exists('view/theme/' . $th . '/unsupported');
|
$unsupported = file_exists('view/theme/' . $th . '/unsupported');
|
||||||
$is_mobile = file_exists('view/theme/' . $th . '/mobile');
|
$is_mobile = file_exists('view/theme/' . $th . '/mobile');
|
||||||
$is_library = file_exists('view/theme/'. $th . '/library');
|
$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))){
|
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);
|
$theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f);
|
||||||
@ -147,7 +154,6 @@ class Display {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,8 +69,13 @@ class Theme {
|
|||||||
if(array_key_exists('theme_preview',$_GET))
|
if(array_key_exists('theme_preview',$_GET))
|
||||||
$chosen_theme = $_GET['theme_preview'];
|
$chosen_theme = $_GET['theme_preview'];
|
||||||
|
|
||||||
// Allow theme selection of the form 'theme_name:schema_name'
|
// 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)) {
|
||||||
|
$chosen_theme = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow theme selection of the form 'theme_name:schema_name'
|
||||||
$themepair = explode(':', $chosen_theme);
|
$themepair = explode(':', $chosen_theme);
|
||||||
|
|
||||||
if($chosen_theme && (file_exists('view/theme/' . $themepair[0] . '/css/style.css') || file_exists('view/theme/' . $themepair[0] . '/php/style.php'))) {
|
if($chosen_theme && (file_exists('view/theme/' . $themepair[0] . '/css/style.css') || file_exists('view/theme/' . $themepair[0] . '/php/style.php'))) {
|
||||||
|
1
view/theme/redbasic/.MINVERSION
Normal file
1
view/theme/redbasic/.MINVERSION
Normal file
@ -0,0 +1 @@
|
|||||||
|
2.2
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* * Name: Redbasic
|
* * Name: Redbasic
|
||||||
* * Description: Hubzilla standard theme
|
* * Description: Hubzilla standard theme
|
||||||
* * Version: 1.0
|
* * Version: 2.0
|
||||||
* * Author: Fabrixxm
|
* * Author: Fabrixxm
|
||||||
* * Maintainer: Mike Macgirvin
|
* * Maintainer: Mike Macgirvin
|
||||||
* * Maintainer: Mario Vavti
|
* * Maintainer: Mario Vavti
|
||||||
|
Reference in New Issue
Block a user