| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Slots. |
| 5 |
*/ |
| 6 |
|
| 7 |
namespace Extendify\Notifications; |
| 8 |
|
| 9 |
defined('ABSPATH') || die('No direct access.'); |
| 10 |
|
| 11 |
/** |
| 12 |
* The slots a notification can be placed in. Slot names arrive from the API, so |
| 13 |
* ones this release has no container for are dropped rather than trusted. |
| 14 |
*/ |
| 15 |
class Slots |
| 16 |
{ |
| 17 |
// phpcs:disable PSR12.Properties.ConstantVisibility.NotFound -- 7.0 floor: no const visibility |
| 18 |
const ADMIN_DASHBOARD = 'admin-dashboard'; |
| 19 |
const ADMIN_OTHERS = 'admin-others'; |
| 20 |
const ADMIN_ASSIST = 'admin-assist'; |
| 21 |
const AGENT_CHAT = 'agent-chat'; |
| 22 |
const FRONTEND_BOTTOM = 'frontend-bottom'; |
| 23 |
const FRONTEND_TOPBAR = 'frontend-topbar'; |
| 24 |
|
| 25 |
/** |
| 26 |
* A slot missing from src/Notifications/slots.js renders nothing. |
| 27 |
*/ |
| 28 |
const ALLOWLIST = [ |
| 29 |
self::ADMIN_DASHBOARD, |
| 30 |
self::ADMIN_OTHERS, |
| 31 |
self::ADMIN_ASSIST, |
| 32 |
self::AGENT_CHAT, |
| 33 |
self::FRONTEND_BOTTOM, |
| 34 |
self::FRONTEND_TOPBAR, |
| 35 |
]; |
| 36 |
// phpcs:enable PSR12.Properties.ConstantVisibility.NotFound |
| 37 |
|
| 38 |
public static function isKnown(string $slot) |
| 39 |
{ |
| 40 |
return in_array($slot, self::ALLOWLIST, true); |
| 41 |
} |
| 42 |
} |
| 43 |
|