make docs url dynamic based on (night/testing) version

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann 2024-05-12 13:51:03 +02:00
parent 73182a6909
commit cda0b3116f
No known key found for this signature in database
GPG Key ID: C121F97338D7A352
7 changed files with 31 additions and 13 deletions

View File

@ -72,7 +72,7 @@ if ($page == 'overview' || $page == 'domains') {
}
$actions_links[] = [
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/domains/',
'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/domains/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'

View File

@ -77,7 +77,7 @@ if ($page == 'overview' || $page == 'emails') {
}
$actions_links[] = [
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/emails/',
'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/emails/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
@ -139,7 +139,7 @@ if ($page == 'email_domain') {
];
}
$actions_links[] = [
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/emails/',
'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/emails/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'

View File

@ -75,7 +75,7 @@ if ($page == 'overview' || $page == 'htpasswds') {
];
$actions_links[] = [
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/extras/',
'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/extras/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
@ -200,7 +200,7 @@ if ($page == 'overview' || $page == 'htpasswds') {
];
$actions_links[] = [
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/extras/',
'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/extras/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
@ -349,7 +349,7 @@ if ($page == 'overview' || $page == 'htpasswds') {
$actions_links = [
[
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/extras/',
'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/extras/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'

View File

@ -65,7 +65,7 @@ if ($page == 'overview' || $page == 'accounts') {
];
}
$actions_links[] = [
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/ftp-accounts/',
'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/ftp-accounts/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'

View File

@ -89,7 +89,7 @@ if ($page == 'overview' || $page == 'mysqls') {
}
$actions_links[] = [
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/databases/',
'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/databases/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'

View File

@ -39,7 +39,7 @@ final class Froxlor
// Distribution branding-tag (used for Debian etc.)
const BRANDING = '';
const DOCS_URL = 'https://docs.froxlor.org/v2.2/';
const DOCS_URL = 'https://docs.froxlor.org';
/**
* return path to where froxlor is installed, e.g.
@ -52,6 +52,14 @@ final class Froxlor
return dirname(__DIR__, 2) . '/';
}
public static function getDocsUrl(): string
{
if (preg_match('/(.+)-(dev|beta|rc)\d+$/', self::VERSION)) {
return self::DOCS_URL . '/dev/';
}
return self::DOCS_URL . '/v' . self::getShortVersion() . '/';
}
/**
* return basic version
*
@ -62,6 +70,16 @@ final class Froxlor
return self::VERSION;
}
/**
* return short basic version
*
* @return string
*/
public static function getShortVersion(): string
{
return explode(".", self::VERSION)[0] . '.' . explode(".", self::VERSION)[1];
}
/**
* return version + branding and database-version
*

View File

@ -161,13 +161,13 @@ return [
'show_element' => (!Settings::IsInList('panel.customer_hide_options', 'misc.documentation')),
'elements' => [
[
'url' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/',
'url' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/',
'label' => lng('admin.userguide'),
'new_window' => true,
'is_external' => true,
],
[
'url' => \Froxlor\Froxlor::DOCS_URL . 'api-guide/',
'url' => \Froxlor\Froxlor::getDocsUrl() . 'api-guide/',
'label' => lng('admin.apiguide'),
'new_window' => true,
'show_element' => Settings::Get('api.enabled') == 1 && CurrentUser::getField('api_allowed') == 1,
@ -348,13 +348,13 @@ return [
'icon' => 'fa-solid fa-circle-info',
'elements' => [
[
'url' => \Froxlor\Froxlor::DOCS_URL . 'admin-guide/',
'url' => \Froxlor\Froxlor::getDocsUrl() . 'admin-guide/',
'label' => lng('admin.adminguide'),
'new_window' => true,
'is_external' => true,
],
[
'url' => \Froxlor\Froxlor::DOCS_URL . 'api-guide/',
'url' => \Froxlor\Froxlor::getDocsUrl() . 'api-guide/',
'label' => lng('admin.apiguide'),
'new_window' => true,
'show_element' => Settings::Get('api.enabled') == 1,