Skip to content

Commit

Permalink
Add untrailingslashit function when add_query_arg used, PFW-672
Browse files Browse the repository at this point in the history
  • Loading branch information
kcppdevelopers committed Aug 20, 2020
1 parent f5ca74f commit 9a8e7cb
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function express_checkout_get_option($option_name) {
}

public function ec_get_checkout_url($action) {
return add_query_arg( array( 'pp_action' => $action, 'utm_nooverride' => '1'), WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE') );
return add_query_arg( array( 'pp_action' => $action, 'utm_nooverride' => '1'), untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')) );
}

public function ec_is_express_checkout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public function buy_now_button() {
break;
}
if ($this->show_paypal_credit == 'yes') {
$paypal_credit_button_markup = '<a style="' . $hide . '" class="single_add_to_cart_button paypal_checkout_button paypal_checkout_button_cc" href="' . esc_url(add_query_arg('use_paypal_credit', 'true', add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')))) . '" >';
$paypal_credit_button_markup = '<a style="' . $hide . '" class="single_add_to_cart_button paypal_checkout_button paypal_checkout_button_cc" href="' . esc_url(add_query_arg('use_paypal_credit', 'true', add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))))) . '" >';
$paypal_credit_button_markup .= '<img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppcredit-logo-small.png" width="148" height="26" class="ppcreditlogo ec_checkout_page_button_type_pc" align="top" alt="' . __('Check out with PayPal Credit', 'paypal-for-woocommerce') . '" />';
$paypal_credit_button_markup .= '</a>';
$ec_html_button .= $paypal_credit_button_markup;
Expand Down Expand Up @@ -344,7 +344,7 @@ public function add_to_cart_redirect($url = null) {
} else {
unset(WC()->session->ec_save_to_account);
}
$url = esc_url_raw(add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')));
$url = esc_url_raw(add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))));
}
return $url;
} catch (Exception $ex) {
Expand Down Expand Up @@ -742,7 +742,7 @@ public function ec_enqueue_scripts_product_page($is_mini_cart = false) {
'wsc_cart_button_height' => $this->wsc_cart_button_height,
'wsc_cart_button_label' => $this->wsc_cart_button_label,
'button_fundingicons' => $this->button_fundingicons,
'cancel_page' => add_query_arg('pp_action', 'cancel_order', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')),
'cancel_page' => add_query_arg('pp_action', 'cancel_order', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))),
'is_paypal_credit_enable' => $this->is_paypal_credit_enable ? "yes" : 'no',
'allowed_funding_methods' => $allowed_funding_methods_json,
'disallowed_funding_methods' => $disallowed_funding_methods_json,
Expand All @@ -751,7 +751,7 @@ public function ec_enqueue_scripts_product_page($is_mini_cart = false) {
'wsc_cart_allowed_funding_methods' => $wsc_cart_allowed_funding_methods_json,
'wsc_cart_disallowed_funding_methods' => $wsc_cart_disallowed_funding_methods_json,
'enable_google_analytics_click' => $this->enable_google_analytics_click,
'set_express_checkout' => add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')),
'set_express_checkout' => add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))),
'zcommit' => $this->angelleye_ec_force_to_display_checkout_page_js() == true ? 'false' : 'true',
'checkout_page_disable_smart_button' => $this->checkout_page_disable_smart_button ? "yes" : "no",
'is_cartflow' => $is_cartflow,
Expand Down Expand Up @@ -839,21 +839,21 @@ public function woocommerce_paypal_express_checkout_button_angelleye($return = f
if ($this->enable_in_context_checkout_flow == 'no') {
switch ($this->checkout_with_pp_button_type) {
case 'textbutton':
$cart_button_html .= '<a class="paypal_checkout_button button ' . $class_top . ' alt ec_checkout_page_button_type_textbutton" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))) . '">' . $this->pp_button_type_text_button . '</a>';
$cart_button_html .= '<a class="paypal_checkout_button button ' . $class_top . ' alt ec_checkout_page_button_type_textbutton" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')))) . '">' . $this->pp_button_type_text_button . '</a>';
break;
case 'paypalimage':
$cart_button_html .= '<a class="paypal_checkout_button ' . $class_top . '" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))) . '">';
$cart_button_html .= '<a class="paypal_checkout_button ' . $class_top . '" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')))) . '">';
$cart_button_html .= '<img src=' . WC_Gateway_PayPal_Express_AngellEYE::angelleye_get_paypalimage() . ' class="ec_checkout_page_button_type_paypalimage" align="top" alt="' . __('Pay with PayPal', 'paypal-for-woocommerce') . '" />';
$cart_button_html .= "</a>";
break;
case 'customimage':
$cart_button_html .= '<a class="paypal_checkout_button ' . $class_top . '" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))) . '">';
$cart_button_html .= '<a class="paypal_checkout_button ' . $class_top . '" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')))) . '">';
$cart_button_html .= '<img src="' . $this->pp_button_type_my_custom . '" class="ec_checkout_page_button_type_customimage" align="top" alt="' . __('Pay with PayPal', 'paypal-for-woocommerce') . '" />';
$cart_button_html .= "</a>";
break;
}
if ($this->show_paypal_credit == 'yes') {
$paypal_credit_button_markup = '<a class="paypal_checkout_button ' . $class_cc_top . '" href="' . esc_url(add_query_arg('use_paypal_credit', 'true', add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')))) . '" >';
$paypal_credit_button_markup = '<a class="paypal_checkout_button ' . $class_cc_top . '" href="' . esc_url(add_query_arg('use_paypal_credit', 'true', add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))))) . '" >';
$paypal_credit_button_markup .= '<img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppcredit-logo-small.png" width="148" height="26" class="ppcreditlogo ec_checkout_page_button_type_pc" align="top" alt="' . __('Check out with PayPal Credit', 'paypal-for-woocommerce') . '" />';
$paypal_credit_button_markup .= '</a>';
$cart_button_html .= $paypal_credit_button_markup;
Expand Down Expand Up @@ -899,28 +899,28 @@ public function checkout_message() {
switch ($this->checkout_with_pp_button_type) {
case "textbutton":
$ec_top_checkout_button .= '<div class="paypal_ec_textbutton">';
$ec_top_checkout_button .= '<a class="paypal_checkout_button paypal_checkout_button_text button alt" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))) . '">' . $this->pp_button_type_text_button . '</a>';
$ec_top_checkout_button .= '<a class="paypal_checkout_button paypal_checkout_button_text button alt" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')))) . '">' . $this->pp_button_type_text_button . '</a>';
$ec_top_checkout_button .= '</div>';
break;
case "paypalimage":
$ec_top_checkout_button .= '<div id="paypal_ec_button">';
$ec_top_checkout_button .= '<a class="paypal_checkout_button" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))) . '">';
$ec_top_checkout_button .= '<a class="paypal_checkout_button" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')))) . '">';
$ec_top_checkout_button .= "<img src='" . WC_Gateway_PayPal_Express_AngellEYE::angelleye_get_paypalimage() . "' class='ec_checkout_page_button_type_paypalimage' border='0' alt='" . __('Pay with PayPal', 'paypal-for-woocommerce') . "'/>";
$ec_top_checkout_button .= "</a>";
$ec_top_checkout_button .= '</div>';
break;
case "customimage":
$button_img = $this->pp_button_type_my_custom;
$ec_top_checkout_button .= '<div id="paypal_ec_button">';
$ec_top_checkout_button .= '<a class="paypal_checkout_button" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))) . '">';
$ec_top_checkout_button .= '<a class="paypal_checkout_button" href="' . esc_url(add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')))) . '">';
$ec_top_checkout_button .= "<img src='{$button_img}' class='ec_checkout_page_button_type_paypalimage' width='150' border='0' alt='" . __('Pay with PayPal', 'paypal-for-woocommerce') . "'/>";
$ec_top_checkout_button .= "</a>";
$ec_top_checkout_button .= '</div>';
break;
}
if ($this->show_paypal_credit == 'yes') {
$paypal_credit_button_markup = '<div id="paypal_ec_paypal_credit_button">';
$paypal_credit_button_markup .= '<a class="paypal_checkout_button paypal_checkout_button_cc" href="' . esc_url(add_query_arg('use_paypal_credit', 'true', add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')))) . '" >';
$paypal_credit_button_markup .= '<a class="paypal_checkout_button paypal_checkout_button_cc" href="' . esc_url(add_query_arg('use_paypal_credit', 'true', add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))))) . '" >';
$paypal_credit_button_markup .= "<img src='https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppcredit-logo-small.png' class='ec_checkout_page_button_type_paypalimage' alt='Check out with PayPal Credit'/>";
$paypal_credit_button_markup .= '</a>';
$paypal_credit_button_markup .= '</div>';
Expand Down Expand Up @@ -1003,7 +1003,7 @@ public function woocommerce_before_cart() {
public function angelleye_woocommerce_order_button_html($order_button_hrml) {
if ($this->function_helper->ec_is_express_checkout()) {
$order_button_text = __('Cancel order', 'paypal-for-woocommerce');
$cancel_order_url = add_query_arg('pp_action', 'cancel_order', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'));
$cancel_order_url = add_query_arg('pp_action', 'cancel_order', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')));
$order_button_hrml = apply_filters('angelleye_review_order_cance_button_html', '<a class="button alt angelleye_cancel" name="woocommerce_checkout_place_order" href="' . esc_attr($cancel_order_url) . '" >' . $order_button_text . '</a>' . $order_button_hrml);
}
return $order_button_hrml;
Expand Down Expand Up @@ -1065,7 +1065,7 @@ public function angelleye_ajax_generate_cart() {
}
WC()->shipping->reset_shipping();
$product_id = absint(wp_unslash($_POST['product_id']));
$url = esc_url_raw(add_query_arg('pp_action', 'set_express_checkout', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')));
$url = esc_url_raw(add_query_arg('pp_action', 'set_express_checkout', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))));
if ((isset($_POST['wc-paypal_express-new-payment-method']) && $_POST['wc-paypal_express-new-payment-method'] == 'true') || ( isset($_GET['ec_save_to_account']) && $_GET['ec_save_to_account'] == true)) {
$url = add_query_arg('ec_save_to_account', 'true', $url);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,9 @@ public function angelleye_set_express_checkout_request() {
$cancel_url = add_query_arg('utm_nooverride', '1', $cancel_url);
$order_total = '';
if( !empty($_REQUEST['request_from']) && $_REQUEST['request_from'] == 'JSv4' ) {
$returnurl = urldecode(add_query_arg(array('pp_action' => 'get_express_checkout_details', 'utm_nooverride' => 1, 'request_from' => 'JSv4'), WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')));
$returnurl = urldecode(add_query_arg(array('pp_action' => 'get_express_checkout_details', 'utm_nooverride' => 1, 'request_from' => 'JSv4'), untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))));
} else {
$returnurl = urldecode(add_query_arg(array('pp_action' => 'get_express_checkout_details', 'utm_nooverride' => 1), WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')));
$returnurl = urldecode(add_query_arg(array('pp_action' => 'get_express_checkout_details', 'utm_nooverride' => 1), untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))));
}

if (!empty($_GET['pay_for_order']) && $_GET['pay_for_order'] == true && !empty($_GET['key'])) {
Expand All @@ -696,15 +696,15 @@ public function angelleye_set_express_checkout_request() {
'key' => wc_clean($_GET['key']),
'order_id' => $order_id,
'utm_nooverride' => 1
), WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')));
), untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))));
} else {
$returnurl = urldecode(add_query_arg(array(
'pp_action' => 'get_express_checkout_details',
'pay_for_order' => true,
'key' => wc_clean($_GET['key']),
'order_id' => $order_id,
'utm_nooverride' => 1
), WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')));
), untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE'))));
}
angelleye_set_session('order_awaiting_payment', absint( wp_unslash( $order_id) ) );
} else {
Expand Down
6 changes: 3 additions & 3 deletions classes/wc-gateway-paypal-advanced-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,13 +542,13 @@ public function get_secure_token($order) {

// Determine the ERRORURL,CANCELURL and SILENTPOSTURL

$cancelurl = add_query_arg('cancel_ec_trans', 'true', WC()->api_request_url('WC_Gateway_PayPal_Advanced_AngellEYE'));
$cancelurl = add_query_arg('cancel_ec_trans', 'true', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Advanced_AngellEYE')));
$paypal_args['CANCELURL[' . strlen($cancelurl) . ']'] = $cancelurl;

$errorurl = add_query_arg('error', 'true', WC()->api_request_url('WC_Gateway_PayPal_Advanced_AngellEYE'));
$errorurl = add_query_arg('error', 'true', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Advanced_AngellEYE')));
$paypal_args['ERRORURL[' . strlen($errorurl) . ']'] = $errorurl;

$silentposturl = add_query_arg('silent', 'true', WC()->api_request_url('WC_Gateway_PayPal_Advanced_AngellEYE'));
$silentposturl = add_query_arg('silent', 'true', untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Advanced_AngellEYE')));
$paypal_args['SILENTPOSTURL[' . strlen($silentposturl) . ']'] = $silentposturl;
if( $this->send_items ) {
$PaymentData = $this->calculation_angelleye->order_calculation($order_id);
Expand Down
2 changes: 1 addition & 1 deletion classes/wc-gateway-paypal-pro-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ public function process_payment($order_id) {

return array(
'result' => 'success',
'redirect' => add_query_arg(array('acs' => $order_id), WC()->api_request_url('WC_Gateway_PayPal_Pro_AngellEYE', is_ssl()))
'redirect' => add_query_arg(array('acs' => $order_id), untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Pro_AngellEYE', is_ssl())))
);
} elseif ($this->liability_shift && 'N' !== $this->get_centinel_value("Enrolled")) {
wc_add_notice(apply_filters('angelleye_pc_process_payment_authentication_unavailable', __('Authentication unavailable. Please try a different payment method or card.', 'paypal-for-woocommerce')), 'error');
Expand Down
4 changes: 2 additions & 2 deletions classes/wc-gateway-paypal-pro-payflow-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ function process_payment($order_id) {

return array(
'result' => 'success',
'redirect' => add_query_arg(array('acs' => $order_id), WC()->api_request_url('WC_Gateway_PayPal_Pro_PayFlow_AngellEYE', is_ssl()))
'redirect' => add_query_arg(array('acs' => $order_id), untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Pro_PayFlow_AngellEYE', is_ssl())))
);
} elseif ($this->liability_shift && 'N' !== $this->get_centinel_value("Enrolled")) {
wc_add_notice(apply_filters('angelleye_pc_process_payment_authentication_unavailable', __('Authentication unavailable. Please try a different payment method or card.', 'paypal-for-woocommerce')), 'error');
Expand Down Expand Up @@ -905,7 +905,7 @@ function process_payment($order_id) {
$this->add_log('PaReq: ' . $PayPalResult['PAREQ']);
return array(
'result' => 'success',
'redirect' => add_query_arg(array('acs' => $order_id), WC()->api_request_url('WC_Gateway_PayPal_Pro_PayFlow_AngellEYE', is_ssl()))
'redirect' => add_query_arg(array('acs' => $order_id), untrailingslashit(WC()->api_request_url('WC_Gateway_PayPal_Pro_PayFlow_AngellEYE', is_ssl())))
);
} elseif ($this->liability_shift === false && 'E' !== $PayPalResult['AUTHENTICATION_STATUS']) {
$pass_required_field = array('AUTHENTICATION_ID', 'AUTHENTICATION_STATUS', 'ECI');
Expand Down
Loading

0 comments on commit 9a8e7cb

Please sign in to comment.