*/ public static function getTrustedProxies(): array { return defined("TRUSTED_PROXIES") ? constant("TRUSTED_PROXIES") : []; } /** * A secret string used for hashing things like session cookies * and CSRF tokens. If not set, it defaults to the database DSN, * which isn't ideal but is better than nothing. Newer versions * of the installer should set this automatically. */ public static function getSecret(): string { if (defined("SECRET")) { return constant("SECRET"); } return self::getDatabaseDsn(); } /** * Get the current version of Shimmie - these should be set as part * of the build/release process, and shouldn't be changed manually. */ public static function getVersion(bool $full = true): string { $ver = defined("VERSION") ? constant("VERSION") : "2.13.0-dev"; $time = defined("BUILD_TIME") ? substr(str_replace("-", "", constant("BUILD_TIME")), 0, 8) : null; $hash = defined("BUILD_HASH") ? substr(constant("BUILD_HASH"), 0, 7) : null; $git = file_exists(".git") ? "git" : null; if ($full) { return $ver . ($time ? "-$time" : "") . ($hash ? "-$hash" : "") . ($git ? "-$git" : ""); } return $ver; } /** * Get a list of which non-core extensions are enabled. This setting * should normally be set in `data/config/extensions.conf.php`, which * is created automatically when you enable or disable extensions * via the admin interface. * * @return array */ public static function getExtraExtensions(): array { // Up to 2.11 uses a comma-separated string, // but since 2.12 it's an array if (defined("EXTRA_EXTS")) { $v = constant("EXTRA_EXTS"); if (is_array($v)) { /** @var array $v */ return $v; } if (is_string($v)) { if ($v === "") { return []; } else { return explode(",", $v); } } } return []; } }