/** * Get the manifest info of app as array */ private function setInfo() { $manifest = FS::exists($this->dir . "/manifest.json") ? FS::get($this->dir . "/manifest.json") : false; if ($manifest) { $details = json_decode($manifest, true); $details = array_replace_recursive(self::$manifestConfig, $details); /** * Add extra info with the manifest info */ $details['id'] = $this->app; $details['dir'] = $this->dir; $details['url'] = Lobby::getURL() . "/app/{$this->app}"; $details['srcURL'] = Lobby::getURL() . "/contents/apps/{$this->app}"; $details['adminURL'] = Lobby::getURL() . "/admin/app/{$this->app}"; /** * Prefer SVG over PNG */ $details['logo'] = $details['logo'] !== false ? FS::exists($this->dir . "/src/image/logo.svg") ? self::$appsURL . "/{$this->app}/src/image/logo.svg" : self::$appsURL . "/{$this->app}/src/image/logo.png" : Themes::getThemeURL() . "/src/main/image/app-logo.png"; $details["latestVersion"] = isset(self::$appUpdates[$this->app]) ? self::$appUpdates[$this->app] : null; $details = \Hooks::applyFilters("app.manifest", $details); /** * Insert the info as a property */ $this->info = $details; /** * Whether app is enabled */ $this->enabled = in_array($this->app, self::getEnabledApps(), true); return $details; } else { return false; } }
/** * Print the <head> tag */ public static function head($title = "") { header('Content-type: text/html; charset=utf-8'); if ($title != "") { self::setTitle($title); } if (Assets::issetJS('jquery')) { /** * Load jQuery, jQuery UI, Lobby Main, App separately without async */ $url = L_URL . "/includes/serve-assets.php?type=js&assets=" . implode(",", array(Assets::getJS('jquery'), Assets::getJS('jqueryui'), Assets::getJS('main'), Assets::issetJS('app') ? Assets::getJS('app') : "")); echo "<script src='{$url}'></script>"; Assets::removeJS("jquery"); Assets::removeJS("jqueryui"); Assets::removeJS("main"); } $jsURLParams = array("THEME_URL" => Themes::getThemeURL()); if (Apps::isAppRunning()) { $jsURLParams["APP_URL"] = urlencode(Apps::getInfo("url")); $jsURLParams["APP_SRC"] = urlencode(Apps::getInfo("srcURL")); } $jsURL = Assets::getServeURL("js", $jsURLParams); echo "<script>lobby.load_script_url = '" . $jsURL . "';</script>"; $cssServeParams = array("THEME_URL" => THEME_URL); /** * CSS Files */ if (Apps::isAppRunning()) { $cssServeParams["APP_URL"] = urlencode(Apps::getInfo("url")); $cssServeParams["APP_SRC"] = urlencode(Apps::getInfo("srcURL")); } echo Assets::getServeLinkTag($cssServeParams); echo "<link href='" . L_URL . "/favicon.ico' sizes='16x16 32x32 64x64' rel='shortcut icon' />"; /* Title */ echo "<title>" . self::$title . "</title>"; }