30 lines
678 B
PHP
30 lines
678 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Jinove\Vinoteca;
|
|
|
|
use Bitrix\Main\Engine\CurrentUser;
|
|
use Bitrix\Main\Localization\Loc;
|
|
|
|
class Account
|
|
{
|
|
public static function isAuthorized(): bool
|
|
{
|
|
return (int)CurrentUser::get()->getId() > 0;
|
|
}
|
|
|
|
public static function url(): string
|
|
{
|
|
return SITE_DIR . (self::isAuthorized() ? "personal/" : "login/");
|
|
}
|
|
|
|
public static function label(string $accountCode, string $loginCode): string
|
|
{
|
|
$code = self::isAuthorized() ? $accountCode : $loginCode;
|
|
$text = (string)Loc::getMessage($code);
|
|
|
|
return $text !== "" ? $text : (string)Loc::getMessage($accountCode);
|
|
}
|
|
}
|