arlequin/src/My.php

94 lines
2.5 KiB
PHP
Raw Normal View History

2023-04-10 21:26:28 +00:00
<?php
/**
* @brief arlequin, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Oleksandr Syenchuk, Pierre Van Glabeke and 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\arlequin;
use dcCore;
/**
2023-05-08 08:23:01 +00:00
* This module definitions.
2023-04-10 21:26:28 +00:00
*/
class My
{
/**
* This module id.
*/
public static function id(): string
{
return basename(dirname(__DIR__));
}
/**
* This module name.
*/
public static function name(): string
{
2023-05-08 08:23:01 +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-04-10 21:26:28 +00:00
}
/**
* Get distributed models.
*
* Use Behavior arlequinAddModels to add models with synthax:
* [
* 'name'=>__('Model name'), // Nom du modèle prédéfini
* 's_html'=>'[HTML code]', // Code HTML du sélecteur de thème
* 'e_html'=>'[HTML code]', // Code HTML d'un item pouvant être sélectionné
* 'a_html'=>'[HTML code]' // Code HTML d'un item actif (thème sélectionné)
* ]
*/
public static function distributedModels(): array
{
return [
[
'name' => __('Bullets list'),
's_html' => '<ul>%2$s</ul>',
'e_html' => '<li><a href="%1$s%2$s%3$s">%4$s</a></li>',
'a_html' => '<li><strong>%4$s</strong></li>',
],
[
'name' => __('Scrolled list'),
's_html' => '<form action="%1$s" method="post">' . "\n" .
'<p><select name="theme">' . "\n" .
'%2$s' . "\n" .
'</select>' . "\n" .
'<input type="submit" value="' . __('ok') . '"/></p>' . "\n" .
'</form>',
'e_html' => '<option value="%3$s">%4$s</option>',
'a_html' => '<option value="%3$s" selected="selected" disabled="disabled">%4$s (' . __('active theme') . ')</option>',
],
];
}
public static function defaultModel(): array
{
return [
2023-04-12 08:35:03 +00:00
'name' => __('Default'),
2023-04-10 21:26:28 +00:00
'e_html' => '<li><a href="%1$s%2$s%3$s">%4$s</a></li>',
'a_html' => '<li><strong>%4$s</strong></li>',
's_html' => '<ul>%2$s</ul>',
];
}
}