cinecturlink2/src/My.php

53 lines
1.3 KiB
PHP
Raw Normal View History

2023-08-24 11:55:44 +00:00
<?php
2023-10-15 18:49:39 +00:00
2023-08-24 11:55:44 +00:00
declare(strict_types=1);
namespace Dotclear\Plugin\cinecturlink2;
2023-10-15 18:49:39 +00:00
use Dotclear\App;
2023-08-24 11:55:44 +00:00
use Dotclear\Module\MyPlugin;
2023-10-15 18:49:39 +00:00
/**
* @brief cinecturlink2 My helper.
* @ingroup cinecturlink2
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2023-08-24 11:55:44 +00:00
class My extends MyPlugin
{
2023-10-15 18:49:39 +00:00
/**
2023-10-23 20:54:27 +00:00
* Links table name.
2023-10-15 18:49:39 +00:00
*
* @var string CINECTURLINK_TABLE_NAME
*/
public const CINECTURLINK_TABLE_NAME = 'cinecturlink2';
2023-08-24 11:55:44 +00:00
2023-10-15 18:49:39 +00:00
/**
2023-10-23 20:54:27 +00:00
* Categories table name.
2023-10-15 18:49:39 +00:00
*
* @var string CATEGORY_TABLE_NAME
*/
public const CATEGORY_TABLE_NAME = 'cinecturlink2_cat';
/**
* Allowed media extension.
*
* @var array<int, string> ALLOWED_MEDIA_EXTENSION
*/
2023-08-24 11:55:44 +00:00
public const ALLOWED_MEDIA_EXTENSION = ['png', 'jpg', 'gif', 'bmp', 'jpeg'];
public static function checkCustomContext(int $context): ?bool
{
2023-10-15 18:49:39 +00:00
return match ($context) {
2023-10-23 09:28:57 +00:00
// Add content admin perm to backend
self::MENU, self::MANAGE => App::task()->checkContext('BACKEND')
2023-10-15 18:49:39 +00:00
&& App::auth()->check(App::auth()->makePermissions([
App::auth()::PERMISSION_CONTENT_ADMIN,
]), App::blog()->id()),
default => null,
};
2023-08-24 11:55:44 +00:00
}
}