diff --git a/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-function-angelleye.php b/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-function-angelleye.php index fe901f750..dd47b3fe7 100644 --- a/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-function-angelleye.php +++ b/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-function-angelleye.php @@ -6,18 +6,6 @@ class WC_Gateway_PayPal_Express_Function_AngellEYE { - public static function is_ssl_enable() { - try { - if (is_ssl() || get_option('woocommerce_force_ssl_checkout') == 'yes') { - return true; - } else { - return false; - } - } catch (Exception $ex) { - - } - } - public function express_checkout_is_available() { try { $is_enable = $this->express_checkout_get_option('enabled'); diff --git a/classes/wc-gateway-braintree-angelleye.php b/classes/wc-gateway-braintree-angelleye.php index 2e63f04f0..8c6e1ad8f 100644 --- a/classes/wc-gateway-braintree-angelleye.php +++ b/classes/wc-gateway-braintree-angelleye.php @@ -15,7 +15,7 @@ class WC_Gateway_Braintree_AngellEYE extends WC_Payment_Gateway_CC { function __construct() { $this->id = 'braintree'; $this->icon = $this->get_option('card_icon', plugins_url('/assets/images/cards.png', plugin_basename(dirname(__FILE__)))); - if (is_ssl() || get_option('woocommerce_force_ssl_checkout') == 'yes') { + if (is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' )) { $this->icon = preg_replace("/^http:/i", "https:", $this->icon); } $this->icon = apply_filters('woocommerce_braintree_icon', $this->icon); @@ -149,7 +149,7 @@ public function checks() { if (version_compare(phpversion(), '5.2.1', '<')) { echo '

' . sprintf(__('Braintree Error: Braintree requires PHP 5.2.1 and above. You are using version %s.', 'paypal-for-woocommerce'), phpversion()) . '

'; } - if ('no' == get_option('woocommerce_force_ssl_checkout') && !class_exists('WordPressHTTPS') && $this->enable_braintree_drop_in == false && $this->sandbox == false) { + if (!is_ssl() && $this->enable_braintree_drop_in == false && $this->sandbox == false) { echo '

' . sprintf(__('Braintree is enabled, but the force SSL option is disabled; your checkout may not be secure! Please enable SSL and ensure your server has a valid SSL certificate - Braintree custome credit card UI will only work in sandbox mode.', 'paypal-for-woocommerce'), admin_url('admin.php?page=wc-settings&tab=checkout')) . '

'; } $this->add_dependencies_admin_notices(); diff --git a/classes/wc-gateway-paypal-advanced-angelleye.php b/classes/wc-gateway-paypal-advanced-angelleye.php index 3644618c8..6a80a281c 100644 --- a/classes/wc-gateway-paypal-advanced-angelleye.php +++ b/classes/wc-gateway-paypal-advanced-angelleye.php @@ -69,7 +69,7 @@ public function __construct() { $this->is_encrypt = $this->get_option('is_encrypt', 'no'); $this->transtype = $this->get_option('transtype'); $this->mobilemode = $this->get_option('mobilemode', 'yes'); - if ( is_ssl() || get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) { + if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { $this->icon = preg_replace("/^http:/i", "https:", $this->icon); } $this->icon = apply_filters('woocommerce_paypal_advanced_icon', $this->icon); diff --git a/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php b/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php index 2b88eb8ee..d50e6ae38 100644 --- a/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php +++ b/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php @@ -36,7 +36,7 @@ function __construct() { $this->init_form_fields(); $this->init_settings(); $this->icon = $this->get_option('card_icon', plugins_url('/assets/images/cards.png', plugin_basename(dirname(__FILE__)))); - if (is_ssl()) { + if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { $this->icon = preg_replace("/^http:/i", "https:", $this->icon); } $this->icon = apply_filters('woocommerce_paypal_credit_card_rest_icon', $this->icon); diff --git a/classes/wc-gateway-paypal-express-angelleye.php b/classes/wc-gateway-paypal-express-angelleye.php index 2ffcfe213..9e184a10d 100644 --- a/classes/wc-gateway-paypal-express-angelleye.php +++ b/classes/wc-gateway-paypal-express-angelleye.php @@ -456,16 +456,16 @@ public function get_icon() { if ($this->checkout_with_pp_button_type == 'customimage') { $image_path = $this->pp_button_type_my_custom; } - if ( is_ssl() || get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) { + if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { $image_path = str_replace( 'http:', 'https:', $image_path ); } if ($this->paypal_account_optional == 'no' && $this->show_paypal_credit == 'yes' && $this->checkout_with_pp_button_type == 'paypalimage') { $image_path = plugins_url('/assets/images/paypal.png', plugin_basename(dirname(__FILE__))); - if ( is_ssl() || get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) { + if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { $image_path = str_replace( 'http:', 'https:', $image_path ); } $image_path_two = plugins_url('/assets/images/PP_credit_logo.png', plugin_basename(dirname(__FILE__))); - if ( is_ssl() || get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) { + if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { $image_path_two = str_replace( 'http:', 'https:', $image_path_two ); } $icon = "" . __("; @@ -480,7 +480,7 @@ public function get_icon() { public function init_form_fields() { $rest_url = get_admin_url() . 'admin.php?page=wc-settings&tab=checkout§ion=paypal_express&pms_reset=true'; $require_ssl = ''; - if (!AngellEYE_Gateway_Paypal::is_ssl()) { + if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { $require_ssl = __('This image requires an SSL host. Please upload your image to www.sslpic.com and enter the image URL here.', 'paypal-for-woocommerce'); } $skip_final_review_option_not_allowed_guest_checkout = ''; @@ -1353,7 +1353,7 @@ public static function angelleye_get_paypalimage() { $image_path = plugins_url('/assets/images/dynamic-image/' . AngellEYE_Utility::get_button_locale_code() . '.png', plugin_basename(dirname(__FILE__))); } else { $image_path = plugins_url('/assets/images/dynamic-image/' . AngellEYE_Utility::get_button_locale_code() . '.gif', plugin_basename(dirname(__FILE__))); - if ( is_ssl() || get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) { + if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { $image_path = preg_replace("/^http:/i", "https:", $image_path); } } diff --git a/classes/wc-gateway-paypal-pro-angelleye.php b/classes/wc-gateway-paypal-pro-angelleye.php index a28c76d76..4fb5fbbde 100644 --- a/classes/wc-gateway-paypal-pro-angelleye.php +++ b/classes/wc-gateway-paypal-pro-angelleye.php @@ -117,7 +117,7 @@ function __construct() { //fix ssl for image icon $this->icon = $this->get_option('card_icon', plugins_url('/assets/images/cards.png', plugin_basename(dirname(__FILE__)))); - if ( is_ssl() || get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) { + if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { $this->icon = preg_replace("/^http:/i", "https:", $this->icon); } $this->icon = apply_filters('woocommerce_paypal_pro_icon', $this->icon); @@ -462,7 +462,7 @@ public function admin_options() { */ function is_available() { if ($this->enabled == "yes") : - if ($this->testmode == false && get_option('woocommerce_force_ssl_checkout') == 'no' && !class_exists('WordPressHTTPS')) return false; + if ($this->testmode == false && !is_ssl()) return false; // Currency check if (!in_array(get_woocommerce_currency(), apply_filters('woocommerce_paypal_pro_supported_currencies', array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HUF', 'JPY', 'NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD')))) return false; // Required fields check diff --git a/classes/wc-gateway-paypal-pro-payflow-angelleye.php b/classes/wc-gateway-paypal-pro-payflow-angelleye.php index 0ff00a744..17dfb950d 100644 --- a/classes/wc-gateway-paypal-pro-payflow-angelleye.php +++ b/classes/wc-gateway-paypal-pro-payflow-angelleye.php @@ -47,7 +47,7 @@ function __construct() { //fix ssl for image icon $this->icon = $this->get_option('card_icon', plugins_url('/assets/images/payflow-cards.png', plugin_basename(dirname(__FILE__)))); - if ( is_ssl() || get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) { + if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { $this->icon = preg_replace("/^http:/i", "https:", $this->icon); } $this->icon = apply_filters('woocommerce_paypal_pro_payflow_icon', $this->icon); diff --git a/paypal-for-woocommerce.php b/paypal-for-woocommerce.php index 1930b41a9..67aed78a1 100644 --- a/paypal-for-woocommerce.php +++ b/paypal-for-woocommerce.php @@ -229,8 +229,8 @@ function admin_notices() { if ((!empty($pp_pro['enabled']) && $pp_pro['enabled'] == 'yes') || ( !empty($pp_payflow['enabled']) && $pp_payflow['enabled']=='yes' )) { // Show message if enabled and FORCE SSL is disabled and WordpressHTTPS plugin is not detected - if ( get_option('woocommerce_force_ssl_checkout')=='no' && ! class_exists( 'WordPressHTTPS' ) && !get_user_meta($user_id, 'ignore_pp_ssl') ) - echo ''; + if ( !is_ssl() && !get_user_meta($user_id, 'ignore_pp_ssl') ) + echo ''; if (($pp_pro['testmode']=='yes' || $pp_payflow['testmode']=='yes' || $pp_settings['testmode']=='yes') && !get_user_meta($user_id, 'ignore_pp_sandbox')) { $testmodes = array(); if ($pp_pro['enabled']=='yes' && $pp_pro['testmode']=='yes') $testmodes[] = 'PayPal Pro'; @@ -318,7 +318,7 @@ public function admin_scripts() wp_register_script( 'angelleye_admin', plugins_url( '/assets/js/angelleye-admin.js' , __FILE__ ), array( 'jquery' ), VERSION_PFW); $this->use_wp_locale_code = !empty($pp_settings['use_wp_locale_code']) ? $pp_settings['use_wp_locale_code'] : 'yes'; $translation_array = array( - 'is_ssl' => AngellEYE_Gateway_Paypal::is_ssl()? "yes":"no", + 'is_ssl' => is_ssl() ? "yes":"no", 'choose_image' => __('Choose Image', 'paypal-for-woocommerce'), 'shop_based_us' => (substr(get_option("woocommerce_default_country"), 0, 2) == 'US') ? "yes" : "no", 'payment_method' => $payment_method, @@ -446,17 +446,6 @@ function donate_message() { } } - /** - * Check if site is SSL ready - * - */ - static public function is_ssl() - { - if (is_ssl() || get_option('woocommerce_force_ssl_checkout') == 'yes' || class_exists('WordPressHTTPS')) - return true; - return false; - } - public function angelleye_admin_menu_own(){ $this->plugin_screen_hook_suffix = add_submenu_page( 'options-general.php',