release 0.3

This commit is contained in:
Jean-Christian Denis 2023-01-06 00:48:09 +01:00
parent 0e80faf4fa
commit cc3bca98c4
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
11 changed files with 135 additions and 44 deletions

View file

@ -1,3 +1,7 @@
0.3 - 2023.01.06
* use namespace
* use abstract plugin id
0.2 - 2022.11.27
- update to Dotclear 2.24
- add fr translation
* update to Dotclear 2.24
* add fr translation

View file

@ -1,7 +1,18 @@
<?php
declare(strict_types=1);
$admin = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Admin']);
if ($admin::init()) {
$admin::process();
}
<?php
/**
* @brief testMail, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Osku and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
$admin = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Admin']);
if ($admin::init()) {
$admin::process();
}

View file

@ -7,9 +7,14 @@
*
* @author Osku and contributors
*
* @copyright Jean-Crhistian Denis
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
// can not use namespace as it is included inside a class method,
// and also can be included in third party plugins class methods.
if (!defined('DC_RC_PATH')) {
return null;
}
@ -18,13 +23,13 @@ $this->registerModule(
'Mail test',
'Send a simple mail from admin',
'Osku and contributors',
'0.2',
'0.3',
[
'requires' => [['core', '2.24']],
'permissions' => null,
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/testMail',
'details' => 'https://plugins.dotaddict.org/dc2/details/testMail',
'repository' => 'https://raw.githubusercontent.com/JcDenis/testMail/master/dcstore.xml',
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
]
);

View file

@ -1,4 +1,15 @@
<?php
/**
* @brief testMail, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Osku and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
$prepend = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Prepend']);

View file

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="testMail">
<name>Mail test</name>
<version>0.2</version>
<version>0.3</version>
<author>Osku and contributors</author>
<desc>Send a simple mail from admin</desc>
<file>https://github.com/JcDenis/testMail/releases/download/v0.2/plugin-testMail.zip</file>
<file>https://github.com/JcDenis/testMail/releases/download/v0.3/plugin-testMail.zip</file>
<da:dcmin>2.24</da:dcmin>
<da:details>https://plugins.dotaddict.org/dc2/details/testMail</da:details>
<da:support>https://github.com/JcDenis/testMail</da:support>

View file

@ -1,4 +1,15 @@
<?php
/**
* @brief testMail, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Osku 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\testMail;
@ -10,13 +21,11 @@ use dcPage;
class Admin
{
private static $name = '';
protected static $init = false;
public static function init(): bool
{
if (defined('DC_CONTEXT_ADMIN')) {
self::$name = __('Mail test');
self::$init = true;
}
@ -29,8 +38,8 @@ class Admin
return false;
}
dcCore::app()->menu[dcAdmin::MENU_SYSTEM]->addItem(
self::$name,
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name'),
dcCore::app()->adminurl->get('admin.plugin.' . basename(__NAMESPACE__)),
dcPage::getPF(basename(__NAMESPACE__) . '/icon.svg'),
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__NAMESPACE__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']),

View file

@ -7,7 +7,7 @@
*
* @author Osku and contributors
*
* @copyright Jean-Crhistian Denis
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
@ -29,10 +29,10 @@ use text;
class Manage
{
private static $active_headers = false;
private static $mail_to = '';
private static $mail_subject = '';
private static $mail_content = '';
protected static $init = false;
private static $mail_to = '';
private static $mail_subject = '';
private static $mail_content = '';
protected static $init = false;
public static function init(): bool
{
@ -91,13 +91,21 @@ class Manage
dcCore::app()->error->add($e->getMessage());
}
}
return null;
}
public static function render(): void
{
echo '<html><head><title>' . __('Mail test') . '</title></head><body>' .
dcPage::breadcrumb([__('System') => '', __('Mail test') => '']) .
echo
'<html><head><title>' .
dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') .
'</title></head><body>' .
dcPage::breadcrumb([
__('System') => '',
dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') => '',
]) .
dcPage::notices() . '
<div id="mail_testor">
@ -127,7 +135,7 @@ class Manage
dcCore::app()->formNonce() . '</p>' .
'</form>
</div>
</body>
</html>';
</body></html>';
}
}

View file

@ -1,4 +1,15 @@
<?php
/**
* @brief testMail, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Osku 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\testMail;
@ -29,7 +40,7 @@ class Prepend
foreach (self::LIBS as $lib) {
Clearbricks::lib()->autoload([
implode('\\', ['Dotclear','Plugin', basename(__NAMESAPCE__), $lib]) => __DIR__ . DIRECTORY_SEPARATOR . $lib . '.php'
implode('\\', ['Dotclear','Plugin', basename(__NAMESPACE__), $lib]) => __DIR__ . DIRECTORY_SEPARATOR . $lib . '.php',
]);
}

View file

@ -1,8 +1,19 @@
<?php
declare(strict_types=1);
$manage = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Manage']);
if ($manage::init()) {
$manage::process();
$manage::render();
}
<?php
/**
* @brief testMail, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Osku and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
$manage = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Manage']);
if ($manage::init()) {
$manage::process();
$manage::render();
}

18
locales/fr/main.lang.php Normal file
View file

@ -0,0 +1,18 @@
<?php
/**
* @package Dotclear
*
* @copyright Olivier Meunier & Association Dotclear
* @copyright GPL-2.0-only
*/
#
# DOT NOT MODIFY THIS FILE !
#
l10n::$locales['You must provide a content.'] = 'Vous devez fournir un contenu.';
l10n::$locales['Mail successuffly sent.'] = 'Mail envoyer avec succès.';
l10n::$locales['Mailto:'] = 'Envoyer à :';
l10n::$locales['Subject:'] = 'Sujet :';
l10n::$locales['Active mail headers'] = 'Activer les entêtes de mail';
l10n::$locales['Mail test'] = 'Mail test';
l10n::$locales['Send a simple mail from admin'] = 'Envoyer un simple mail depuis l\'admin';

View file

@ -1,18 +1,15 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: testMail 0.2\n"
"Project-Id-Version: testMail 0.2.1\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-11-27T22:19:31+00:00\n"
"Last-Translator: Jean-Crhistian Denis\n"
"PO-Revision-Date: 2023-01-05T23:44:36+00:00\n"
"Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "Mail test"
msgstr "Mail test"
msgid "You must provide a content."
msgstr "Vous devez fournir un contenu."
@ -28,3 +25,9 @@ msgstr "Sujet :"
msgid "Active mail headers"
msgstr "Activer les entêtes de mail"
msgid "Mail test"
msgstr "Mail test"
msgid "Send a simple mail from admin"
msgstr "Envoyer un simple mail depuis l'admin"