=')) || ($min_version == 0)) { $chosen_theme = ''; } // Allow theme selection of the form 'theme_name:schema_name' $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'))) { return($themepair); } foreach(self::$base_themes as $t) { if(file_exists('view/theme/' . $t . '/css/style.css') || file_exists('view/theme/' . $t . '/php/style.php')) { return(array($t)); } } // Worst case scenario, the default base theme or themes don't exist; perhaps somebody renamed it/them. // Find any theme at all and use it. $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)))); } /** * @brief Return full URL to theme which is currently in effect. * * Provide a sane default if nothing is chosen or the specified theme does not exist. * * @param bool $installing default false * * @return string */ function url($installing = false) { if($installing) return self::$base_themes[0]; $theme = self::current(); $t = $theme[0]; $s = ((count($theme) > 1) ? $theme[1] : ''); $opts = ''; $opts = ((\App::$profile_uid) ? '?f=&puid=' . \App::$profile_uid : ''); $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')) return('/view/theme/' . $t . '/php/style.pcss' . $opts); return('/view/theme/' . $t . '/css/style.css'); } function debug() { logger('system_theme: ' . self::$system_theme); logger('session_theme: ' . self::$session_theme); } }