Skip to content

Commit

Permalink
Merge branch 'refs/heads/release/7.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Aug 27, 2024
2 parents 4324275 + 03a3d0b commit f1b821b
Show file tree
Hide file tree
Showing 61 changed files with 667 additions and 515 deletions.
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
tests/
resources/
vendor/**/test*
vendor/mollie/mollie-api-php/examples/
languages/*.po
bin/
*.lock
Expand Down
624 changes: 316 additions & 308 deletions composer.lock

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions inc/settings/mollie_advanced_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
'lt_LT' => __('Lithuanian', 'mollie-payments-for-woocommerce'),
],
'desc' => sprintf(
/* translators: Placeholder 1: link tag Placeholder 2: closing tag */
__('Sending a language (or locale) is required. The option \'Automatically send WordPress language\' will try to get the customer\'s language in WordPress (and respects multilanguage plugins) and convert it to a format Mollie understands. If this fails, or if the language is not supported, it will fall back to American English. You can also select one of the locales currently supported by Mollie, that will then be used for all customers.', 'mollie-payments-for-woocommerce'),
'<a href="https://www.mollie.com/nl/docs/reference/payments/create" target="_blank">',
'</a>'
Expand All @@ -80,8 +81,8 @@
[
'id' => $pluginName . '_customer_details',
'title' => __('Store customer details at Mollie', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: enabled or disabled */
'desc' => sprintf(
/* translators: Placeholder 1: enabled or disabled Placeholder 2: translated string */
__(
'Should Mollie store customers name and email address for Single Click Payments? Default <code>%1$s</code>. Required if WooCommerce Subscriptions is being used! Read more about <a href=\'https://help.mollie.com/hc/en-us/articles/115000671249-What-are-single-click-payments-and-how-does-it-work-\'>%2$s</a> and how it improves your conversion.',
'mollie-payments-for-woocommerce'
Expand Down Expand Up @@ -110,8 +111,8 @@
),
],
'default' => PaymentService::PAYMENT_METHOD_TYPE_ORDER,
/* translators: Placeholder 1: opening link tag, placeholder 2: closing link tag */
'desc' => sprintf(
/* translators: Placeholder 1: opening link tag, placeholder 2: closing link tag */
__(
'Click %1$shere%2$s to read more about the differences between the Payments and Orders API',
'mollie-payments-for-woocommerce'
Expand Down Expand Up @@ -160,8 +161,8 @@ class="mollie-settings-advanced-payment-desc-label button button-secondary butto
array_keys($api_payment_description_labels),
$api_payment_description_labels
)),
/* translators: Placeholder 1: Opening paragraph tag, placeholder 2: Closing paragraph tag */
sprintf(
/* translators: Placeholder 1: Opening paragraph tag, placeholder 2: Closing paragraph tag */
__(
'Select among the available variables the description to be used for this transaction.%1$s(Note: this only works when the method is set to Payments API)%2$s',
'mollie-payments-for-woocommerce'
Expand All @@ -180,11 +181,9 @@ class="mollie-settings-advanced-payment-desc-label button button-secondary butto
'type' => 'text',
'custom_attributes' => ['maxlength' => '30'],
'default' => __('Gateway Fee', 'mollie-payments-for-woocommerce'),
'desc' => sprintf(
__(
'This is the label will appear in frontend when the surcharge applies',
'mollie-payments-for-woocommerce'
)
'desc' => __(
'This is the label will appear in frontend when the surcharge applies',
'mollie-payments-for-woocommerce'
),
],
[
Expand Down
16 changes: 7 additions & 9 deletions inc/settings/mollie_applepay_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
[
'id' => 'title',
'title' => __('Title', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: Gateway title */
'desc' => sprintf(
/* translators: Placeholder 1: Gateway title */
__(
'This controls the title which the user sees during checkout. Default <code>%s</code>',
'mollie-payments-for-woocommerce'
Expand All @@ -44,11 +44,9 @@
[
'id' => 'display_logo',
'title' => __('Display logo', 'mollie-payments-for-woocommerce'),
'desc' => sprintf(
__(
'Display logo',
'mollie-payments-for-woocommerce'
)
'desc' => __(
'Display logo',
'mollie-payments-for-woocommerce'
),
'desc_tip' => true,
'type' => 'checkbox',
Expand All @@ -59,8 +57,8 @@
[
'id' => 'description',
'title' => __('Description', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: Gateway description */
'desc' => sprintf(
/* translators: Placeholder 1: Gateway description */
__(
'Payment method description that the customer will see on your checkout. Default <code>%s</code>',
'mollie-payments-for-woocommerce'
Expand Down Expand Up @@ -88,8 +86,8 @@
[
'id' => 'mollie_apple_pay_button_enabled_cart',
'title' => __('Enable Apple Pay Button on Cart page', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: enabled or disabled */
'desc' => sprintf(
/* translators: Placeholder 1: enabled or disabled */
__(
'Enable the Apple Pay direct buy button on the Cart page',
'mollie-payments-for-woocommerce'
Expand All @@ -104,8 +102,8 @@
[
'id' => 'mollie_apple_pay_button_enabled_product',
'title' => __('Enable Apple Pay Button on Product page', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: enabled or disabled */
'desc' => sprintf(
/* translators: Placeholder 1: enabled or disabled */
__(
'Enable the Apple Pay direct buy button on the Product page',
'mollie-payments-for-woocommerce'
Expand Down
2 changes: 1 addition & 1 deletion mollie-payments-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Mollie Payments for WooCommerce
* Plugin URI: https://www.mollie.com
* Description: Accept payments in WooCommerce with the official Mollie plugin
* Version: 7.7.0
* Version: 7.8.0
* Author: Mollie
* Author URI: https://www.mollie.com
* Requires at least: 5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ abstract class AbstractVersionConstraint implements ConstraintInterface
public function __construct($requiredVersion, $requiredPluginName = null)
{
$this->requiredVersion = $requiredVersion;
$this->requiredPluginName = $requiredPluginName;
$this->requiredPluginName = esc_html($requiredPluginName);
$this->error = '';
$this->message = '';
}
Expand All @@ -60,11 +60,13 @@ protected function checkVersion($actualVersion)
if ($result) {
return $result;
}
throw new ConstraintFailedException(
// phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
throw new ConstraintFailedException(
$this,
$actualVersion,
[$this->error],
$this->message
esc_html($this->message)
);
}
// phpcs:enable WordPress.Security.EscapeOutput.ExceptionNotEscaped
}
}
9 changes: 6 additions & 3 deletions pluginEnvironmentChecker/Constraints/ExtensionConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ExtensionConstraint extends AbstractVersionConstraint
public function __construct($requiredVersion)
{
parent::__construct($requiredVersion);
$this->error = 'Required Extension not loaded';
$this->error = esc_html('Required Extension not loaded');
}

/**
Expand All @@ -25,18 +25,21 @@ public function check()
{
$this->message = $this->requiredVersion
. ' extension is required. Enable it in your server or ask your webhoster to enable it for you.';
$this->message = esc_html($this->message);
if (function_exists('extension_loaded')
&& !extension_loaded(
$this->requiredVersion
)
) {
throw new ConstraintFailedException(
// phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
throw new ConstraintFailedException(
$this,
$this->requiredVersion,
[$this->error],
$this->message
);
}
// phpcs:enable WordPress.Security.EscapeOutput.ExceptionNotEscaped
}
return true;
}
}
21 changes: 12 additions & 9 deletions pluginEnvironmentChecker/Constraints/PluginConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PluginConstraint extends AbstractVersionConstraint
public function __construct($requiredVersion, $requiredPluginName, $pluginDisplayName)
{
parent::__construct($requiredVersion, $requiredPluginName);
$this->error = 'Plugin incompatibility';
$this->error = esc_html('Plugin incompatibility');
$this->requiredPluginName = $requiredPluginName;
$this->pluginDisplayName = $pluginDisplayName;
}
Expand All @@ -33,23 +33,26 @@ public function check()
if (!$isPluginActive) {
$this->message
= "The {$this->pluginDisplayName} plugin must be active. Please install & activate {$this->pluginDisplayName}";

// phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
throw new ConstraintFailedException(
$this,
$this->requiredPluginName,
esc_html($this->requiredPluginName),
[$this->error],
$this->message
esc_html($this->message)
);
}
// phpcs:enable WordPress.Security.EscapeOutput.ExceptionNotEscaped
}

$pathToPluginFile = $this->absolutePathToPlugin();
if (!$pathToPluginFile) {
throw new ConstraintFailedException(
// phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
throw new ConstraintFailedException(
$this,
$this->requiredPluginName,
esc_html($this->requiredPluginName),
[$this->error],
"Cannot find absolute path to {$this->pluginDisplayName} plugin"
esc_html("Cannot find absolute path to {$this->pluginDisplayName} plugin")
);
// phpcs:enable WordPress.Security.EscapeOutput.ExceptionNotEscaped
}
if (!function_exists('get_plugin_data')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
Expand All @@ -59,7 +62,7 @@ public function check()
$this->message = "The {$this->pluginDisplayName} plugin has to be version "
. $this->requiredVersion
. " or higher. Please update your {$this->pluginDisplayName} version.";

$this->message = esc_html($this->message);
return $this->checkVersion(
$currentVersion
);
Expand Down
3 changes: 2 additions & 1 deletion pluginEnvironmentChecker/Constraints/WordPressConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class WordPressConstraint extends AbstractVersionConstraint
public function __construct($requiredVersion)
{
parent::__construct($requiredVersion);
$this->error = 'Wordpress version incompatibility';
$this->error = esc_html('Wordpress version incompatibility');
}

/**
Expand All @@ -24,6 +24,7 @@ public function check()
$this->message = 'WordPress version has to be '
. $this->requiredVersion
. ' or higher. Please update your WordPress version';
$this->message = esc_html($this->message);

return $this->checkVersion(
$WPCurrentVersion
Expand Down
10 changes: 6 additions & 4 deletions pluginEnvironmentChecker/EnvironmentChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ public function check()

$errCount = count($this->errors);
if ($errCount) {
throw new ConstraintFailedException(
// phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
throw new ConstraintFailedException(
$this,
'General Checker',
$this->errors,
$this->__('Validation failed with %1$d errors', [$errCount])
$this->esc_html__('Validation failed with %1$d errors', [$errCount])
);
}
// phpcs:enable WordPress.Security.EscapeOutput.ExceptionNotEscaped
}
}

/**
Expand All @@ -60,6 +62,6 @@ public function check()
*/
protected function __($string, $params = [])
{
return vsprintf($string, $params);
return esc_html(vsprintf($string, $params));
}
}
1 change: 1 addition & 0 deletions public/images/satispay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: daanvm, danielhuesken, davdebcom, dinamiko, syde, l.vangunst, ndij
Tags: mollie, payments, payment gateway, woocommerce, credit card, apple pay, ideal, bancontact, klarna, sofort, giropay, woocommerce subscriptions
Requires at least: 3.8
Tested up to: 6.6
Stable tag: 7.7.0
Stable tag: 7.8.0
Requires PHP: 7.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -221,6 +221,11 @@ Automatic updates should work like a charm; as always though, ensure you backup

== Changelog ==

= 7.8.0 - 27-08-2024 =

* Added - Satispay payment method
* Security - Remove Mollie SDK examples folder and some CS fixes

= 7.7.0 - 12-08-2024 =

* Added - Payconiq payment method
Expand Down
22 changes: 2 additions & 20 deletions src/Activation/ActivationModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,6 @@ public function initDb()
public function handleTranslations(): void
{
add_action('core_upgrade_preamble', 'mollieDeleteWPTranslationFiles');
add_filter(
'site_transient_update_plugins',
static function ($value) {
if (isset($value->translations)) {
$i = 0;
foreach ($value->translations as $translation) {
if (
$translation["slug"]
=== "mollie-payments-for-woocommerce"
) {
unset($value->translations[$i]);
}
$i++;
}
}

return $value;
}
);
}

/**
Expand Down Expand Up @@ -136,8 +117,8 @@ public function mollieWcNoticeApiKeyMissing()
}

$notice = new AdminNotice();
/* translators: Placeholder 1: Opening strong tag. Placeholder 2: Closing strong tag. Placeholder 3: Opening link tag to settings. Placeholder 4: Closing link tag.*/
$message = sprintf(
/* translators: Placeholder 1: Opening strong tag. Placeholder 2: Closing strong tag. Placeholder 3: Opening link tag to settings. Placeholder 4: Closing link tag.*/
esc_html__(
'%1$sMollie Payments for WooCommerce: API keys missing%2$s Please%3$s set your API keys here%4$s.',
'mollie-payments-for-woocommerce'
Expand Down Expand Up @@ -180,6 +161,7 @@ public function pluginInit()
false,
dirname(plugin_basename($this->baseFile)) . '/languages/'
);

$this->markUpdatedOrNew();
$this->initDb();
}
Expand Down
14 changes: 12 additions & 2 deletions src/Activation/ConstraintsChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,21 @@ public function maybeShowWarning($constraint, $warning)

protected function showNotice(array $errors)
{
$message = sprintf(__('%1$sMollie Payments for WooCommerce is inactive:%2$s', 'mollie-payments-for-woocommerce'), '<p><strong>', '</strong></p>');
$message = sprintf(
/* translators: Placeholder 1: opening tags Placeholder 2: closing tags */
__('%1$sMollie Payments for WooCommerce is inactive:%2$s', 'mollie-payments-for-woocommerce'),
'<p><strong>',
'</strong></p>'
);
foreach ($errors as $error) {
$message .= sprintf('<p>%s</p>', $error);
}
$message .= sprintf(__('%1$sCorrect the above errors to use Mollie Payments for Woocommerce%2$s', 'mollie-payments-for-woocommerce'), '<p>', '</p>');
$message .= sprintf(
/* translators: Placeholder 1: opening tags Placeholder 2: closing tags */
__('%1$sCorrect the above errors to use Mollie Payments for Woocommerce%2$s', 'mollie-payments-for-woocommerce'),
'<p>',
'</p>'
);
$errorLevel = 'notice-error';
$this->notice->addNotice($errorLevel, $message);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Assets/AssetsModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ protected function registerFrontendScripts(string $pluginUrl, string $pluginPath
(string) filemtime($this->getPluginPath($pluginPath, '/public/js/applepayDirectCart.min.js')),
true
);
wp_register_script('mollie', 'https://js.mollie.com/v1/mollie.js', [], date("d"), true);
wp_register_script('mollie', 'https://js.mollie.com/v1/mollie.js', [], gmdate("d"), true);
wp_register_script(
'mollie-components',
$this->getPluginUrl($pluginUrl, '/public/js/mollie-components.min.js'),
Expand Down
4 changes: 2 additions & 2 deletions src/Buttons/ApplePayButton/AppleAjaxRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function validateMerchant()
//we cannot access the endpoint in testmode, we override it to be testMode = false
$apiKey = $this->settingsHelper->getApiKey(false);
$validationUrl = $applePayRequestDataObject->validationUrl();
$completeDomain = parse_url(get_site_url(), PHP_URL_HOST);
$completeDomain = wp_parse_url(get_site_url(), PHP_URL_HOST);
$removeHttp = ["https://", "http://"];
$regex = '/.+\.\w+\/?((\w*\/*)*)/i';
$domain = str_replace($removeHttp, "", $completeDomain);
Expand Down Expand Up @@ -695,8 +695,8 @@ function ($result, $order_id) {
)
);
} else {
/* translators: Placeholder 1: Payment method title */
$message = sprintf(
/* translators: Placeholder 1: Payment method title */
__(
'Could not create %s payment.',
'mollie-payments-for-woocommerce'
Expand Down
Loading

0 comments on commit f1b821b

Please sign in to comment.