diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..b908405 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,255 @@ +*** Payment Gateway Based Fees and Discounts for WooCommerce *** +2024-11-22 - version 2.15.0 +* Fix - Translation loading was triggered too early, causing errors when changing the site language in WordPress 6.7. +* Tweak - Removed the call to our tracking server to fetch the deactivation reasons and added them in the plugin itself. + +2024-10-22 - version 2.14.0 +* Fix - Deactivation survey request was being sent even though 'Skip & deactivate' was selected while deactivating the plugin. +* Fix - Compatibility issue with the WooCommerce Authorize.Net Gateway plugin. +* Fix - The payment gateway fees or discounts are not charged on the 'Pay for this order' page. + +2024-06-09 - version 2.13.0 +* Fix - Added a nonce check for Cross-Site Request Forgery (CSRF) vulnerability on the reset button. +* Fix – Payment Gateway fees did not update when the payment gateway was changed on WooCommerce Cart/Checkout blocks. +* Fix - The maximum fee value option was not working as expected. +* Fix - A fatal error was shown when activating the 'WooCommerce Table Rate Shipping' plugin with our PGBF lite plugin. + +2024-04-01 - version 2.12.2 +* Fix – Cross Site Request Forgery (CSRF) vulnerability. + +2024-03-21 - version 2.12.1 +* Fix – Cross Site Request Forgery (CSRF) vulnerability. + +2024-02-27 - version 2.12.0 +* Fix - The payment gateway fees are added twice when Woo Discount Rules plugins are activated. +* Fix - Payment gateway fees are not visible on the checkout block page. +* Fix - Compatibility with Woo Discount Rules plugins where the payment gateway fees are added twice. +* Fix - Compatibility with the Almapay payment plugin. +* Fix - Added hook/filter called 'alg_wc_checkout_fees_after_fees_added' & 'alg_wc_checkout_fees_after_order_updated' to customize fees. +* Fix - Payment gateway fees are not calculated for one of the Nexi XPay method. + +2023-11-21 - version 2.11.0 +* Fix - Tax is being included for Discount. +* Fix - Option to show fees on cart page based on previously payment method was selected. +* Fix - Unable to remove fees from Edit Order Page. +* Fix - WooCommerce Fees are being removed when adding Order Fees in Admin Side. +* Dev - Percentage Fees option added for 'Global Extra Fee'. +* Fix - Cross Site Request Forgery (CSRF) vulnerability. + +2023-07-13 - version 2.10.3 +* Fix - Fees are not getting recalculated on the backend when the payment gateway is changed after placing the order. +* Fix - Fatal errors while processing a refund on the edit order page. + +2023-07-04 - version 2.10.2 +* Fix - After an order has been placed, fees are being duplicated. +* Fix - Fatal Errors on the checkout page with PHP 8.1.12. +* Fix - Added deactivation survey v2. +* Fix - Payment methods are collapsing a moment after the page loads on the "Change Payment" button of Subscription order. + +2023-06-20 - version 2.10.1 +* Fix - Fatal error when High-Performance Order Storage (HPOS) is enabled on store. + +2023-06-20 - version 2.10.0 +* Fix - Compatibility with "zipMoney(Zip Co) Payments Plugin for WooCommerce" plugin. +* Fix - Compatibility with "iyzico WooCommerce" plugin. +* Fix - Compatibility with the "Bykea.Cash – Online Payments" plugin. +* Fix - Compatibility with "ECPay" plugin. +* Fix - Compatibility with "bSecure – Your Universal Checkout" plugin. +* Fix - Made some changes to solve the conflict with Germanized for WooCommerce plugin. +* Fix - Incorrect fees amount when the fees are set in a negative value and tax is enabled. +* Fix - Not possible to select the Payment Gateway on the checkout page when our plugin is activated. +* Fix - Fees & Discounts are not getting applied for the individual product. +* Fix - When we access the link from the Invoice to pay the payment, stripe card details fields are hidden. +* Fix - Fees are not getting recalculated on the backend when the payment gateway is changed after placing the order. +* Fix - Fatal Errors on the checkout page with PHP 8.1.12. +* Fix - Fatal Errors on error message after activating the plugin with PHP 8.2.4. + +2023-01-17 - version 2.9.0 +* Fix - Fatal Errors on the checkout page with PHP 8. +* Fix - Fees are getting multiplied when we try to repay the subscription order. + +2022-11-15 - version 2.8.0 +* Enhancement - Introduced compatibility with WooCommerce High Performance Order Storage. + +2022-07-12 - version 2.7.0 +* Fix - Plugin strings are not getting translated according to the User's selected language. +* Fix - The fees should be applied after calculating the discounted price. +* Fix - Credit Card Details Fields are becoming invisible on the payment page. +* Fix - Compatibility with WooCommerce Subscriptions plugin. +* Fix - Discount is applied multiple times when customers try to pay for the order. + +2021-09-28 - version 2.6.4 +* Fix - Zero priced products were showing the discount in the payment gateway info table on the product page. This is fixed now. +* Fix - When the order is created manually without any products in it and only WooCommerce fees are added at that time fees were not getting added. This is fixed now. +* Fix - Style and Script were loading all around admin side and not only on the particular page. This is fixed now. +* Fix - When taxes were enabled on the payment gateway fees, fatal error was coming on the pay for order page. This is fixed now. + +2021-05-12 - version 2.6.3 +* Enhancement - Now the discount/fees will be added or removed on the "Pay for order" endpoint also. +* Fix - Compatibility with WooCommerce ERIP Gateway Payment plugin. +* Fix - Compatibility with Klarna payment gateway. +* Fix - HTML code was coming in the titles of payment gateway on settings page. This is fixed now. + +2020-11-12 - version 2.6.2 +* Update compatibility with WooCommerce 4.7. +* Fix - On backend the gateway fees were accepted only as whole numbers. This is fixed now. +* Fix - Getting errors in debug log when the option "Enable Tax" were enabled. This is fixed now. +* Fix - Includes string was not getting translated on the checkout page. This is fixed now. +* Fix - On checkout page tax name was not getting when the tax was included in the fees. This is fixed now. + +2020-03-20 - version 2.6.1 +* Update compatibility with WooCommerce 4.0.0. + +2019-08-23 - version 2.6 +* Made the plugin code compliant with WPCS standards. +* Added UTM tags for the Pro plugin links. + +2019-04-18 - version 2.5.9 +* Fix - Fees are not being carried over from the Checkout page to the order. +* Fix - Discounts are not being applied to renewal orders for subscription products. + +2019-04-11 - version 2.5.8 +* Added compatibility with WooCommerce Subscriptions. +* The plugin goes into continuous loading of the cart at Checkout when precision is left blank for rounding. Fixed the same. +* Added uninstall.php file to ensure the plugin data is deleted when the plugin is uninstalled. + +2019-02-01 - version 2.5.7 +* Author name in the header has been changed. + +2018-11-16 - version 2.5.6 +* Author name and URL updated due to handover of the plugins. + +2018-10-31 - version 2.5.5 +* Compatibility with WooCommerce 3.5.0 tested. + +2018-10-16 - version 2.5.4 +* Dev - Current (i.e. chosen) payment gateway function rewritten (fixes the issue with 100% discount coupons on the checkout page - fees were not reapplied when coupon is removed). + +2018-10-12 - version 2.5.3 +* Fix - Coupons usage with "WooCommerce Gift Certificates" plugin fixed. +* Fix - Settings hook priority increased, so gateways fees settings are not loaded too early (fixes the issue with "Mollie Payments for WooCommerce" plugin). + +2018-09-17 - version 2.5.2 +* Dev - Code refactoring. + +2018-08-04 - version 2.5.1 +* Fix - Product categories - Calculation type - Categories to exclude - Only for selected products - Option fixed. +* Dev - Admin settings descriptions updated. +* Dev - "States to include/exclude" options added. + +2018-08-04 - version 2.5.0 +* Dev - Major code refactoring and clean up. Main plugin file and POT file renamed. +* Dev - Admin settings restyled and descriptions updated. +* Dev - "Reset section settings" options added. +* Dev - Raw input now allowed in all "Info" section templates. + +2018-07-30 - version 2.4.0 +* Dev - "Merge All Fees" added to "General" section. +* Dev - "Global Extra Fee" added to "General" section. +* Dev - Current (i.e. chosen) payment gateway function rewritten (fixes the issue with "zipMoney" payment gateway). +* Dev - "Customer Countries" options added to both fees separately. +* Dev - "Europe", "European Union", "Europe excluding EU", "Eurozone", "Africa", "Asia", "Australia and Oceania", "Central America", "North America" and "South America" added as country selection. +* Dev - Eight more countries added to the list. +* Dev - "Info" admin settings section added (options moved from "General" section). +* Dev - Admin settings restyled. +* Dev - Plugin link updated from https://wpcodefactory.com to https://wpfactory.com. +* Dev - Code clean up. + +2018-01-07 - version 2.3.3 +* Dev - Additional check added in `Alg_WC_Checkout_Fees_Settings_Gateways` (prevents AJAX error on some servers). + +2018-01-02 - version 2.3.2 +* Dev - WooCommerce 3.2 compatibility - `WC_Tax::get_tax_total()` replaced with `get_cart_contents_taxes()` and `get_shipping_taxes()`. +* Dev - Additional check for `WC()->payment_gateways` to be set, added in `add_gateways_fees()`. +* Dev - Additional checks for tax class to exist added (in Core and Info). +* Dev - Additional checks if product's price is zero added (in Info). +* Dev - Per product settings JS file updated. +* Dev - "WC tested up to" added to the plugin header. + +2017-08-26 - version 2.3.1 +* Dev - Info - `%product_price_diff_percent%` replaceable value added. +* Dev - Wrapping div (class `alg_checkout_fees`) added to meta box settings. +* Dev - "General" settings restyled. + +2017-08-16 - version 2.3.0 +* Dev - "Aelia Currency Switcher for WooCommerce" plugin currency conversion filter added to: `get_max_ranges()`, `min_cart_amount`, `max_cart_amount`, `min_fee`, `max_fee`, `min_fee_2`, `max_fee_2`. +* Dev - "Coupons Rule" options added. +* Dev - Code refactoring. +* Dev - Settings restyled. + +2017-07-27 - version 2.2.2 +* Fix - Removed additional check if `add_gateways_fees()` has already been executed (was added in v2.2.1). +* Dev - "Delete All Plugin Data" option added. +* Dev - Code cleanup etc. + +2017-07-22 - version 2.2.1 +* Fix - Per Product - `custom_atts` for fields (step etc.) fixed. +* Fix - Additional check if `add_gateways_fees()` has already been executed added (this prevents fees duplicating on some servers). + +2017-06-27 - version 2.2.0 +* Dev - WooCommerce 3.x.x compatibility - Deprecated `get_price_excluding_tax()`, `get_price_including_tax()`, `get_display_price()` notices fixed. +* Dev - WooCommerce 3.x.x compatibility - Deprecated `get_formatted_variation_attributes()` notice fixed. +* Dev - WooCommerce 3.x.x compatibility - Deprecated `get_country()` notice fixed. +* Dev - "Add Taxes" option added for both global and per product fees. +* Dev - `load_plugin_textdomain()` moved from `init` hook to constructor. +* Dev - Plugin header updated ("Text Domain" and "Domain Path" added). +* Dev - Plugin link updated from http://coder.fm to https://wpcodefactory.com. + +2016-10-04 - version 2.1.1 +* Fix - Bug when local and global fees have same title, fixed. +* Fix - Categories restrictions wrongly applied to per product fees, fixed. +* Dev - "Max Range Options" options section added to "General" settings. +* Dev - "Override Global Fee" (main and additional) option added to per product settings. +* Dev - "Minimum Fee Value", "Maximum Fee Value", "Minimum Additional Fee Value" and "Maximum Additional Fee Value" options added to both local and global fees. +* Dev - "Minimum Cart Amount" and "Maximum Cart Amount" options title modified. + +2016-08-20 - version 2.1.0 +* Fix - Tax bug fixed when "Categories to include - Calculation type" is equal to "Only for selected products". +* Fix - Tax bug fixed in info. +* Fix - "Categories to include - Calculation type" with value "Only for selected products" fixed when displaying info. +* Dev - "Categories to exclude - Calculation type." option added. +* Dev - "Categories to include (additional fee)." and "Categories to exclude (additional fee)." options added. +* Dev - Version system added. +* Dev - Author changed. +* Dev - Plugin renamed. + +2016-08-06 - version 2.0.2 +* Fix - `sanitize_title()` added to `add_gateway_fees_settings_hook()` and removed from `output_sections()`. +* Dev - Multisite support added. +* Dev - "Variable Products Info" option added. +* Dev - "Categories to include - Calculation type" option added to global fees. +* Dev - Language (POT) file added. +* Dev - Author changed. + +2016-03-10 - version 2.0.1 +* Fix - Additional checks in `add_gateway_fees_settings_hook()`. + +2016-03-01 - version 2.0.0 +* Fix - Checked tab in admin per product fees is marked now. +* Fix - Info on Single Product bugs fixed: for variable products; for percent fees. +* Fix - "General" section in admin settings menu is marked bold by default. +* Dev - `%product_title%`, `%product_variation_atts%` added. +* Dev - Info on Single Product - `[alg_show_checkout_fees_full_info]` and `[alg_show_checkout_fees_lowest_price_info]` shortcodes added. +* Dev - Info on Single Product - Lowest Price Info on Single Product Page added. +* Dev - Info on Single Product - `%gateway_fee_title%` and `%gateway_fee_value%` removed from info. +* Dev - "Add Product Title to Fee/Discount Title" option added to "General > Fees/Discounts per Product" settings. +* Dev - "Hide Gateways Fees and Discounts on Cart Page" option added to "General" settings. +* Dev - "Exclude Shipping" option added for both global and per product fees. +* Dev - "Title" option added for optional "Additional fee" (per product and global). +* Dev - "Customer Countries" (include / exclude) options added to global fees. +* Dev - "Product Categories" (include / exclude) options added to global fees. +* Dev - Compatibility with "Aelia Currency Switcher for WooCommerce" plugin added (for fixed fees; for percent fees compatibility was already there). +* Dev - "Fee Calculation (for Fixed Fees)" options (once / by product quantity) added to per product fees. +* Dev - "Fee Calculation (for Percent Fees)" options (for all cart / by product) added to per product fees. + +2015-10-27 - version 1.3.0 +* Dev - Second optional fee added. + +2015-09-30 - version 1.2.0 +* Dev - Checkout fees/discounts info on single product frontend page added. + +2015-09-04 - version 1.1.0 +* Dev - Checkout fees/discounts on per product basis added. + +2015-08-29 - version 1.0.0 +* Initial Release. \ No newline at end of file diff --git a/checkout-block/checkout-blocks-initialize.php b/checkout-block/checkout-blocks-initialize.php index 21ace28..be7a8d3 100644 --- a/checkout-block/checkout-blocks-initialize.php +++ b/checkout-block/checkout-blocks-initialize.php @@ -14,25 +14,25 @@ use Automattic\WooCommerce\StoreApi\Schemas\V1\CheckoutSchema; add_action( - 'woocommerce_blocks_loaded', - function () { - require_once 'class-blocks-integration.php'; - add_action( - 'woocommerce_blocks_checkout_block_registration', - function ( $integration_registry ) { - $integration_registry->register( new CheckoutFeesBlocksIntegration() ); - } - ); + 'woocommerce_blocks_loaded', + function () { + require_once 'class-blocks-integration.php'; + add_action( + 'woocommerce_blocks_checkout_block_registration', + function ( $integration_registry ) { + $integration_registry->register( new CheckoutFeesBlocksIntegration() ); + } + ); - if ( function_exists( 'woocommerce_store_api_register_update_callback' ) ) { - woocommerce_store_api_register_update_callback( - array( - 'namespace' => 'checkout-fees-for-woocommerce', - 'callback' => 'update_cart_fees', - ) - ); - } - } + if ( function_exists( 'woocommerce_store_api_register_update_callback' ) ) { + woocommerce_store_api_register_update_callback( + array( + 'namespace' => 'checkout-fees-for-woocommerce', + 'callback' => 'update_cart_fees', + ) + ); + } + } ); /** diff --git a/checkout-block/class-blocks-integration.php b/checkout-block/class-blocks-integration.php index 67e32a2..dec7130 100644 --- a/checkout-block/class-blocks-integration.php +++ b/checkout-block/class-blocks-integration.php @@ -1,4 +1,4 @@ - $pgbf_plugin_name, - 'plugin_base' => $pgbf_file_name, - 'script_file' => $plugin_url . '/includes/js/plugin-deactivation.js', - 'plugin_short_name' => $pgbf_plugin_prefix, - 'version' => $pgbf_get_previous_version, - 'plugin_locale' => $pgbf_locale, - ) - ); - } + if ( strpos( $_SERVER['REQUEST_URI'], 'plugins.php' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'action=deactivate' ) !== false || ( strpos( $_SERVER['REQUEST_URI'], 'admin-ajax.php' ) !== false && isset( $_POST['action'] ) && $_POST['action'] === 'tyche_plugin_deactivation_submit_action' ) ) { // phpcs:ignore + require_once 'component/plugin-deactivation/class-tyche-plugin-deactivation.php'; + new Tyche_Plugin_Deactivation( + array( + 'plugin_name' => $pgbf_plugin_name, + 'plugin_base' => $pgbf_file_name, + 'script_file' => $plugin_url . '/includes/js/plugin-deactivation.js', + 'plugin_short_name' => $pgbf_plugin_prefix, + 'version' => $pgbf_get_previous_version, + 'plugin_locale' => $pgbf_locale, + ) + ); + } - require_once( "component/plugin-tracking/class-tyche-plugin-tracking.php" ); - new Tyche_Plugin_Tracking( - array( - 'plugin_name' => $pgbf_plugin_name, - 'plugin_locale' => $pgbf_locale, - 'plugin_short_name' => $pgbf_plugin_prefix, - 'version' => $pgbf_get_previous_version, - 'blog_link' => $pgbf_blog_post_link, - ) - ); - } - } - - /** - * It will retrun the plguin name. - * @return string $ts_plugin_name Name of the plugin - */ - public static function ts_get_plugin_name () { - $pgbf_plugin_dir = dirname ( dirname ( __FILE__ ) ); - $pgbf_plugin_dir .= '/checkout-fees-for-woocommerce.php'; + require_once 'component/plugin-tracking/class-tyche-plugin-tracking.php'; + new Tyche_Plugin_Tracking( + array( + 'plugin_name' => $pgbf_plugin_name, + 'plugin_locale' => $pgbf_locale, + 'plugin_short_name' => $pgbf_plugin_prefix, + 'version' => $pgbf_get_previous_version, + 'blog_link' => $pgbf_blog_post_link, + ) + ); + } + } - $ts_plugin_name = ''; - $plugin_data = get_file_data( $pgbf_plugin_dir, array( 'name' => 'Plugin Name' ) ); - if ( ! empty( $plugin_data['name'] ) ) { - $ts_plugin_name = $plugin_data[ 'name' ]; - } - return $ts_plugin_name; - } - /** - * It will retrun the Plugin text Domain - * @return string $ts_plugin_domain Name of the Plugin domain - */ - public static function ts_get_plugin_locale () { - $pgbf_plugin_dir = dirname ( dirname ( __FILE__ ) ); - $pgbf_plugin_dir .= '/checkout-fees-for-woocommerce.php'; + /** + * It will return the plugin name. + */ + public static function ts_get_plugin_name() { + $pgbf_plugin_dir = dirname( dirname( __FILE__ ) ); // phpcs:ignore + $pgbf_plugin_dir .= '/checkout-fees-for-woocommerce.php'; + + $ts_plugin_name = ''; + $plugin_data = get_file_data( $pgbf_plugin_dir, array( 'name' => 'Plugin Name' ) ); + if ( ! empty( $plugin_data['name'] ) ) { + $ts_plugin_name = $plugin_data['name']; + } + return $ts_plugin_name; + } + + /** + * It will return the Plugin text Domain + */ + public static function ts_get_plugin_locale() { + $pgbf_plugin_dir = dirname( dirname( __FILE__ ) ); // phpcs:ignore + $pgbf_plugin_dir .= '/checkout-fees-for-woocommerce.php'; - $ts_plugin_domain = ''; - $plugin_data = get_file_data( $pgbf_plugin_dir, array( 'domain' => 'Text Domain' ) ); - if ( ! empty( $plugin_data['domain'] ) ) { - $ts_plugin_domain = $plugin_data[ 'domain' ]; - } - return $ts_plugin_domain; - } + $ts_plugin_domain = ''; + $plugin_data = get_file_data( $pgbf_plugin_dir, array( 'domain' => 'Text Domain' ) ); + if ( ! empty( $plugin_data['domain'] ) ) { + $ts_plugin_domain = $plugin_data['domain']; + } + return $ts_plugin_domain; + } } - $Alg_WC_All_Component = new Alg_WC_All_Component(); + $Alg_WC_All_Component = new Alg_WC_All_Component(); // phpcs:ignore } diff --git a/includes/class-alg-wc-checkout-fees-admin.php b/includes/class-alg-wc-checkout-fees-admin.php index f4fcb1a..6d3440a 100644 --- a/includes/class-alg-wc-checkout-fees-admin.php +++ b/includes/class-alg-wc-checkout-fees-admin.php @@ -43,7 +43,7 @@ public function __construct() { * @version 2.5.0 */ public function alg_checkout_fees_inline_css() { - if ( isset( $_GET['tab'] ) && 'alg_checkout_fees' === $_GET['tab'] && isset( $_GET['section'] ) && 'bykea_cash' === $_GET['section'] ) { + if ( isset( $_GET['tab'] ) && 'alg_checkout_fees' === $_GET['tab'] && isset( $_GET['section'] ) && 'bykea_cash' === $_GET['section'] ) { // phpcs:ignore wp_register_style( 'alg-wc-checkout-bykea-cash', false, @@ -94,27 +94,24 @@ public function admin_notice_delete_all_plugin_data_error() { public function maybe_delete_all_plugin_data() { if ( isset( $_GET['alg_woocommerce_checkout_fees_delete_all_data'] ) ) { // Checking nonce & user role. - if ( ! isset( $_GET['alg_woocommerce_checkout_fees_delete_all_data_nonce'] ) || - ! wp_verify_nonce( $_GET['alg_woocommerce_checkout_fees_delete_all_data_nonce'], 'alg_woocommerce_checkout_fees_delete_all_data' ) || - ! current_user_can( 'manage_woocommerce' ) - ) { + if ( ! isset( $_GET['alg_woocommerce_checkout_fees_delete_all_data_nonce'] ) || ! wp_verify_nonce( $_GET['alg_woocommerce_checkout_fees_delete_all_data_nonce'], 'alg_woocommerce_checkout_fees_delete_all_data' ) || ! current_user_can( 'manage_woocommerce' ) ) { // phpcs:ignore add_action( 'admin_notices', array( $this, 'admin_notice_delete_all_plugin_data_error' ) ); return; } global $wpdb; $delete_counter_meta = 0; - $plugin_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key LIKE %s", '_alg_checkout_fees_%' ) ); // WPCS: db call ok, WPCS: cache ok. + $plugin_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key LIKE %s", '_alg_checkout_fees_%' ) ); // phpcs:ignore foreach ( $plugin_meta as $meta ) { delete_post_meta( $meta->post_id, $meta->meta_key ); - $delete_counter_meta++; + ++$delete_counter_meta; } $delete_counter_options = 0; - $plugin_options = $wpdb->get_results( $wpdb->prepare( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s", 'alg_woocommerce_checkout_fees_%', 'alg_gateways_fees_%' ) ); // WPCS: db call ok, WPCS: cache ok. + $plugin_options = $wpdb->get_results( $wpdb->prepare( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s", 'alg_woocommerce_checkout_fees_%', 'alg_gateways_fees_%' ) ); // phpcs:ignore foreach ( $plugin_options as $option ) { if ( 'alg_woocommerce_checkout_fees_version' !== $option->option_name ) { delete_option( $option->option_name ); delete_site_option( $option->option_name ); - $delete_counter_options++; + ++$delete_counter_options; } } // The end. @@ -130,7 +127,6 @@ public function maybe_delete_all_plugin_data() { add_action( 'admin_notices', array( $this, 'admin_notice_delete_all_plugin_data_success' ) ); } } - } endif; diff --git a/includes/class-alg-wc-checkout-fees-args.php b/includes/class-alg-wc-checkout-fees-args.php index b92e363..1d6a82f 100644 --- a/includes/class-alg-wc-checkout-fees-args.php +++ b/includes/class-alg-wc-checkout-fees-args.php @@ -30,7 +30,7 @@ class Alg_WC_Checkout_Fees_Args { * @since 2.3.0 */ public function __construct() { - return true; + return true; // phpcs:ignore } /** @@ -84,7 +84,7 @@ public function get_the_args_global( $current_gateway ) { public function get_the_args_local( $current_gateway, $product_id, $variation_id, $product_qty ) { $do_add_product_name = ( 'yes' === get_option( 'alg_woocommerce_checkout_fees_per_product_add_product_name', 'no' ) ); if ( $do_add_product_name ) { - if ( isset( $variation_id ) && 0 != $variation_id ) { + if ( isset( $variation_id ) && 0 != $variation_id ) { // phpcs:ignore $_product = wc_get_product( $variation_id ); if ( $_product ) { $product_formatted_name = ' – ' . $_product->get_title() . ' – ' . @@ -127,13 +127,12 @@ public function get_the_args_local( $current_gateway, $product_id, $variation_id $args['exclude_shipping'] = get_post_meta( $product_id, '_alg_checkout_fees_exclude_shipping_' . $current_gateway, true ); $args['add_taxes'] = get_post_meta( $product_id, '_alg_checkout_fees_add_taxes_' . $current_gateway, true ); $args['product_id'] = ( 'by_product' === get_post_meta( $product_id, '_alg_checkout_fees_percent_usage_' . $current_gateway, true ) ) ? - ( isset( $variation_id ) && 0 != $variation_id ? $variation_id : $product_id ) : + ( isset( $variation_id ) && 0 != $variation_id ? $variation_id : $product_id ) : // phpcs:ignore 0; $args['product_qty'] = $product_qty; $args['fixed_usage'] = get_post_meta( $product_id, '_alg_checkout_fees_fixed_usage_' . $current_gateway, true ); return $args; } - } endif; diff --git a/includes/class-alg-wc-checkout-fees-info.php b/includes/class-alg-wc-checkout-fees-info.php index 9dd09ed..fa0d2b2 100644 --- a/includes/class-alg-wc-checkout-fees-info.php +++ b/includes/class-alg-wc-checkout-fees-info.php @@ -182,7 +182,7 @@ public function get_checkout_fees_info( $lowest_price_only ) { if ( 'incl' === $tax_display_mode ) { $the_price = $the_price_incl_tax; - if ( 0 != $global_fee ) { + if ( 0 != $global_fee ) { // phpcs:ignore if ( 'yes' === get_option( 'alg_gateways_fees_is_taxable_' . $current_gateway, 'no' ) ) { $tax_class_names = array_merge( array( '' ), WC_Tax::get_tax_classes() ); $tax_class_name = get_option( 'alg_gateways_fees_tax_class_id_' . $current_gateway, 0 ); @@ -196,7 +196,7 @@ public function get_checkout_fees_info( $lowest_price_only ) { } $the_price += $global_fee; } - if ( 0 != $local_fee ) { + if ( 0 != $local_fee ) { // phpcs:ignore if ( 'yes' === get_post_meta( $product_id, '_alg_checkout_fees_tax_enabled_' . $current_gateway, true ) ) { $tax_class_names = array_merge( array( '' ), WC_Tax::get_tax_classes() ); $tax_class_name = get_post_meta( $product_id, '_alg_checkout_fees_tax_class_' . $current_gateway, true ); @@ -211,29 +211,29 @@ public function get_checkout_fees_info( $lowest_price_only ) { $the_price += $local_fee; } $price_diff = ( $the_price - $the_price_incl_tax ); - $price_diff_percent = ( 0 != $the_price_incl_tax ? round( ( $price_diff / $the_price_incl_tax ) * 100, 0 ) : 0 ); + $price_diff_percent = ( 0 != $the_price_incl_tax ? round( ( $price_diff / $the_price_incl_tax ) * 100, 0 ) : 0 ); // phpcs:ignore } else { $the_price = $the_price_excl_tax; $the_price += $global_fee; $the_price += $local_fee; $price_diff = ( $the_price - $the_price_excl_tax ); - $price_diff_percent = ( 0 != $the_price_excl_tax ? round( ( $price_diff / $the_price_excl_tax ) * 100, 0 ) : 0 ); + $price_diff_percent = ( 0 != $the_price_excl_tax ? round( ( $price_diff / $the_price_excl_tax ) * 100, 0 ) : 0 ); // phpcs:ignore } if ( false === $lowest_price_only ) { // Saving for output. $single_product_gateways_data[ $available_gateway_key ] = array( - 'gateway_title' => $available_gateway->title, - 'gateway_description' => $available_gateway->get_description(), - 'gateway_icon' => $available_gateway->get_icon(), - 'product_gateway_price' => $the_price, - 'product_original_price' => $the_display_price, - 'product_price_diff' => $price_diff, + 'gateway_title' => $available_gateway->title, + 'gateway_description' => $available_gateway->get_description(), + 'gateway_icon' => $available_gateway->get_icon(), + 'product_gateway_price' => $the_price, + 'product_original_price' => $the_display_price, + 'product_price_diff' => $price_diff, 'product_price_diff_percent' => $price_diff_percent, - 'product_title' => $the_product->get_title(), - 'product_variation_atts' => $the_variation_atts, + 'product_title' => $the_product->get_title(), + 'product_variation_atts' => $the_variation_atts, ); - } else { // if ( true === $lowest_price_only ) { + } else { // phpcs:ignore // Saving lowest price data. if ( $the_price < $lowest_price ) { $lowest_price = $the_price; @@ -281,7 +281,7 @@ public function get_checkout_fees_info( $lowest_price_only ) { '%gateway_title%%product_original_price%%product_gateway_price%%product_price_diff%' ); foreach ( $row as $key => $value ) { - if ( in_array( $key, $price_keys ) ) { + if ( in_array( $key, $price_keys ) ) { // phpcs:ignore $payment_fees = (int) get_option( 'alg_gateways_fees_value_' . $payment_id, 0 ); if ( '0' === $the_product->get_price() && 0 >= $payment_fees ) { $value = 0; @@ -307,7 +307,7 @@ public function get_checkout_fees_info( $lowest_price_only ) { if ( 'gateway_id' === $key ) { $gateway_key = $value; } - if ( in_array( $key, $price_keys ) ) { + if ( in_array( $key, $price_keys ) ) { // phpcs:ignore $payment_fees = (int) get_option( 'alg_gateways_fees_value_' . $gateway_key, 0 ); if ( '0' === $the_product->get_price() && 0 >= $payment_fees ) { $value = 0; @@ -338,7 +338,7 @@ public function get_checkout_fees_info( $lowest_price_only ) { foreach ( $values as $key => $values_array ) { $values_array = array_unique( $values_array ); $payment_fees = (int) get_option( 'alg_gateways_fees_value_' . $gateway_key, 0 ); - if ( in_array( $key, $price_keys ) ) { + if ( in_array( $key, $price_keys ) ) { // phpcs:ignore if ( count( $values_array ) > 1 ) { $value = wc_price( min( $values_array ) ) . '–' . wc_price( max( $values_array ) ); if ( '0' === $the_product->get_price() && 0 >= $payment_fees ) { @@ -378,7 +378,7 @@ public function get_checkout_fees_info( $lowest_price_only ) { foreach ( $modified_array as $key => $values_array ) { $values_array = array_unique( $values_array ); $payment_fees = (int) get_option( 'alg_gateways_fees_value_' . $gateway_key, 0 ); - if ( in_array( $key, $price_keys ) ) { + if ( in_array( $key, $price_keys ) ) { // phpcs:ignore if ( count( $values_array ) > 1 ) { $value = wc_price( min( $values_array ) ) . '–' . wc_price( max( $values_array ) ); if ( '0' === $the_product->get_price() && 0 >= $payment_fees ) { @@ -401,7 +401,6 @@ public function get_checkout_fees_info( $lowest_price_only ) { } return $final_html; } - } endif; diff --git a/includes/class-alg-wc-checkout-fees.php b/includes/class-alg-wc-checkout-fees.php index ce0e277..abeb395 100644 --- a/includes/class-alg-wc-checkout-fees.php +++ b/includes/class-alg-wc-checkout-fees.php @@ -384,9 +384,9 @@ public function get_current_gateway() { * @param object $the_cart Cart Object. * @version 2.5.0 */ - public function add_gateways_fees( $the_cart ) { + public function add_gateways_fees( $the_cart ) { // phpcs:ignore - if ( ! function_exists( 'WC' ) || ! method_exists( WC(), 'payment_gateways' ) || null == WC()->payment_gateways() ) { + if ( ! function_exists( 'WC' ) || ! method_exists( WC(), 'payment_gateways' ) || null == WC()->payment_gateways() ) { // phpcs:ignore return; } @@ -512,7 +512,7 @@ public function add_gateways_fees( $the_cart ) { * @since 2.0.0 */ public function calculate_the_fee( $args, $final_fee_to_add, $total_in_cart, $fee_num ) { - if ( 'fee_2' == $fee_num ) { + if ( 'fee_2' == $fee_num ) { // phpcs:ignore $fee_type = $args['fee_type_2']; $fee_value = $args['fee_value_2']; $min_fee = $args['min_fee_2']; @@ -532,7 +532,7 @@ public function calculate_the_fee( $args, $final_fee_to_add, $total_in_cart, $fe $new_fee = $fixed_fee; break; case 'percent': - if ( 0 != $args['product_id'] ) { + if ( 0 != $args['product_id'] ) { // phpcs:ignore $_product = wc_get_product( $args['product_id'] ); $sum_for_fee = $_product->get_price() * $args['product_qty']; } else { @@ -550,11 +550,11 @@ public function calculate_the_fee( $args, $final_fee_to_add, $total_in_cart, $fe } // Max fee. - if ($max_fee > 0) { - if ( 0 != $max_fee && $new_fee > $max_fee ) { + if ( $max_fee > 0 ) { + if ( 0 != $max_fee && $new_fee > $max_fee ) { // phpcs:ignore $new_fee = $max_fee; } - } elseif ($max_fee < 0) { + } elseif ( $max_fee < 0 ) { if ( 0 != $max_fee && $new_fee < $max_fee ) { //phpcs:ignore $new_fee = $max_fee; } @@ -755,7 +755,7 @@ public function is_override_global_fees_enabled_for_product( $fee_num, $current_ */ public function do_apply_fees_by_categories( $fee_num, $current_gateway, $info_product_id ) { // Global fees override. - if ( 0 != $info_product_id ) { + if ( 0 != $info_product_id ) { // phpcs:ignore if ( $this->is_override_global_fees_enabled_for_product( $fee_num, $current_gateway, $info_product_id ) ) { return false; } @@ -839,7 +839,7 @@ public function do_apply_fees_by_categories( $fee_num, $current_gateway, $info_p ); } if ( '' !== $include_cats || '' !== $exclude_cats ) { - if ( 0 != $info_product_id ) { + if ( 0 != $info_product_id ) { // phpcs:ignore $product_cats = $this->get_product_cats( $info_product_id ); if ( ! empty( $include_cats ) ) { $the_intersect = array_intersect( $product_cats, $include_cats ); @@ -921,7 +921,7 @@ public function is_wc_version_below_3_2() { public function get_the_fee( $args, $fee_num, $total_in_cart = 0, $is_info_only = false, $info_product_id = 0 ) { $final_fee_to_add = 0; if ( '' !== $args['current_gateway'] && 'yes' === $args['is_enabled'] ) { - if ( 0 == $total_in_cart ) { + if ( 0 == $total_in_cart ) { // phpcs:ignore $total_in_cart = ( 'yes' === $args['exclude_shipping'] ) ? WC()->cart->cart_contents_total : WC()->cart->cart_contents_total + WC()->cart->shipping_total; if ( 'yes' === $args['add_taxes'] ) { $tax_total = ( $this->is_wc_version_below_3_2() ? WC_Tax::get_tax_total( WC()->cart->taxes ) : array_sum( WC()->cart->get_cart_contents_taxes() ) ); @@ -940,8 +940,8 @@ public function get_the_fee( $args, $fee_num, $total_in_cart = 0, $is_info_only $args['min_cart_amount'] = 0; $args['max_cart_amount'] = 0; } - if ( $total_in_cart >= $args['min_cart_amount'] && ( 0 == $args['max_cart_amount'] || $total_in_cart <= $args['max_cart_amount'] ) ) { - if ( 0 != $args['fee_value'] && 'fee_2' !== $fee_num ) { + if ( $total_in_cart >= $args['min_cart_amount'] && ( 0 == $args['max_cart_amount'] || $total_in_cart <= $args['max_cart_amount'] ) ) { // phpcs:ignore + if ( 0 != $args['fee_value'] && 'fee_2' !== $fee_num ) { // phpcs:ignore if ( 'local' === $args['fee_scope'] || $this->do_apply_fees_by_categories( 'fee_1', $args['current_gateway'], $info_product_id ) ) { if ( ! $is_info_only && 'global' === $args['fee_scope'] ) { $total_in_cart = $this->get_sum_for_fee_by_included_and_excluded_cats( $total_in_cart, 'fee_1', $args['current_gateway'] ); @@ -951,7 +951,7 @@ public function get_the_fee( $args, $fee_num, $total_in_cart = 0, $is_info_only } } } - if ( 0 != $args['fee_value_2'] && 'fee_1' != $fee_num ) { + if ( 0 != $args['fee_value_2'] && 'fee_1' != $fee_num ) { // phpcs:ignore if ( 'local' === $args['fee_scope'] || $this->do_apply_fees_by_categories( 'fee_2', $args['current_gateway'], $info_product_id ) ) { if ( ! $is_info_only && 'global' === $args['fee_scope'] ) { $total_in_cart = $this->get_sum_for_fee_by_included_and_excluded_cats( $total_in_cart, 'fee_2', $args['current_gateway'] ); @@ -1019,7 +1019,7 @@ public function maybe_add_cart_fee( $args ) { $final_fee_to_add = $this->get_the_fee( $args, 'fee_1' ); $final_fee_to_add_2 = $this->get_the_fee( $args, 'fee_2' ); } - if ( 0 != $final_fee_to_add || 0 != $final_fee_to_add_2 ) { + if ( 0 != $final_fee_to_add || 0 != $final_fee_to_add_2 ) { // phpcs:ignore $taxable = ( 'yes' === $args['is_taxable'] ); $tax_class_name = ''; if ( $taxable ) { @@ -1029,7 +1029,7 @@ public function maybe_add_cart_fee( $args ) { $fees = WC()->cart->get_fees(); if ( 0 !== $final_fee_to_add ) { if ( $this->do_merge_fees ) { - $this->fees[] = array( + $this->fees[] = array( 'title' => $args['fee_text'], 'value' => $final_fee_to_add, 'taxable' => $taxable, @@ -1044,9 +1044,9 @@ public function maybe_add_cart_fee( $args ) { $this->last_fee_added = $args['fee_text']; } } - if ( 0 != $final_fee_to_add_2 ) { + if ( 0 != $final_fee_to_add_2 ) { // phpcs:ignore if ( $this->do_merge_fees ) { - $this->fees[] = array( + $this->fees[] = array( 'title' => $args['fee_text_2'], 'value' => $final_fee_to_add_2, 'taxable' => $taxable, @@ -1100,12 +1100,11 @@ public function modify_fee_html_for_taxes( $cart_fee_html, $fees ) { * @return $recurring * @since 2.5.8 */ - public function renewals_set_fees_recurring( $recurring, $fees, $cart ) { + public function renewals_set_fees_recurring( $recurring, $fees, $cart ) { // phpcs:ignore // If it's fees which have been added from our plugin, return true else return as is. $recurring = ( 0 != $fees->total && ( in_array( $fees->name, $this->fees_added ) || in_array( $fees->name, $this->fees_added_2 ) ) ) ? true : $recurring; //phpcs:ignore return $recurring; - } /** diff --git a/includes/class-alg-wc-order-fees.php b/includes/class-alg-wc-order-fees.php index d7498c0..0e964e4 100644 --- a/includes/class-alg-wc-order-fees.php +++ b/includes/class-alg-wc-order-fees.php @@ -156,7 +156,6 @@ public function update_checkout_fees_ajax() { 'fragments' => $woocommerce_order_pay, ) ); - } /** @@ -286,7 +285,6 @@ public function add_gateways_fees( $order, $current_gateway ) { wc_add_order_item_meta( $item_id, '_last_added_fee', $item->get_name() ); } } - } /** @@ -735,6 +733,7 @@ public function do_apply_fees_by_categories( $order, $fee_num, $current_gateway, * @param float $final_fee_to_add Final fee to add on checkout. * @param float $total_in_cart Total fees added to cart. * @param string $fee_num Fee number. + * @param object $order Order object. * @since 2.6 */ public function calculate_the_fee( $args, $final_fee_to_add, $total_in_cart, $fee_num, $order ) { @@ -762,7 +761,7 @@ public function calculate_the_fee( $args, $final_fee_to_add, $total_in_cart, $fe if ( 0 != $args['product_id'] ) { //phpcs:ignore $_product = wc_get_product( $args['product_id'] ); $sum_for_fee = $_product->get_price() * $args['product_qty']; - } else { + } else { //phpcs:ignore if ( (float) 0 === $total_in_cart ) { $cf_on_fees = apply_filters( 'alg_wc_not_to_calculate_on_fees', true ); if ( $cf_on_fees ) { @@ -851,8 +850,8 @@ public function woocommerce_order_pay( $order ) { * @param object $fees Fees Object. * @param array $calculate_tax_for Calculate tax array. */ - public function alg_wc_order_item_fee_after_calculate_taxes( $fees, $calculate_tax_for ) { - if ( $fees->get_tax_status() != 'taxable' ) { + public function alg_wc_order_item_fee_after_calculate_taxes( $fees, $calculate_tax_for ) { //phpcs:ignore + if ( $fees->get_tax_status() != 'taxable' ) { //phpcs:ignore if ( $fees->get_total() < 0 ) { $fees->set_tax_class( '' ); $fees->set_tax_status( 'none' ); diff --git a/includes/class-cf-tracking-functions.php b/includes/class-cf-tracking-functions.php index a6a4e78..edfcb78 100644 --- a/includes/class-cf-tracking-functions.php +++ b/includes/class-cf-tracking-functions.php @@ -25,7 +25,6 @@ class Cf_Tracking_Functions { * @since 2.6.3 */ public function __construct() { - } /** @@ -95,7 +94,6 @@ public static function cf_get_global_settings() { ); return $global_settings; - } /** diff --git a/includes/settings/class-alg-wc-checkout-fees-settings-gateways.php b/includes/settings/class-alg-wc-checkout-fees-settings-gateways.php index 46d7fb6..0d64a92 100644 --- a/includes/settings/class-alg-wc-checkout-fees-settings-gateways.php +++ b/includes/settings/class-alg-wc-checkout-fees-settings-gateways.php @@ -133,7 +133,7 @@ public function get_settings() { // Cats. $product_cats = array(); - $product_categories = get_terms( 'product_cat', 'orderby=name&hide_empty=0' ); + $product_categories = get_terms( 'product_cat', 'orderby=name&hide_empty=0' ); //phpcs:ignore if ( ! empty( $product_categories ) && ! is_wp_error( $product_categories ) ) { foreach ( $product_categories as $product_category ) { $product_cats[ $product_category->term_id ] = $product_category->name; @@ -637,7 +637,6 @@ public function get_settings() { return $settings; } - } endif; diff --git a/includes/settings/class-alg-wc-checkout-fees-settings-general.php b/includes/settings/class-alg-wc-checkout-fees-settings-general.php index 2e5907a..33a0838 100644 --- a/includes/settings/class-alg-wc-checkout-fees-settings-general.php +++ b/includes/settings/class-alg-wc-checkout-fees-settings-general.php @@ -186,7 +186,6 @@ public function get_settings() { ); return $settings; } - } endif; diff --git a/includes/settings/class-alg-wc-checkout-fees-settings-global-extra-fee.php b/includes/settings/class-alg-wc-checkout-fees-settings-global-extra-fee.php index 4b15a89..739e700 100644 --- a/includes/settings/class-alg-wc-checkout-fees-settings-global-extra-fee.php +++ b/includes/settings/class-alg-wc-checkout-fees-settings-global-extra-fee.php @@ -130,7 +130,6 @@ public function get_settings() { ); return $settings; } - } endif; diff --git a/includes/settings/class-alg-wc-checkout-fees-settings-info.php b/includes/settings/class-alg-wc-checkout-fees-settings-info.php index 23e5ebd..c0916f5 100644 --- a/includes/settings/class-alg-wc-checkout-fees-settings-info.php +++ b/includes/settings/class-alg-wc-checkout-fees-settings-info.php @@ -32,7 +32,7 @@ class Alg_WC_Checkout_Fees_Settings_Info extends Alg_WC_Checkout_Fees_Settings_S * @since 2.1.1 */ public $desc = ''; - + /** * Constructor. * @@ -65,7 +65,7 @@ public function get_settings() { 'type' => 'title', 'desc' => sprintf( - __( 'Values that will be replaced in templates below are: %s.', 'checkout-fees-for-woocommerce' ), + __( 'Values that will be replaced in templates below are: %s.', 'checkout-fees-for-woocommerce' ), //phpcs:ignore '' . implode( ', ', array( @@ -82,7 +82,7 @@ public function get_settings() { ) . '' ) . '

' . sprintf( - __( 'You can also use %1$s and %2$s shortcodes. Or %3$s and %4$s functions.', 'checkout-fees-for-woocommerce' ), + __( 'You can also use %1$s and %2$s shortcodes. Or %3$s and %4$s functions.', 'checkout-fees-for-woocommerce' ), //phpcs:ignore '[alg_show_checkout_fees_full_info]', '[alg_show_checkout_fees_lowest_price_info]', 'do_shortcode( \'[alg_show_checkout_fees_full_info]\' );', @@ -189,7 +189,6 @@ public function get_settings() { ); return $settings; } - } endif; diff --git a/includes/settings/class-alg-wc-checkout-fees-settings-per-product.php b/includes/settings/class-alg-wc-checkout-fees-settings-per-product.php index c67411e..525dd7a 100644 --- a/includes/settings/class-alg-wc-checkout-fees-settings-per-product.php +++ b/includes/settings/class-alg-wc-checkout-fees-settings-per-product.php @@ -33,7 +33,7 @@ class Alg_WC_Checkout_Fees_Settings_Per_Product { * @since 2.1.1 */ public $desc = ''; - + /** * Constructor. * @@ -49,7 +49,6 @@ public function __construct() { add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 ); add_action( 'admin_init', array( $this, 'enqueue_styles_and_scripts' ) ); } - } /** @@ -315,7 +314,7 @@ public function get_meta_box_options() { * @param WC_Product $post Product object. * @version 2.5.0 */ - public function save_meta_box( $post_id, $post ) { + public function save_meta_box( $post_id, $post ) { //phpcs:ignore // Check if we are saving with current metabox displayed. if ( ! isset( $_POST[ 'alg_checkout_fees_' . $this->id . '_save_post' ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification return; @@ -367,9 +366,9 @@ public function create_meta_box() { $html .= '
  • '; $i = 0; foreach ( $available_gateways as $gateway_key => $gateway ) { - $i++; + ++$i; $gateway_title = ( '' === $gateway->title ? $gateway_key : $gateway->title ); - $label_class = ( 1 == $i ? 'alg-clicked' : '' ); + $label_class = ( 1 == $i ? 'alg-clicked' : '' ); //phpcs:ignore $html .= ''; } $html .= '
  • '; @@ -377,12 +376,12 @@ public function create_meta_box() { // Tab Content. $i = 0; foreach ( $available_gateways as $gateway_key => $gateway ) { - $i++; + ++$i; $html .= '
  • '; $gateway_title = ( '' === $gateway->title ) ? $gateway_key : $gateway->title; $html .= ''; $html .= '
    '; - $html .= ( 1 != $i && ! apply_filters( 'alg_wc_checkout_fees_option', false, 'per_product' ) ) ? + $html .= ( 1 != $i && ! apply_filters( 'alg_wc_checkout_fees_option', false, 'per_product' ) ) ? //phpcs:ignore '
    ' . __( 'In free version only Direct Bank Transfer (BACS) fees are available on per product basis.', 'checkout-fees-for-woocommerce' ) . ' ' . $upgrade_url @@ -398,7 +397,7 @@ public function create_meta_box() { if ( ! isset( $option['custom_atts'] ) ) { $option['custom_atts'] = ''; } - $option['custom_atts'] .= ( 'bacs' != $gateway_key && ! apply_filters( 'alg_wc_checkout_fees_option', false, 'per_product' ) ? ' disabled="disabled"' : '' ); + $option['custom_atts'] .= ( 'bacs' != $gateway_key && ! apply_filters( 'alg_wc_checkout_fees_option', false, 'per_product' ) ? ' disabled="disabled"' : '' ); //phpcs:ignore $option_name = $option['name'] . '_' . $gateway_key; $option_value = get_post_meta( $current_post_id, '_' . $option_name, true ); $option_title = ( '' === $option['title'] ) ? '' . $gateway_title . '' : $option['title']; @@ -436,9 +435,7 @@ public function create_meta_box() { $html .= '
    '; echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - } - } endif; diff --git a/includes/settings/class-alg-wc-checkout-fees-settings-section.php b/includes/settings/class-alg-wc-checkout-fees-settings-section.php index f1f166b..fca7210 100644 --- a/includes/settings/class-alg-wc-checkout-fees-settings-section.php +++ b/includes/settings/class-alg-wc-checkout-fees-settings-section.php @@ -50,7 +50,6 @@ public function settings_section( $sections ) { * @since 2.5.0 */ abstract public function get_settings(); - } endif; diff --git a/uninstall.php b/uninstall.php index 2f64692..e8d7730 100644 --- a/uninstall.php +++ b/uninstall.php @@ -42,10 +42,10 @@ // Product Settings. - $wpdb->query( 'DELETE FROM `{$cf_multisite_prefix}postmeta` WHERE meta_key LIKE "_alg_checkout_fees_%"' ); + $wpdb->query( 'DELETE FROM `{$cf_multisite_prefix}postmeta` WHERE meta_key LIKE "_alg_checkout_fees_%"' ); // phpcs:ignore // General Settings. - $wpdb->query( 'DELETE FROM `{$cf_multisite_prefix}options` WHERE option_name LIKE "alg_woocommerce_checkout_fees_%" OR option_name LIKE "alg_gateways_fees_%"' ); + $wpdb->query( 'DELETE FROM `{$cf_multisite_prefix}options` WHERE option_name LIKE "alg_woocommerce_checkout_fees_%" OR option_name LIKE "alg_gateways_fees_%"' ); // phpcs:ignore // Version Number. delete_blog_option( $cf_blog_id, 'alg_woocommerce_checkout_fees_version' ); @@ -54,10 +54,10 @@ } else { // Product Settings. - $wpdb->query( 'DELETE FROM `' . $wpdb->prefix . 'postmeta` WHERE meta_key LIKE "_alg_checkout_fees_%"' ); + $wpdb->query( 'DELETE FROM `' . $wpdb->prefix . 'postmeta` WHERE meta_key LIKE "_alg_checkout_fees_%"' ); // phpcs:ignore // General Settings. - $wpdb->query( 'DELETE FROM `' . $wpdb->prefix . 'options` WHERE option_name LIKE "alg_woocommerce_checkout_fees_%" OR option_name LIKE "alg_gateways_fees_%"' ); + $wpdb->query( 'DELETE FROM `' . $wpdb->prefix . 'options` WHERE option_name LIKE "alg_woocommerce_checkout_fees_%" OR option_name LIKE "alg_gateways_fees_%"' ); // phpcs:ignore // Version Number. delete_option( 'alg_woocommerce_checkout_fees_version' ); @@ -65,5 +65,3 @@ } // Clear any cached data that has been removed. wp_cache_flush(); - -