release 0.3

This commit is contained in:
Jean-Christian Paul 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 0.2 - 2022.11.27
- update to Dotclear 2.24 * update to Dotclear 2.24
- add fr translation * add fr translation

View File

@ -1,7 +1,18 @@
<?php <?php
declare(strict_types=1); /**
* @brief testMail, a plugin for Dotclear 2
$admin = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Admin']); *
if ($admin::init()) { * @package Dotclear
$admin::process(); * @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 * @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 * @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')) { if (!defined('DC_RC_PATH')) {
return null; return null;
} }
@ -18,13 +23,13 @@ $this->registerModule(
'Mail test', 'Mail test',
'Send a simple mail from admin', 'Send a simple mail from admin',
'Osku and contributors', 'Osku and contributors',
'0.2', '0.3',
[ [
'requires' => [['core', '2.24']], 'requires' => [['core', '2.24']],
'permissions' => null, 'permissions' => null,
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://github.com/JcDenis/testMail', 'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
'details' => 'https://plugins.dotaddict.org/dc2/details/testMail', 'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
'repository' => 'https://raw.githubusercontent.com/JcDenis/testMail/master/dcstore.xml', 'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
] ]
); );

View File

@ -1,4 +1,15 @@
<?php <?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); declare(strict_types=1);
$prepend = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Prepend']); $prepend = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Prepend']);

View File

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

View File

@ -1,4 +1,15 @@
<?php <?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); declare(strict_types=1);
namespace Dotclear\Plugin\testMail; namespace Dotclear\Plugin\testMail;
@ -10,13 +21,11 @@ use dcPage;
class Admin class Admin
{ {
private static $name = '';
protected static $init = false; protected static $init = false;
public static function init(): bool public static function init(): bool
{ {
if (defined('DC_CONTEXT_ADMIN')) { if (defined('DC_CONTEXT_ADMIN')) {
self::$name = __('Mail test');
self::$init = true; self::$init = true;
} }
@ -29,8 +38,8 @@ class Admin
return false; return false;
} }
dcCore::app()->menu[dcAdmin::MENU_SYSTEM]->addItem( dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
self::$name, dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name'),
dcCore::app()->adminurl->get('admin.plugin.' . basename(__NAMESPACE__)), dcCore::app()->adminurl->get('admin.plugin.' . basename(__NAMESPACE__)),
dcPage::getPF(basename(__NAMESPACE__) . '/icon.svg'), dcPage::getPF(basename(__NAMESPACE__) . '/icon.svg'),
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__NAMESPACE__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']), 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 * @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 * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
declare(strict_types=1); declare(strict_types=1);
@ -29,10 +29,10 @@ use text;
class Manage class Manage
{ {
private static $active_headers = false; private static $active_headers = false;
private static $mail_to = ''; private static $mail_to = '';
private static $mail_subject = ''; private static $mail_subject = '';
private static $mail_content = ''; private static $mail_content = '';
protected static $init = false; protected static $init = false;
public static function init(): bool public static function init(): bool
{ {
@ -91,13 +91,21 @@ class Manage
dcCore::app()->error->add($e->getMessage()); dcCore::app()->error->add($e->getMessage());
} }
} }
return null; return null;
} }
public static function render(): void public static function render(): void
{ {
echo '<html><head><title>' . __('Mail test') . '</title></head><body>' . echo
dcPage::breadcrumb([__('System') => '', __('Mail test') => '']) . '<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() . ' dcPage::notices() . '
<div id="mail_testor"> <div id="mail_testor">
@ -127,7 +135,7 @@ class Manage
dcCore::app()->formNonce() . '</p>' . dcCore::app()->formNonce() . '</p>' .
'</form> '</form>
</div> </div>
</body>
</html>'; </body></html>';
} }
} }

View File

@ -1,4 +1,15 @@
<?php <?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); declare(strict_types=1);
namespace Dotclear\Plugin\testMail; namespace Dotclear\Plugin\testMail;
@ -29,7 +40,7 @@ class Prepend
foreach (self::LIBS as $lib) { foreach (self::LIBS as $lib) {
Clearbricks::lib()->autoload([ 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 <?php
declare(strict_types=1); /**
* @brief testMail, a plugin for Dotclear 2
$manage = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Manage']); *
if ($manage::init()) { * @package Dotclear
$manage::process(); * @subpackage Plugin
$manage::render(); *
} * @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 "" msgid ""
msgstr "" msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "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" "POT-Creation-Date: \n"
"PO-Revision-Date: 2022-11-27T22:19:31+00:00\n" "PO-Revision-Date: 2023-01-05T23:44:36+00:00\n"
"Last-Translator: Jean-Crhistian Denis\n" "Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "Mail test"
msgstr "Mail test"
msgid "You must provide a content." msgid "You must provide a content."
msgstr "Vous devez fournir un contenu." msgstr "Vous devez fournir un contenu."
@ -28,3 +25,9 @@ msgstr "Sujet :"
msgid "Active mail headers" msgid "Active mail headers"
msgstr "Activer les entêtes de mail" 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"