diff --git a/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php b/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php index c6affa485..308fcd00f 100644 --- a/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php +++ b/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php @@ -86,11 +86,12 @@ public function __construct() { public function buy_now_button() { try { global $post, $product; + $ec_html_button = ''; if ($this->enabled == 'yes' && $this->show_on_product_page == 'yes') { if ($this->enable_tokenized_payments == 'yes') { $this->function_helper->angelleye_ec_save_payment_method_checkbox(); } - echo '
'; + $ec_html_button = '
'; $_product = wc_get_product($post->ID); $button_dynamic_class = 'single_variation_wrap_angelleye_' . $product->id; $hide = ''; @@ -100,18 +101,19 @@ public function buy_now_button() { $add_to_cart_action = esc_url(add_query_arg('express_checkout', '1')); switch ($this->checkout_with_pp_button_type) { case 'textbutton': - echo ''; + $ec_html_button .= ''; break; case "paypalimage": $button_img = WC_Gateway_PayPal_Express_AngellEYE::angelleye_get_paypalimage(); - echo ''; + $ec_html_button .= ''; break; case "customimage": - echo ''; + $ec_html_button .= ''; break; } - echo '
'; + $ec_html_button .= '
'; } + echo apply_filters('angelleye_ec_product_page_buy_now_button', $ec_html_button); } catch (Exception $ex) { } @@ -353,15 +355,19 @@ public function is_express_checkout_credentials_is_set() { public function top_cart_button() { if ($this->is_express_checkout_credentials_is_set()) { + $top_cart_button_html = ''; if ($this->button_position == 'top' || $this->button_position == 'both') { - echo '
'; - $this->woocommerce_paypal_express_checkout_button_angelleye(); - echo '
'; + do_action('angelleye_ec_before_top_cart_button', $this); + $top_cart_button_html .= '
'; + $top_cart_button_html .= $this->woocommerce_paypal_express_checkout_button_angelleye($return = true); + $top_cart_button_html .= '
'; + echo apply_filters('angelleye_ec_top_cart_button', $top_cart_button_html); + do_action('angelleye_ec_after_top_cart_button', $this); } } } - public function woocommerce_paypal_express_checkout_button_angelleye() { + public function woocommerce_paypal_express_checkout_button_angelleye($return = false) { if (!AngellEYE_Utility::is_valid_for_use_paypal_express()) { return false; } @@ -369,23 +375,27 @@ public function woocommerce_paypal_express_checkout_button_angelleye() { if ($this->enable_tokenized_payments == 'yes') { $this->function_helper->angelleye_ec_save_payment_method_checkbox(); } + if($return == false) { + do_action('angelleye_ec_before_buttom_cart_button', $this); + } + $cart_button_html = ''; $angelleyeOverlay = ''; switch ($this->checkout_with_pp_button_type) { case 'textbutton': - echo '' . $this->pp_button_type_text_button . ''; - echo $angelleyeOverlay; + $cart_button_html .= '' . $this->pp_button_type_text_button . ''; + $cart_button_html .= $angelleyeOverlay; break; case 'paypalimage': - echo ''; - echo '' . __('Pay with PayPal', 'paypal-for-woocommerce') . ''; - echo ""; - echo $angelleyeOverlay; + $cart_button_html .= ''; + $cart_button_html .= '' . __('Pay with PayPal', 'paypal-for-woocommerce') . ''; + $cart_button_html .= ""; + $cart_button_html .= $angelleyeOverlay; break; case 'customimage': - echo ''; - echo '' . __('Pay with PayPal', 'paypal-for-woocommerce') . ''; - echo ""; - echo $angelleyeOverlay; + $cart_button_html .= ''; + $cart_button_html .= '' . __('Pay with PayPal', 'paypal-for-woocommerce') . ''; + $cart_button_html .= ""; + $cart_button_html .= $angelleyeOverlay; break; } if ($this->show_paypal_credit == 'yes') { @@ -393,8 +403,14 @@ public function woocommerce_paypal_express_checkout_button_angelleye() { $paypal_credit_button_markup .= '' . __('Check out with PayPal Credit', 'paypal-for-woocommerce') . ''; $paypal_credit_button_markup .= ''; $paypal_credit_button_markup .= $angelleyeOverlay; - echo $paypal_credit_button_markup; + $cart_button_html .= $paypal_credit_button_markup; + } + if($return == true) { + return $cart_button_html; + } else { + echo $cart_button_html; } + do_action('angelleye_ec_after_buttom_cart_button', $this); } } @@ -411,31 +427,33 @@ public function checkout_message() { if($this->enable_tokenized_payments == 'yes') { $this->function_helper->angelleye_ec_save_payment_method_checkbox(); } - echo '
'; + do_action('angelleye_ec_checkout_page_before_checkout_button', $this); + $ec_top_checkout_button = ''; + $ec_top_checkout_button .= '
'; $_angelleyeOverlay = ''; switch ($this->checkout_with_pp_button_type) { case "textbutton": - echo '
'; - echo '' . $this->pp_button_type_text_button . ''; - echo $_angelleyeOverlay; - echo '
'; + $ec_top_checkout_button .= '
'; + $ec_top_checkout_button .= '' . $this->pp_button_type_text_button . ''; + $ec_top_checkout_button .= $_angelleyeOverlay; + $ec_top_checkout_button .= '
'; break; case "paypalimage": - echo '
'; - echo ''; - echo "" . __("; - echo ""; - echo $_angelleyeOverlay; - echo '
'; + $ec_top_checkout_button .= '
'; + $ec_top_checkout_button .= ''; + $ec_top_checkout_button .= "" . __("; + $ec_top_checkout_button .= ""; + $ec_top_checkout_button .= $_angelleyeOverlay; + $ec_top_checkout_button .= '
'; break; case "customimage": $button_img = $this->pp_button_type_my_custom; - echo '
'; - echo ''; - echo "" . __("; - echo ""; - echo $_angelleyeOverlay; - echo '
'; + $ec_top_checkout_button .= '
'; + $ec_top_checkout_button .= ''; + $ec_top_checkout_button .= "" . __("; + $ec_top_checkout_button .= ""; + $ec_top_checkout_button .= $_angelleyeOverlay; + $ec_top_checkout_button .= '
'; break; } if ($this->show_paypal_credit == 'yes') { @@ -445,11 +463,13 @@ public function checkout_message() { $paypal_credit_button_markup .= ''; $paypal_credit_button_markup .= $_angelleyeOverlay; $paypal_credit_button_markup .= '
'; - echo $paypal_credit_button_markup; + $ec_top_checkout_button .= $paypal_credit_button_markup; } - echo '
'; - echo '

', $this->angelleye_skip_text, '

'; - echo '
'; + $ec_top_checkout_button .= '
'; + $ec_top_checkout_button .= '

' . $this->angelleye_skip_text . '

'; + $ec_top_checkout_button .= '
'; + echo apply_filters('angelleye_ec_checkout_page_buy_now_nutton', $ec_top_checkout_button); + do_action('angelleye_ec_checkout_page_after_checkout_button', $this); echo '
'; echo ''; echo '
';