AlertProvider.php
11 months ago
ApiClient.php
11 months ago
DateTimeHelper.php
11 months ago
DateTimes.php
11 months ago
DateTimesImmutable.php
11 months ago
Debugger.php
11 months ago
DisplayHelper.php
11 months ago
EmailHelper.php
11 months ago
PostTypeHelper.php
11 months ago
Random.php
11 months ago
SecurityValidator.php
11 months ago
ShortcodeSubstitutor.php
11 months ago
TemplateProvider.php
11 months ago
functions.php
11 months ago
AlertProvider.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FapiMember\Utils; |
| 4 | |
| 5 | use FapiMember\FapiMemberPlugin; |
| 6 | use FapiMember\Model\Enums\Alert; |
| 7 | use FapiMember\Model\Enums\Types\AlertType; |
| 8 | |
| 9 | class AlertProvider |
| 10 | { |
| 11 | private static array $alerts = [ |
| 12 | Alert::API_FORM_EMPTY => [AlertType::ERROR, 'Zadejte e-mail i API klíč.'], |
| 13 | Alert::API_FORM_SUCCESS => [AlertType::SUCCESS, 'Údaje pro API uloženy.'], |
| 14 | Alert::API_FORM_ERROR => [AlertType::ERROR, 'Neplatné údaje pro API.'], |
| 15 | Alert::API_FORM_CREDENTIALS_EXIST => [AlertType::ERROR, 'Zadané údaje pro API se již používají.'], |
| 16 | Alert::API_FORM_TOO_MANY_CREDENTIALS => [AlertType::ERROR, 'Není možné propojit více než ' . FapiMemberPlugin::CONNECTED_API_KEYS_LIMIT . ' účtů.'], |
| 17 | Alert::API_FORM_CREDENTIALS_REMOVED => [AlertType::SUCCESS, 'Účet byl odpojen.'], |
| 18 | Alert::SECTION_NAME_EMPTY => [AlertType::ERROR, 'Název sekce/úrovně je prázdný.'], |
| 19 | Alert::REMOVE_LEVEL_SUCCESSFUL => [AlertType::SUCCESS, 'Sekce/úroveň smazána.'], |
| 20 | Alert::INTERNAL_ERROR => [AlertType::ERROR, 'Došlo k interní chybě.'], |
| 21 | Alert::SETTINGS_SAVED => [AlertType::SUCCESS, 'Nastavení uložena.'], |
| 22 | Alert::LEVEL_ALREADY_EXISTS => [AlertType::ERROR, 'Sekce/úroveň s tímto názvem již existuje.'], |
| 23 | Alert::REORDER_FAILED => [AlertType::ERROR, 'Nelze přeřadit sekci/úroveň.'], |
| 24 | Alert::MEMBERSHIP_REGISTERED_EXTENDED => [AlertType::WARNING, 'Datum registrace sekce bylo přenastaveno dle úrovně.'], |
| 25 | Alert::MEMBERSHIP_UNTIL_EXTENDED => [AlertType::WARNING, 'Datum expirace sekce bylo přenastaveno dle úrovně.'], |
| 26 | Alert::INVALID_EMAIL => [AlertType::ERROR, 'E-mailová adresa není validní.'], |
| 27 | Alert::MISSING_EMAIL => [AlertType::ERROR, 'Zadejte prosím e-mailovou adresu.'], |
| 28 | Alert::IMPORT_FAILED => [AlertType::ERROR, 'Import selhal.'], |
| 29 | Alert::IMPORT_LEVEL_ID_DOESNT_EXIST => [AlertType::ERROR, 'Soubor obsahuje neplatné ID sekce/úrovně.'], |
| 30 | ]; |
| 31 | |
| 32 | /** @return array<string> */ |
| 33 | public static function getError(string $key): array |
| 34 | { |
| 35 | $error = self::$alerts[$key]; |
| 36 | |
| 37 | return [ |
| 38 | 'type' => $error[0], |
| 39 | 'message' => $error[1], |
| 40 | ]; |
| 41 | } |
| 42 | |
| 43 | } |
| 44 |