PluginProbe ʕ •ᴥ•ʔ
FAPI Member / 2.2.25
FAPI Member v2.2.25
2.2.33 2.2.32 trunk 1.9.47 2.1.18 2.2.24 2.2.25 2.2.26 2.2.28 2.2.29 2.2.30 2.2.31
fapi-member / src / Utils / AlertProvider.php
fapi-member / src / Utils Last commit date
AlertProvider.php 9 months ago ApiClient.php 9 months ago DateTimeHelper.php 9 months ago DateTimes.php 9 months ago DateTimesImmutable.php 9 months ago Debugger.php 9 months ago DisplayHelper.php 9 months ago EmailHelper.php 9 months ago PostTypeHelper.php 9 months ago Random.php 9 months ago SecurityValidator.php 9 months ago ShortcodeSubstitutor.php 9 months ago TemplateProvider.php 9 months ago functions.php 9 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