We call Theme:url() statically, make it also static.

This commit is contained in:
Klaus Weidenbach 2017-10-23 01:34:37 +02:00
parent 9090bfd1c3
commit a4fdf3fbbb

View File

@ -2,6 +2,8 @@
namespace Zotlabs\Render;
use App;
class Theme {
@ -11,8 +13,19 @@ class Theme {
static $session_theme = null;
static $session_mobile_theme = null;
/**
* @brief Array with base or fallback themes.
*/
static $base_themes = array('redbasic');
/**
* @brief Figure out the best matching theme and return it.
*
* The theme will depend on channel settings, mobile, session, core compatibility, etc.
*
* @return array
*/
static public function current(){
self::$system_theme = ((isset(\App::$config['system']['theme']))
@ -97,8 +110,6 @@ class Theme {
$fallback = array_merge(glob('view/theme/*/css/style.css'), glob('view/theme/*/php/style.php'));
if(count($fallback))
return(array(str_replace('view/theme/', '', substr($fallback[0], 0, -14))));
}
@ -107,12 +118,11 @@ class Theme {
*
* Provide a sane default if nothing is chosen or the specified theme does not exist.
*
* @param bool $installing default false
* @param bool $installing (optional) default false, if true return the name of the first base theme
*
* @return string
*/
function url($installing = false) {
static public function url($installing = false) {
if($installing)
return self::$base_themes[0];
@ -128,6 +138,7 @@ class Theme {
$schema_str = ((x(\App::$layout,'schema')) ? '&schema=' . App::$layout['schema'] : '');
if(($s) && (! $schema_str))
$schema_str = '&schema=' . $s;
$opts .= $schema_str;
if(file_exists('view/theme/' . $t . '/php/style.php'))
@ -139,7 +150,6 @@ class Theme {
function debug() {
logger('system_theme: ' . self::$system_theme);
logger('session_theme: ' . self::$session_theme);
}
}