diff --git a/misuzu.php b/misuzu.php index 9694150e..5c96f4cc 100644 --- a/misuzu.php +++ b/misuzu.php @@ -259,6 +259,14 @@ if(!empty($userDisplayInfo)) if(!empty($userInfo)) Template::set('current_user2', $userInfo); +if(Config::has('matomo.endpoint') && Config::has('matomo.javascript') && Config::has('matomo.site')) { + Template::set([ + 'matomo_endpoint' => Config::get('matomo.endpoint', Config::TYPE_STR), + 'matomo_js' => Config::get('matomo.javascript', Config::TYPE_STR), + 'matomo_site' => Config::get('matomo.site', Config::TYPE_STR), + ]); +} + $inManageMode = starts_with($_SERVER['REQUEST_URI'], '/manage'); $hasManageAccess = User::hasCurrent() && !User::getCurrent()->hasActiveWarning() diff --git a/src/Config.php b/src/Config.php index 81bb60f0..8b728d5f 100644 --- a/src/Config.php +++ b/src/Config.php @@ -43,6 +43,10 @@ final class Config { return $value ?? $default ?? self::DEFAULTS[$type]; } + public static function has(string $key): bool { + return array_key_exists($key, self::$config); + } + public static function set(string $key, $value, bool $soft = false): void { self::$config[$key] = $value; diff --git a/src/Template.php b/src/Template.php index 08766f56..7c0fd769 100644 --- a/src/Template.php +++ b/src/Template.php @@ -45,7 +45,6 @@ final class Template { echo self::renderRaw($file, $vars); } - /// DEPRECATED: Will be removed in the future, use the $vars param for render and renderRaw instead. public static function set($arrayOrKey, $value = null): void { if(is_string($arrayOrKey)) { self::$vars[$arrayOrKey] = $value; diff --git a/templates/master.twig b/templates/master.twig index 4b806457..35328929 100644 --- a/templates/master.twig +++ b/templates/master.twig @@ -8,57 +8,72 @@ - {% if site_background is defined %} - - {% endif %} - {% if site_logo is defined %} - - {% endif %} +{% if site_background is defined %} + +{% endif %} +{% if site_logo is defined %} + +{% endif %} -
- {% include '_layout/header.twig' %} +{% include '_layout/header.twig' %}