From 9c2f78d1d6d308d7a6a91db3e8762c1c340b1343 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 11 Mar 2023 17:14:04 +0100 Subject: [PATCH] one file plugin --- CHANGELOG.md | 5 +++++ _define.php | 26 ++++++++++++++++++++------ _prepend.php | 29 ----------------------------- dcstore.xml | 6 +++--- locales/fr/main.lang.php | 13 +++++++++++++ locales/fr/main.po | 18 ++++++++++++++++++ 6 files changed, 59 insertions(+), 38 deletions(-) delete mode 100644 _prepend.php create mode 100644 locales/fr/main.lang.php create mode 100644 locales/fr/main.po diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b7d7af..2897c6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +0.3 - 2023.03.11 +- one file plugin +- should be compatible with Dotclear 2.26 +- translate plugin description + 0.2 - 2022.12.22 - use abstract plugin id - fix permissions diff --git a/_define.php b/_define.php index 3885b78..4cf98d6 100644 --- a/_define.php +++ b/_define.php @@ -15,18 +15,32 @@ if (!defined('DC_RC_PATH')) { } $this->registerModule( - 'mail2log', + 'Mail to log', 'Do not send mails but log them', 'Jean-Christian Denis and contributors', - '0.2', + '0.3', [ 'requires' => [['core', '2.24']], 'permissions' => dcCore::app()->auth->makePermissions([ dcAuth::PERMISSION_USAGE, ]), - 'type' => 'plugin', - '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', + 'type' => 'plugin', + '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', ] ); + +if (!function_exists('\_mail')) { + function _mail($to, $subject, $message, $headers) + { + $headers = is_array($headers) ? implode("\n\t", $headers) : (string) $headers; + + $cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME); + $cur->log_table = basename(__DIR__); + $cur->log_msg = sprintf("%s\n-----\n To: %s\n Subject: %s\n-----\n Message:\n%s\n", $headers, $to, $subject, $message); + dcCore::app()->log->addLog($cur); + + return true; + } +} diff --git a/_prepend.php b/_prepend.php deleted file mode 100644 index e399e21..0000000 --- a/_prepend.php +++ /dev/null @@ -1,29 +0,0 @@ -con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME); - $cur->log_table = basename(__DIR__); - $cur->log_msg = sprintf("%s\n-----\n To: %s\n Subject: %s\n-----\n Message:\n%s\n", $headers, $to, $subject, $message); - dcCore::app()->log->addLog($cur); - - return true; - } -} diff --git a/dcstore.xml b/dcstore.xml index f8749c2..49085d0 100644 --- a/dcstore.xml +++ b/dcstore.xml @@ -1,11 +1,11 @@ - mail2log - 0.2 + Mail to log + 0.3 Jean-Christian Denis and contributors Do not send mails but log them - https://github.com/JcDenis/mail2log/releases/download/v0.2/plugin-mail2log.zip + https://github.com/JcDenis/mail2log/releases/download/v0.3/plugin-mail2log.zip 2.24 https://plugins.dotaddict.org/dc2/details/mail2log https://github.com/JcDenis/mail2log diff --git a/locales/fr/main.lang.php b/locales/fr/main.lang.php new file mode 100644 index 0000000..904ff41 --- /dev/null +++ b/locales/fr/main.lang.php @@ -0,0 +1,13 @@ + 1);\n" + +msgid "Mail to log" +msgstr "Mail en log" + +msgid "Do not send mails but log them" +msgstr "Ne pas envoyer les mails mais les loguer" +