Skip to content

Commit

Permalink
[FIX] Last Wordpress fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
THE-KIPDEV committed Mar 26, 2024
1 parent 20b1e95 commit 0e0f270
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions helloasso-woocommerce-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function admin_options()
$isConnected = true;
}

if (isset($_GET['nonce']) || wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['nonce'])), 'helloasso_connect')) {
if (isset($_GET['nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['nonce'])), 'helloasso_connect')) {

if (isset($_GET['msg'])) {
$msg = sanitize_text_field($_GET['msg']);
Expand Down Expand Up @@ -323,7 +323,7 @@ public function admin_options()
echo '<script defer>
jQuery(document).ready(function($) {
$(".woocommerce-save-button").html(` <img src="' . plugins_url('asset/logo-ha.svg', __FILE__) . '" alt=""
$(".woocommerce-save-button").html(` <img src="' . plugins_url('assets/logo-ha.svg', __FILE__) . '" alt=""
class="HaAuthorizeButtonLogo">
<span class="HaAuthorizeButtonTitle">' . esc_html($btnText) . '</span>`);
$(".woocommerce-save-button").addClass("HaAuthorizeButton");
Expand Down Expand Up @@ -491,7 +491,7 @@ public function validate_fields()


if (!isset($_POST['woocommerce-process-checkout-nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['woocommerce-process-checkout-nonce'])), 'woocommerce-process_checkout')) {
wc_add_notice('Le nonce est pas ok', 'error');
wc_add_notice('La commande ne peut être finalisé', 'error');
}


Expand Down Expand Up @@ -594,7 +594,7 @@ public function process_payment($order_id)


if (!isset($_POST['woocommerce-process-checkout-nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['woocommerce-process-checkout-nonce'])), 'woocommerce-process_checkout')) {
wc_add_notice('Le nonce est pas ok', 'error');
wc_add_notice('La commande ne peut être finalisé', 'error');
}


Expand Down
4 changes: 3 additions & 1 deletion wc-api/helloasso-woocommerce-wc-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ function helloasso_endpoint() {
if (!isset($_GET['nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['nonce'])), 'helloasso_connect_return')) {
wp_safe_redirect(get_site_url());
exit;
} else {
$nonceRequest = sanitize_text_field(wp_unslash($_GET['nonce']));
}


Expand Down Expand Up @@ -57,7 +59,7 @@ function helloasso_endpoint() {


$response = wp_remote_post($url, helloasso_get_args_post_urlencode($data));

$status_code = wp_remote_retrieve_response_code($response);
if (200 !== $status_code) {
wp_safe_redirect(get_site_url() . '/wp-admin/admin.php?page=wc-settings&tab=checkout&section=helloasso&msg=error_connect&status_code=' . $status_code . '&nonce=' . $nonce);
Expand Down

0 comments on commit 0e0f270

Please sign in to comment.