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
/**
* Link table name.
*
* @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
/**
* Category table name.
*
* @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) {
self::MENU, self::MANAGE, self::BACKEND => App::task()->checkContext('BACKEND')
&& App::blog()->isDefined()
&& App::auth()->check(App::auth()->makePermissions([
App::auth()::PERMISSION_CONTENT_ADMIN,
]), App::blog()->id()),
default => null,
};
2023-08-24 11:55:44 +00:00
}
}