Prep Plugin for release on WordPress.org (#23)
* Update translation text domain * Escape everything that should be escaped. * Add nonce checks where needed. * Sanitize all inputs. * Apply Code style changes across the codebase. * Correct many deprecation notices. * Optimize load order of many filters. * Add Proper Build script * Use emojii flags * Fix i18n deprecation notice for translating too early * Put all scripts in footer and load async
This commit is contained in:
@ -12,7 +12,6 @@
|
||||
namespace WP_Ultimo\Managers;
|
||||
|
||||
use Psr\Log\LogLevel;
|
||||
use WP_Ultimo\Managers\Base_Manager;
|
||||
use WP_Ultimo\Gateways\Ignorable_Exception;
|
||||
|
||||
use WP_Ultimo\Gateways\Free_Gateway;
|
||||
@ -278,11 +277,11 @@ class Gateway_Manager extends Base_Manager {
|
||||
$gateway = wu_get_gateway($gateway_id);
|
||||
|
||||
if ( ! $gateway) {
|
||||
$error = new \WP_Error('missing_gateway', esc_html__('Missing gateway parameter.', 'wp-ultimo'));
|
||||
$error = new \WP_Error('missing_gateway', esc_html__('Missing gateway parameter.', 'wp-multisite-waas'));
|
||||
|
||||
wp_die(
|
||||
$error,
|
||||
esc_html__('Error', 'wp-ultimo'),
|
||||
$error, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
esc_html__('Error', 'wp-multisite-waas'),
|
||||
[
|
||||
'back_link' => true,
|
||||
'response' => '200',
|
||||
@ -310,8 +309,8 @@ class Gateway_Manager extends Base_Manager {
|
||||
|
||||
if (is_wp_error($results)) {
|
||||
wp_die(
|
||||
$results,
|
||||
__('Error', 'wp-ultimo'),
|
||||
$results, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
esc_html__('Error', 'wp-multisite-waas'),
|
||||
[
|
||||
'back_link' => true,
|
||||
'response' => '200',
|
||||
@ -322,8 +321,8 @@ class Gateway_Manager extends Base_Manager {
|
||||
$error = new \WP_Error('confirm-error-' . $e->getCode(), $e->getMessage());
|
||||
|
||||
wp_die(
|
||||
$error,
|
||||
__('Error', 'wp-ultimo'),
|
||||
$error, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
esc_html__('Error', 'wp-multisite-waas'),
|
||||
[
|
||||
'back_link' => true,
|
||||
'response' => '200',
|
||||
@ -338,7 +337,15 @@ class Gateway_Manager extends Base_Manager {
|
||||
* Add a filter to bypass the checkout form.
|
||||
* This is used for PayPal confirmation page.
|
||||
*/
|
||||
add_action('wu_bypass_checkout_form', fn($bypass, $atts) => $output, 10, 2);
|
||||
|
||||
add_action(
|
||||
'wu_bypass_checkout_form',
|
||||
function ($output) {
|
||||
return $output;
|
||||
},
|
||||
10,
|
||||
1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,8 +361,8 @@ class Gateway_Manager extends Base_Manager {
|
||||
'payment-gateways',
|
||||
'active_gateways',
|
||||
[
|
||||
'title' => __('Active Payment Gateways', 'wp-ultimo'),
|
||||
'desc' => __('Payment gateways are what your customers will use to pay.', 'wp-ultimo'),
|
||||
'title' => __('Active Payment Gateways', 'wp-multisite-waas'),
|
||||
'desc' => __('Payment gateways are what your customers will use to pay.', 'wp-multisite-waas'),
|
||||
'type' => 'multiselect',
|
||||
'columns' => 2,
|
||||
'options' => [$this, 'get_gateways_as_options'],
|
||||
@ -393,31 +400,31 @@ class Gateway_Manager extends Base_Manager {
|
||||
/*
|
||||
* Free Payments
|
||||
*/
|
||||
wu_register_gateway('free', __('Free', 'wp-ultimo'), '', Free_Gateway::class, true);
|
||||
wu_register_gateway('free', __('Free', 'wp-multisite-waas'), '', Free_Gateway::class, true);
|
||||
|
||||
/*
|
||||
* Stripe Payments
|
||||
*/
|
||||
$stripe_desc = __('Stripe is a suite of payment APIs that powers commerce for businesses of all sizes, including subscription management.', 'wp-ultimo');
|
||||
wu_register_gateway('stripe', __('Stripe', 'wp-ultimo'), $stripe_desc, Stripe_Gateway::class);
|
||||
$stripe_desc = __('Stripe is a suite of payment APIs that powers commerce for businesses of all sizes, including subscription management.', 'wp-multisite-waas');
|
||||
wu_register_gateway('stripe', __('Stripe', 'wp-multisite-waas'), $stripe_desc, Stripe_Gateway::class);
|
||||
|
||||
/*
|
||||
* Stripe Checkout Payments
|
||||
*/
|
||||
$stripe_checkout_desc = __('Stripe Checkout is the hosted solution for checkouts using Stripe.', 'wp-ultimo');
|
||||
wu_register_gateway('stripe-checkout', __('Stripe Checkout', 'wp-ultimo'), $stripe_checkout_desc, Stripe_Checkout_Gateway::class);
|
||||
$stripe_checkout_desc = __('Stripe Checkout is the hosted solution for checkouts using Stripe.', 'wp-multisite-waas');
|
||||
wu_register_gateway('stripe-checkout', __('Stripe Checkout', 'wp-multisite-waas'), $stripe_checkout_desc, Stripe_Checkout_Gateway::class);
|
||||
|
||||
/*
|
||||
* PayPal Payments
|
||||
*/
|
||||
$paypal_desc = __('PayPal is the leading provider in checkout solutions and it is the easier way to get your network subscriptions going.', 'wp-ultimo');
|
||||
wu_register_gateway('paypal', __('PayPal', 'wp-ultimo'), $paypal_desc, PayPal_Gateway::class);
|
||||
$paypal_desc = __('PayPal is the leading provider in checkout solutions and it is the easier way to get your network subscriptions going.', 'wp-multisite-waas');
|
||||
wu_register_gateway('paypal', __('PayPal', 'wp-multisite-waas'), $paypal_desc, PayPal_Gateway::class);
|
||||
|
||||
/*
|
||||
* Manual Payments
|
||||
*/
|
||||
$manual_desc = __('Use the Manual Gateway to allow users to pay you directly via bank transfers, checks, or other channels.', 'wp-ultimo');
|
||||
wu_register_gateway('manual', __('Manual', 'wp-ultimo'), $manual_desc, Manual_Gateway::class);
|
||||
$manual_desc = __('Use the Manual Gateway to allow users to pay you directly via bank transfers, checks, or other channels.', 'wp-multisite-waas');
|
||||
wu_register_gateway('manual', __('Manual', 'wp-multisite-waas'), $manual_desc, Manual_Gateway::class);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -448,7 +455,7 @@ class Gateway_Manager extends Base_Manager {
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @param string $id The id of the gateway.
|
||||
* @return array
|
||||
* @return array|false
|
||||
*/
|
||||
public function get_gateway($id) {
|
||||
|
||||
@ -471,7 +478,7 @@ class Gateway_Manager extends Base_Manager {
|
||||
|
||||
// Checks if gateway was already added
|
||||
if ($this->is_gateway_registered($id)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
$active_gateways = (array) wu_get_setting('active_gateways', []);
|
||||
@ -533,7 +540,7 @@ class Gateway_Manager extends Base_Manager {
|
||||
*/
|
||||
add_action(
|
||||
'wu_checkout_gateway_fields',
|
||||
function ($checkout) use ($gateway) {
|
||||
function () use ($gateway) {
|
||||
|
||||
$field_content = call_user_func([$gateway, 'fields']);
|
||||
|
||||
@ -541,15 +548,13 @@ class Gateway_Manager extends Base_Manager {
|
||||
|
||||
?>
|
||||
|
||||
<div v-cloak v-show="gateway == '<?php echo esc_attr($gateway->get_id()); ?>' && order && order.should_collect_payment" class="wu-overflow">
|
||||
|
||||
<?php echo $field_content; ?>
|
||||
|
||||
</div>
|
||||
<div v-cloak v-show="gateway == '<?php echo esc_attr($gateway->get_id()); ?>' && order && order.should_collect_payment" class="wu-overflow">
|
||||
<?php echo $field_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
echo ob_get_clean();
|
||||
echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user