2023-03-14 23:26:31 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @brief translater, a plugin for Dotclear 2
|
|
|
|
*
|
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
|
|
|
*
|
|
|
|
* @author Jean-Christian Denis & contributors
|
|
|
|
*
|
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Dotclear\Plugin\translater;
|
|
|
|
|
|
|
|
use dcCore;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Plugin definitions
|
|
|
|
*/
|
|
|
|
class My
|
|
|
|
{
|
2023-05-08 08:50:59 +00:00
|
|
|
/** @var string Locales folder name */
|
2023-03-17 23:36:11 +00:00
|
|
|
public const LOCALES_FOLDER = 'locales';
|
|
|
|
|
2023-03-14 23:26:31 +00:00
|
|
|
/**
|
2023-05-08 08:50:59 +00:00
|
|
|
* This module id.
|
2023-03-14 23:26:31 +00:00
|
|
|
*/
|
|
|
|
public static function id(): string
|
|
|
|
{
|
|
|
|
return basename(dirname(__DIR__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-05-08 08:50:59 +00:00
|
|
|
* This module name.
|
2023-03-14 23:26:31 +00:00
|
|
|
*/
|
|
|
|
public static function name(): string
|
|
|
|
{
|
2023-05-08 08:50:59 +00:00
|
|
|
$name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
|
|
|
|
|
|
|
|
return __(is_string($name) ? $name : self::id());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This module path.
|
|
|
|
*/
|
|
|
|
public static function path(): string
|
|
|
|
{
|
|
|
|
return dirname(__DIR__);
|
2023-03-14 23:26:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of allowed backup folder
|
|
|
|
*/
|
|
|
|
public static function backupFoldersCombo(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
__('locales folders of each module') => 'module',
|
|
|
|
__('plugins folder root') => 'plugin',
|
|
|
|
__('public folder root') => 'public',
|
|
|
|
__('cache folder of Dotclear') => 'cache',
|
|
|
|
__('locales folder of translater') => self::id(),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of possible home tab of the plugin
|
|
|
|
*/
|
2023-03-16 21:58:06 +00:00
|
|
|
public static function startPageCombo(): array
|
2023-03-14 23:26:31 +00:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
__('Plugins') => 'plugin',
|
|
|
|
__('Themes') => 'theme',
|
|
|
|
__('Home') => '-',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of place of tranlsations
|
|
|
|
*/
|
|
|
|
public static function l10nGroupsCombo(): array
|
|
|
|
{
|
|
|
|
$groups = [
|
|
|
|
'main', 'public', 'theme', 'admin', 'date', 'error',
|
|
|
|
];
|
|
|
|
|
|
|
|
return array_combine($groups, $groups);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of user info can be parsed
|
|
|
|
*/
|
|
|
|
public static function defaultUserInformations(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'firstname', 'displayname', 'name', 'email', 'url',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of distributed plugins and themes
|
|
|
|
*/
|
|
|
|
public static function defaultDistribModules(string $type): array
|
|
|
|
{
|
|
|
|
$types = [
|
|
|
|
'plugin' => explode(',', DC_DISTRIB_PLUGINS),
|
|
|
|
'theme' => explode(',', DC_DISTRIB_THEMES),
|
|
|
|
];
|
|
|
|
|
|
|
|
return $types[$type] ?? [];
|
|
|
|
}
|
|
|
|
}
|