Vinoteca: wine shop on 1C-Bitrix (module, template, components, pages)
This commit is contained in:
commit
52795535ae
586 files changed
+27619
No files matched your search
@@ -0,0 +1,29 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user