aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Theme.php
blob: da23d9c15493775cef8ffd17e365c576c3910602 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php

namespace Zotlabs\Module;


class Theme 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);
		}

		$ret = array('theme' => $theme, '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;
	}


}