From 5b3f6d5e26542b710e1a5518bc6cbd03e7ea79d3 Mon Sep 17 00:00:00 2001
From: Oleksandr Mykhailenko
Date: Mon, 24 Mar 2025 23:48:49 +0200
Subject: [PATCH] Added translations for the widget
---
CHANGELOG.md | 3 ++
includes/options-page.php | 70 +++++++++++++++++++-------------------
languages/mailgun-ca.po | 16 +++++++++
languages/mailgun-de_DE.po | 16 +++++++++
languages/mailgun-es_ES.po | 16 +++++++++
mailgun.php | 30 ++++++++--------
readme.md | 5 ++-
readme.txt | 5 ++-
8 files changed, 109 insertions(+), 52 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b6e4a1..50168c3 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,9 @@
Changelog
=========
+2.1.6 (2025-03-24)
+- Added translation for the widget
+
2.1.3 (2024-11-27)
- Use password type for API Key field for hide it. Fix warning related co compact() method
diff --git a/includes/options-page.php b/includes/options-page.php
index e7e0604..5573ed2 100755
--- a/includes/options-page.php
+++ b/includes/options-page.php
@@ -77,12 +77,12 @@
$link = sprintf(
wp_kses(
__('A Mailgun account is required to use this plugin and the Mailgun service.', 'mailgun'),
- array(
- 'a' => array(
- 'href' => array(),
- 'target' => array(),
- ),
- )
+ [
+ 'a' => [
+ 'href' => [],
+ 'target' => [],
+ ],
+ ]
),
esc_url($url),
'_blank'
@@ -97,12 +97,12 @@
$link = sprintf(
wp_kses(
__('If you need to register for an account, you can do so at Mailgun.com.', 'mailgun'),
- array(
- 'a' => array(
- 'href' => array(),
- 'target' => array(),
- ),
- )
+ [
+ 'a' => [
+ 'href' => [],
+ 'target' => [],
+ ],
+ ]
),
esc_url($url),
'_blank'
@@ -282,12 +282,12 @@
$link = __('If enabled, Mailgun will track links. Open Tracking Documentation.', 'mailgun');
echo wp_kses(
$link,
- array(
- 'a' => array(
- 'href' => array(),
- 'target' => array(),
- ),
- )
+ [
+ 'a' => [
+ 'href' => [],
+ 'target' => [],
+ ],
+ ]
);
?>
@@ -306,12 +306,12 @@
Open Tracking Documentation.', 'mailgun'),
- array(
- 'a' => array(
- 'href' => array(),
- 'target' => array(),
- ),
- )
+ [
+ 'a' => [
+ 'href' => [],
+ 'target' => [],
+ ],
+ ]
);
?>
@@ -405,12 +405,12 @@ class="regular-text"
echo wp_kses(
__('Tracking and Tagging', 'mailgun'),
- array(
- 'a' => array(
- 'href' => array(),
- 'target' => array(),
- ),
- )
+ [
+ 'a' => [
+ 'href' => [],
+ 'target' => [],
+ ],
+ ]
);
?>
@@ -462,11 +462,11 @@ class="regular-text"
$link = sprintf(
wp_kses(
__('View available lists.', 'mailgun'),
- array(
- 'a' => array(
- 'href' => array(),
- ),
- )
+ [
+ 'a' => [
+ 'href' => [],
+ ],
+ ]
),
esc_url($url)
);
diff --git a/languages/mailgun-ca.po b/languages/mailgun-ca.po
index 497f515..f204f19 100644
--- a/languages/mailgun-ca.po
+++ b/languages/mailgun-ca.po
@@ -207,3 +207,19 @@ msgstr ""
#: includes/options-page.php:74
msgid "Save Changes"
msgstr "Desar els canvis"
+
+#: includes/widget.php:84
+msgid "Title (optional):"
+msgstr "Titre (optionnel):"
+
+#: includes/widget.php:88
+msgid "Description (optional):"
+msgstr "Description (optionnelle):"
+
+#: includes/widget.php:92
+msgid "List addresses (required):"
+msgstr "Lister les adresses (obligatoire):"
+
+#: includes/widget.php:96
+msgid "Collect name:"
+msgstr "Collecter le nom:"
diff --git a/languages/mailgun-de_DE.po b/languages/mailgun-de_DE.po
index 5056688..8b55e6c 100644
--- a/languages/mailgun-de_DE.po
+++ b/languages/mailgun-de_DE.po
@@ -210,3 +210,19 @@ msgstr "Antwortadresse"
msgid "Suppress Click Track for password reset email"
msgstr "Klick-Tracking für Passwort-Reset-Email unterdrücken"
+
+#: includes/widget.php:84
+msgid "Title (optional):"
+msgstr "Titel (optional):"
+
+#: includes/widget.php:88
+msgid "Description (optional):"
+msgstr "Beschreibung (optional):"
+
+#: includes/widget.php:92
+msgid "List addresses (required):"
+msgstr "Adressen auflisten (erforderlich):"
+
+#: includes/widget.php:96
+msgid "Collect name:"
+msgstr "Namen erfassen:"
diff --git a/languages/mailgun-es_ES.po b/languages/mailgun-es_ES.po
index 9e42d40..d38139d 100644
--- a/languages/mailgun-es_ES.po
+++ b/languages/mailgun-es_ES.po
@@ -211,3 +211,19 @@ msgstr "dirección de respuesta"
msgid "Suppress Click Track for password reset email"
msgstr "Suprimir seguimiento de clics para el email de restablecimiento de contraseña"
+
+#: includes/widget.php:84
+msgid "Title (optional):"
+msgstr "Título (opcional):"
+
+#: includes/widget.php:88
+msgid "Description (optional):"
+msgstr "Descripción (opcional):"
+
+#: includes/widget.php:92
+msgid "List addresses (required):"
+msgstr "Listar direcciones (obligatorio):"
+
+#: includes/widget.php:96
+msgid "Collect name:"
+msgstr "Recopilar nombre:"
diff --git a/mailgun.php b/mailgun.php
index a12ca17..4f85f33 100755
--- a/mailgun.php
+++ b/mailgun.php
@@ -3,7 +3,7 @@
* Plugin Name: Mailgun
* Plugin URI: http://wordpress.org/extend/plugins/mailgun/
* Description: Mailgun integration for WordPress
- * Version: 2.1.6
+ * Version: 2.1.7
* Requires PHP: 7.4
* Requires at least: 4.4
* Author: Mailgun
@@ -227,9 +227,9 @@ public function api_call( string $uri, array $params = array(), string $method =
$time = time();
$url = $this->api_endpoint . $uri;
- $headers = array(
+ $headers = [
'Authorization' => 'Basic ' . base64_encode( "api:{$apiKey}" ),
- );
+ ];
switch ( $method ) {
case 'GET':
@@ -248,12 +248,12 @@ public function api_call( string $uri, array $params = array(), string $method =
}
// make the request
- $args = array(
+ $args = [
'method' => $method,
'body' => $params,
'headers' => $headers,
'sslverify' => true,
- );
+ ];
// make the remote request
$result = wp_remote_request( $url, $args );
@@ -282,9 +282,9 @@ public function api_call( string $uri, array $params = array(), string $method =
* @throws JsonException
*/
public function get_lists(): array {
- $results = array();
+ $results = [];
- $lists_json = $this->api_call( 'lists', array(), 'GET' );
+ $lists_json = $this->api_call( 'lists', [], 'GET' );
$lists_arr = json_decode( $lists_json, true, 512, JSON_THROW_ON_ERROR );
if ( isset( $lists_arr['items'] ) && ! empty( $lists_arr['items'] ) ) {
@@ -304,20 +304,20 @@ public function get_lists(): array {
public function add_list(): void {
$name = sanitize_text_field( $_POST['name'] ?? null );
$email = sanitize_text_field( $_POST['email'] ?? null );
- $list_addresses = array();
+ $list_addresses = [];
foreach ( $_POST['addresses'] as $address => $val ) {
$list_addresses[ sanitize_text_field( $address ) ] = sanitize_text_field( $val );
}
if ( ! empty( $list_addresses ) ) {
- $result = array();
+ $result = [];
foreach ( $list_addresses as $address => $val ) {
$result[] = $this->api_call(
"lists/{$address}/members",
- array(
+ [
'address' => $email,
'name' => $name,
- )
+ ]
);
}
$message = 'Thank you!';
@@ -329,18 +329,18 @@ public function add_list(): void {
}
}
echo json_encode(
- array(
+ [
'status' => 200,
'message' => $message,
- ),
+ ],
JSON_THROW_ON_ERROR
);
} else {
echo json_encode(
- array(
+ [
'status' => 500,
'message' => 'Uh oh. We weren\'t able to add you to the list' . count( $list_addresses ) ? 's.' : '. Please try again.',
- ),
+ ],
JSON_THROW_ON_ERROR
);
}
diff --git a/readme.md b/readme.md
index fe3dd01..72e224c 100755
--- a/readme.md
+++ b/readme.md
@@ -4,7 +4,7 @@ Mailgun for WordPress
Contributors: mailgun, sivel, lookahead.io, m35dev, alanfuller
Tags: mailgun, smtp, http, api, mail, email
Tested up to: 6.7.2
-Stable tag: 2.1.6
+Stable tag: 2.1.7
Requires PHP: 7.4
License: GPLv2 or later
@@ -133,6 +133,9 @@ MAILGUN_REPLY_TO_ADDRESS Type: string
== Changelog ==
+= 2.1.6 (2025-03-24): =
+- Added translation for the widget
+
= 2.1.6 (2025-03-07): =
- Fixed bug with sending test emails (JS error). Basically it's 2.1.5. Just version updates
diff --git a/readme.txt b/readme.txt
index e30f33d..474d30d 100755
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Mailgun for WordPress
Contributors: mailgun, sivel, lookahead.io, m35dev, alanfuller
Tags: mailgun, smtp, http, api, mail, email
Tested up to: 6.7.2
-Stable tag: 2.1.6
+Stable tag: 2.1.7
Requires PHP: 7.4
License: GPLv2 or later
@@ -129,6 +129,9 @@ MAILGUN_TRACK_OPENS Type: string Choices: 'yes' or 'no'
== Changelog ==
+= 2.1.6 (2025-03-24): =
+- Added translation for the widget
+
= 2.1.6 (2025-03-07): =
- Fixed bug with sending test emails (JS error). Basically it's 2.1.5. Just version updates