aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Theme_info.php
diff options
context:
space:
mode:
authorredmatrix <mike@macgirvin.com>2016-09-01 13:48:11 -0700
committerredmatrix <mike@macgirvin.com>2016-09-01 13:48:11 -0700
commit678148b9aa98ffb0b174aceb2e30f79ea116a566 (patch)
treeca7f2711bb6e2d4b3337b1c9e7d1486aa25fcba6 /Zotlabs/Module/Theme_info.php
parent549943fb1082bac14096d97ee2124052a8f6f364 (diff)
downloadvolse-hubzilla-678148b9aa98ffb0b174aceb2e30f79ea116a566.tar.gz
volse-hubzilla-678148b9aa98ffb0b174aceb2e30f79ea116a566.tar.bz2
volse-hubzilla-678148b9aa98ffb0b174aceb2e30f79ea116a566.zip
more work on theme select backend
Diffstat (limited to 'Zotlabs/Module/Theme_info.php')
-rw-r--r--Zotlabs/Module/Theme_info.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/Zotlabs/Module/Theme_info.php b/Zotlabs/Module/Theme_info.php
new file mode 100644
index 000000000..054ab6447
--- /dev/null
+++ b/Zotlabs/Module/Theme_info.php
@@ -0,0 +1,64 @@
+<?php
+
+namespace Zotlabs\Module;
+
+
+class Theme_info extends \Zotlabs\Web\Controller {
+
+ function get() {
+ $theme = argv(1);
+ if(! $theme)
+ killme();
+
+ $theme_config = "";
+ if(($themeconfigfile = $this->get_theme_config_file($theme)) != null){
+ require_once($themeconfigfile);
+ if(class_exists(ucfirst($theme) . 'Config')) {
+ $clsname = ucfirst($theme) . 'Config';
+ $th_config = new $clsname();
+ $schemas = $th_config->get_schemas();
+ }
+ $theme_config = theme_content($a);
+ }
+ $info = get_theme_info($theme);
+ if($info) {
+ // unfortunately there will be no translation for this string
+ $desc = $info['description'];
+ $version = $info['version'];
+ $credits = $info['credits'];
+ }
+ else {
+ $desc = '';
+ $version = '';
+ $credits = '';
+ }
+
+ $ret = [
+ 'theme' => $theme,
+ 'img' => get_theme_screenshot($theme),
+ 'desc' => $desc,
+ 'version' => $version,
+ 'credits' => $credits,
+ 'schemas' => $schemas,
+ 'config' => $theme_config
+ ];
+ json_return_and_die($ret);
+
+ }
+
+
+ function get_theme_config_file($theme){
+
+ $base_theme = \App::$theme_info['extends'];
+
+ if (file_exists("view/theme/$theme/php/config.php")){
+ return "view/theme/$theme/php/config.php";
+ }
+ if (file_exists("view/theme/$base_theme/php/config.php")){
+ return "view/theme/$base_theme/php/config.php";
+ }
+ return null;
+ }
+
+
+} \ No newline at end of file