@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if ( ! defined('ABSPATH')) { |
|
| 4 | 4 | exit; // Exit if accessed directly |
| 5 | 5 | } |
| 6 | 6 | |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | * @param string $deprecated Deprecated since WooCommerce 3.0 |
| 36 | 36 | * @return string |
| 37 | 37 | */ |
| 38 | - public function get_display_name( $deprecated = '' ) { |
|
| 38 | + public function get_display_name($deprecated = '') { |
|
| 39 | 39 | $display = sprintf( |
| 40 | 40 | /* translators: last 4 digits of IBAN account */ |
| 41 | - __( 'SEPA IBAN ending in %s', 'woocommerce-gateway-stripe' ), |
|
| 41 | + __('SEPA IBAN ending in %s', 'woocommerce-gateway-stripe'), |
|
| 42 | 42 | $this->get_last4() |
| 43 | 43 | ); |
| 44 | 44 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | * @return boolean True if the passed data is valid |
| 67 | 67 | */ |
| 68 | 68 | public function validate() { |
| 69 | - if ( false === parent::validate() ) { |
|
| 69 | + if (false === parent::validate()) { |
|
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ( ! $this->get_last4( 'edit' ) ) { |
|
| 73 | + if ( ! $this->get_last4('edit')) { |
|
| 74 | 74 | return false; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | * @param string $context |
| 86 | 86 | * @return string Last 4 digits |
| 87 | 87 | */ |
| 88 | - public function get_last4( $context = 'view' ) { |
|
| 89 | - return $this->get_prop( 'last4', $context ); |
|
| 88 | + public function get_last4($context = 'view') { |
|
| 89 | + return $this->get_prop('last4', $context); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @version 4.0.0 |
| 96 | 96 | * @param string $last4 |
| 97 | 97 | */ |
| 98 | - public function set_last4( $last4 ) { |
|
| 99 | - $this->set_prop( 'last4', $last4 ); |
|
| 98 | + public function set_last4($last4) { |
|
| 99 | + $this->set_prop('last4', $last4); |
|
| 100 | 100 | } |
| 101 | 101 | } |
@@ -2,12 +2,12 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class WC_Stripe_Test extends WP_UnitTestCase { |
| 4 | 4 | public function test_constants_defined() { |
| 5 | - $this->assertTrue( defined( 'WC_STRIPE_VERSION' ) ); |
|
| 6 | - $this->assertTrue( defined( 'WC_STRIPE_MIN_PHP_VER' ) ); |
|
| 7 | - $this->assertTrue( defined( 'WC_STRIPE_MIN_WC_VER' ) ); |
|
| 8 | - $this->assertTrue( defined( 'WC_STRIPE_MAIN_FILE' ) ); |
|
| 9 | - $this->assertTrue( defined( 'WC_STRIPE_PLUGIN_URL' ) ); |
|
| 10 | - $this->assertTrue( defined( 'WC_STRIPE_PLUGIN_PATH' ) ); |
|
| 5 | + $this->assertTrue(defined('WC_STRIPE_VERSION')); |
|
| 6 | + $this->assertTrue(defined('WC_STRIPE_MIN_PHP_VER')); |
|
| 7 | + $this->assertTrue(defined('WC_STRIPE_MIN_WC_VER')); |
|
| 8 | + $this->assertTrue(defined('WC_STRIPE_MAIN_FILE')); |
|
| 9 | + $this->assertTrue(defined('WC_STRIPE_PLUGIN_URL')); |
|
| 10 | + $this->assertTrue(defined('WC_STRIPE_PLUGIN_PATH')); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | * This test will see if we're indeed converting the price correctly. |
| 16 | 16 | */ |
| 17 | 17 | public function test_price_conversion_before_send_to_stripe() { |
| 18 | - $this->assertEquals( 10050, WC_Stripe_Helper::get_stripe_amount( 100.50, 'USD' ) ); |
|
| 19 | - $this->assertEquals( 10050, WC_Stripe_Helper::get_stripe_amount( 10050, 'JPY' ) ); |
|
| 20 | - $this->assertEquals( 100, WC_Stripe_Helper::get_stripe_amount( 100.50, 'JPY' ) ); |
|
| 21 | - $this->assertEquals( 10050, WC_Stripe_Helper::get_stripe_amount( 100.50 ) ); |
|
| 22 | - $this->assertInternalType( 'int', WC_Stripe_Helper::get_stripe_amount( 100.50, 'USD' ) ); |
|
| 18 | + $this->assertEquals(10050, WC_Stripe_Helper::get_stripe_amount(100.50, 'USD')); |
|
| 19 | + $this->assertEquals(10050, WC_Stripe_Helper::get_stripe_amount(10050, 'JPY')); |
|
| 20 | + $this->assertEquals(100, WC_Stripe_Helper::get_stripe_amount(100.50, 'JPY')); |
|
| 21 | + $this->assertEquals(10050, WC_Stripe_Helper::get_stripe_amount(100.50)); |
|
| 22 | + $this->assertInternalType('int', WC_Stripe_Helper::get_stripe_amount(100.50, 'USD')); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -33,37 +33,37 @@ discard block |
||
| 33 | 33 | $balance_fee1->net = 10000; |
| 34 | 34 | $balance_fee1->currency = 'USD'; |
| 35 | 35 | |
| 36 | - $this->assertEquals( 105.00, WC_Stripe_Helper::format_balance_fee( $balance_fee1, 'fee' ) ); |
|
| 36 | + $this->assertEquals(105.00, WC_Stripe_Helper::format_balance_fee($balance_fee1, 'fee')); |
|
| 37 | 37 | |
| 38 | 38 | $balance_fee2 = new stdClass(); |
| 39 | 39 | $balance_fee2->fee = 10500; |
| 40 | 40 | $balance_fee2->net = 10000; |
| 41 | 41 | $balance_fee2->currency = 'JPY'; |
| 42 | 42 | |
| 43 | - $this->assertEquals( 10500, WC_Stripe_Helper::format_balance_fee( $balance_fee2, 'fee' ) ); |
|
| 43 | + $this->assertEquals(10500, WC_Stripe_Helper::format_balance_fee($balance_fee2, 'fee')); |
|
| 44 | 44 | |
| 45 | 45 | $balance_fee3 = new stdClass(); |
| 46 | 46 | $balance_fee3->fee = 10500; |
| 47 | 47 | $balance_fee3->net = 10000; |
| 48 | 48 | $balance_fee3->currency = 'USD'; |
| 49 | 49 | |
| 50 | - $this->assertEquals( 100.00, WC_Stripe_Helper::format_balance_fee( $balance_fee3, 'net' ) ); |
|
| 50 | + $this->assertEquals(100.00, WC_Stripe_Helper::format_balance_fee($balance_fee3, 'net')); |
|
| 51 | 51 | |
| 52 | 52 | $balance_fee4 = new stdClass(); |
| 53 | 53 | $balance_fee4->fee = 10500; |
| 54 | 54 | $balance_fee4->net = 10000; |
| 55 | 55 | $balance_fee4->currency = 'JPY'; |
| 56 | 56 | |
| 57 | - $this->assertEquals( 10000, WC_Stripe_Helper::format_balance_fee( $balance_fee4, 'net' ) ); |
|
| 57 | + $this->assertEquals(10000, WC_Stripe_Helper::format_balance_fee($balance_fee4, 'net')); |
|
| 58 | 58 | |
| 59 | 59 | $balance_fee5 = new stdClass(); |
| 60 | 60 | $balance_fee5->fee = 10500; |
| 61 | 61 | $balance_fee5->net = 10000; |
| 62 | 62 | $balance_fee5->currency = 'USD'; |
| 63 | 63 | |
| 64 | - $this->assertEquals( 105.00, WC_Stripe_Helper::format_balance_fee( $balance_fee5 ) ); |
|
| 64 | + $this->assertEquals(105.00, WC_Stripe_Helper::format_balance_fee($balance_fee5)); |
|
| 65 | 65 | |
| 66 | - $this->assertInternalType( 'string', WC_Stripe_Helper::format_balance_fee( $balance_fee5 ) ); |
|
| 66 | + $this->assertInternalType('string', WC_Stripe_Helper::format_balance_fee($balance_fee5)); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -76,27 +76,27 @@ discard block |
||
| 76 | 76 | 'expected' => 'Tests Store', |
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | - $this->assertEquals( $statement_descriptor1['expected'], WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor1['actual'] ) ); |
|
| 79 | + $this->assertEquals($statement_descriptor1['expected'], WC_Stripe_Helper::clean_statement_descriptor($statement_descriptor1['actual'])); |
|
| 80 | 80 | |
| 81 | 81 | $statement_descriptor2 = array( |
| 82 | 82 | 'actual' => 'Test\'s Store > Driving Course Range', |
| 83 | 83 | 'expected' => 'Tests Store Driving C', |
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | - $this->assertEquals( $statement_descriptor2['expected'], WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor2['actual'] ) ); |
|
| 86 | + $this->assertEquals($statement_descriptor2['expected'], WC_Stripe_Helper::clean_statement_descriptor($statement_descriptor2['actual'])); |
|
| 87 | 87 | |
| 88 | 88 | $statement_descriptor3 = array( |
| 89 | 89 | 'actual' => 'Test\'s Store < Driving Course Range', |
| 90 | 90 | 'expected' => 'Tests Store Driving C', |
| 91 | 91 | ); |
| 92 | 92 | |
| 93 | - $this->assertEquals( $statement_descriptor3['expected'], WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor3['actual'] ) ); |
|
| 93 | + $this->assertEquals($statement_descriptor3['expected'], WC_Stripe_Helper::clean_statement_descriptor($statement_descriptor3['actual'])); |
|
| 94 | 94 | |
| 95 | 95 | $statement_descriptor4 = array( |
| 96 | 96 | 'actual' => 'Test\'s Store " Driving Course Range', |
| 97 | 97 | 'expected' => 'Tests Store Driving C', |
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | - $this->assertEquals( $statement_descriptor4['expected'], WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor4['actual'] ) ); |
|
| 100 | + $this->assertEquals($statement_descriptor4['expected'], WC_Stripe_Helper::clean_statement_descriptor($statement_descriptor4['actual'])); |
|
| 101 | 101 | } |
| 102 | 102 | } |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if ( ! defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * DEPRECATED DO NOT USE!! |
| 8 | 8 | */ |
| 9 | -if ( ! class_exists( 'WC_Stripe_Apple_Pay' ) ) { |
|
| 9 | +if ( ! class_exists('WC_Stripe_Apple_Pay')) { |
|
| 10 | 10 | class WC_Stripe_Apple_Pay { |
| 11 | 11 | /** |
| 12 | 12 | * This Instance. |
@@ -20,15 +20,15 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public static function instance() { |
| 23 | - WC_Stripe_Logger::log( 'DEPRECATED! WC_Stripe_Apple_Pay class has been hard deprecated. Please remove any code that references this class or instance. This class will be removed by version 4.2' ); |
|
| 23 | + WC_Stripe_Logger::log('DEPRECATED! WC_Stripe_Apple_Pay class has been hard deprecated. Please remove any code that references this class or instance. This class will be removed by version 4.2'); |
|
| 24 | 24 | return self::$_this; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function __get( $var ) { |
|
| 27 | + public function __get($var) { |
|
| 28 | 28 | return null; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function __call( $name, $arguments ) { |
|
| 31 | + public function __call($name, $arguments) { |
|
| 32 | 32 | return null; |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @since 4.0.2 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if ( ! defined('ABSPATH')) { |
|
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | * @param string $error_message Full response |
| 24 | 24 | * @param string $localized_message user-friendly translated error message |
| 25 | 25 | */ |
| 26 | - public function __construct( $error_message = '', $localized_message = '' ) { |
|
| 26 | + public function __construct($error_message = '', $localized_message = '') { |
|
| 27 | 27 | $this->localized_message = $localized_message; |
| 28 | - parent::__construct( $error_message ); |
|
| 28 | + parent::__construct($error_message); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if ( ! defined('ABSPATH')) { |
|
| 3 | 3 | exit; // Exit if accessed directly |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | // if uninstall not called from WordPress exit |
| 7 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 7 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 8 | 8 | exit; |
| 9 | 9 | } |
| 10 | 10 | |
@@ -13,31 +13,31 @@ discard block |
||
| 13 | 13 | * wp-config.php. This is to prevent data loss when deleting the plugin from the backend |
| 14 | 14 | * and to ensure only the site owner can perform this action. |
| 15 | 15 | */ |
| 16 | -if ( defined( 'WC_REMOVE_ALL_DATA' ) && true === WC_REMOVE_ALL_DATA ) { |
|
| 16 | +if (defined('WC_REMOVE_ALL_DATA') && true === WC_REMOVE_ALL_DATA) { |
|
| 17 | 17 | // Delete options. |
| 18 | - delete_option( 'woocommerce_stripe_settings' ); |
|
| 19 | - delete_option( 'wc_stripe_show_styles_notice' ); |
|
| 20 | - delete_option( 'wc_stripe_show_request_api_notice' ); |
|
| 21 | - delete_option( 'wc_stripe_show_apple_pay_notice' ); |
|
| 22 | - delete_option( 'wc_stripe_show_ssl_notice' ); |
|
| 23 | - delete_option( 'wc_stripe_show_keys_notice' ); |
|
| 24 | - delete_option( 'wc_stripe_show_alipay_notice' ); |
|
| 25 | - delete_option( 'wc_stripe_show_bancontact_notice' ); |
|
| 26 | - delete_option( 'wc_stripe_show_bitcoin_notice' ); |
|
| 27 | - delete_option( 'wc_stripe_show_eps_notice' ); |
|
| 28 | - delete_option( 'wc_stripe_show_giropay_notice' ); |
|
| 29 | - delete_option( 'wc_stripe_show_ideal_notice' ); |
|
| 30 | - delete_option( 'wc_stripe_show_multibanco_notice' ); |
|
| 31 | - delete_option( 'wc_stripe_show_p24_notice' ); |
|
| 32 | - delete_option( 'wc_stripe_show_sepa_notice' ); |
|
| 33 | - delete_option( 'wc_stripe_show_sofort_notice' ); |
|
| 34 | - delete_option( 'wc_stripe_version' ); |
|
| 35 | - delete_option( 'woocommerce_stripe_bancontact_settings' ); |
|
| 36 | - delete_option( 'woocommerce_stripe_alipay_settings' ); |
|
| 37 | - delete_option( 'woocommerce_stripe_bitcoin_settings' ); |
|
| 38 | - delete_option( 'woocommerce_stripe_ideal_settings' ); |
|
| 39 | - delete_option( 'woocommerce_stripe_p24_settings' ); |
|
| 40 | - delete_option( 'woocommerce_stripe_giropay_settings' ); |
|
| 41 | - delete_option( 'woocommerce_stripe_sepa_settings' ); |
|
| 42 | - delete_option( 'woocommerce_stripe_sofort_settings' ); |
|
| 18 | + delete_option('woocommerce_stripe_settings'); |
|
| 19 | + delete_option('wc_stripe_show_styles_notice'); |
|
| 20 | + delete_option('wc_stripe_show_request_api_notice'); |
|
| 21 | + delete_option('wc_stripe_show_apple_pay_notice'); |
|
| 22 | + delete_option('wc_stripe_show_ssl_notice'); |
|
| 23 | + delete_option('wc_stripe_show_keys_notice'); |
|
| 24 | + delete_option('wc_stripe_show_alipay_notice'); |
|
| 25 | + delete_option('wc_stripe_show_bancontact_notice'); |
|
| 26 | + delete_option('wc_stripe_show_bitcoin_notice'); |
|
| 27 | + delete_option('wc_stripe_show_eps_notice'); |
|
| 28 | + delete_option('wc_stripe_show_giropay_notice'); |
|
| 29 | + delete_option('wc_stripe_show_ideal_notice'); |
|
| 30 | + delete_option('wc_stripe_show_multibanco_notice'); |
|
| 31 | + delete_option('wc_stripe_show_p24_notice'); |
|
| 32 | + delete_option('wc_stripe_show_sepa_notice'); |
|
| 33 | + delete_option('wc_stripe_show_sofort_notice'); |
|
| 34 | + delete_option('wc_stripe_version'); |
|
| 35 | + delete_option('woocommerce_stripe_bancontact_settings'); |
|
| 36 | + delete_option('woocommerce_stripe_alipay_settings'); |
|
| 37 | + delete_option('woocommerce_stripe_bitcoin_settings'); |
|
| 38 | + delete_option('woocommerce_stripe_ideal_settings'); |
|
| 39 | + delete_option('woocommerce_stripe_p24_settings'); |
|
| 40 | + delete_option('woocommerce_stripe_giropay_settings'); |
|
| 41 | + delete_option('woocommerce_stripe_sepa_settings'); |
|
| 42 | + delete_option('woocommerce_stripe_sofort_settings'); |
|
| 43 | 43 | } |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if ( ! defined('ABSPATH')) { |
|
| 3 | 3 | exit; // Exit if accessed directly |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | echo $email_heading . "\n\n"; |
| 7 | 7 | |
| 8 | 8 | // translators: %1$s: name of the blog, %2$s: link to checkout payment url, note: no full stop due to url at the end |
| 9 | -printf( esc_html_x( 'The automatic payment to renew your subscription with %1$s has failed. To reactivate the subscription, please login and authorize the renewal from your account page: %2$s', 'In failed renewal authentication email', 'woocommerce-gateway-stripe' ), esc_html( get_bloginfo( 'name' ) ), esc_attr( $authorization_url ) ); |
|
| 9 | +printf(esc_html_x('The automatic payment to renew your subscription with %1$s has failed. To reactivate the subscription, please login and authorize the renewal from your account page: %2$s', 'In failed renewal authentication email', 'woocommerce-gateway-stripe'), esc_html(get_bloginfo('name')), esc_attr($authorization_url)); |
|
| 10 | 10 | |
| 11 | 11 | echo "\n\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; |
| 12 | 12 | |
| 13 | -do_action( 'woocommerce_subscriptions_email_order_details', $order, $sent_to_admin, $plain_text, $email ); |
|
| 13 | +do_action('woocommerce_subscriptions_email_order_details', $order, $sent_to_admin, $plain_text, $email); |
|
| 14 | 14 | |
| 15 | 15 | echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; |
| 16 | 16 | |
| 17 | -echo apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ); |
|
| 17 | +echo apply_filters('woocommerce_email_footer_text', get_option('woocommerce_email_footer_text')); |
|
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if ( ! defined('ABSPATH')) { |
|
| 3 | 3 | exit; // Exit if accessed directly |
| 4 | 4 | } |
| 5 | 5 | ?> |
| 6 | 6 | |
| 7 | -<?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?> |
|
| 7 | +<?php do_action('woocommerce_email_header', $email_heading, $email); ?> |
|
| 8 | 8 | |
| 9 | 9 | <p> |
| 10 | 10 | <?php |
| 11 | 11 | // translators: %1$s: name of the blog, %2$s: link to payment re-authentication URL, note: no full stop due to url at the end |
| 12 | - echo wp_kses( sprintf( _x( 'The automatic payment to renew your subscription with %1$s has failed. To reactivate the subscription, please login and authorize the renewal from your account page: %2$s', 'In failed renewal authentication email', 'woocommerce-gateway-stripe' ), esc_html( get_bloginfo( 'name' ) ), '<a href="' . esc_url( $authorization_url ) . '">' . esc_html__( 'Authorize the payment »', 'woocommerce-gateway-stripe' ) . '</a>' ), array( 'a' => array( 'href' => true ) ) ); ?> |
|
| 12 | + echo wp_kses(sprintf(_x('The automatic payment to renew your subscription with %1$s has failed. To reactivate the subscription, please login and authorize the renewal from your account page: %2$s', 'In failed renewal authentication email', 'woocommerce-gateway-stripe'), esc_html(get_bloginfo('name')), '<a href="' . esc_url($authorization_url) . '">' . esc_html__('Authorize the payment »', 'woocommerce-gateway-stripe') . '</a>'), array('a' => array('href' => true))); ?> |
|
| 13 | 13 | </p> |
| 14 | 14 | |
| 15 | -<?php do_action( 'woocommerce_subscriptions_email_order_details', $order, $sent_to_admin, $plain_text, $email ); ?> |
|
| 15 | +<?php do_action('woocommerce_subscriptions_email_order_details', $order, $sent_to_admin, $plain_text, $email); ?> |
|
| 16 | 16 | |
| 17 | -<?php do_action( 'woocommerce_email_footer', $email ); ?> |
|
| 17 | +<?php do_action('woocommerce_email_footer', $email); ?> |
|
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if ( ! defined('ABSPATH')) { |
|
| 3 | 3 | exit; // Exit if accessed directly. |
| 4 | 4 | } |
| 5 | 5 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | 'email_heading' => $this->get_heading(), |
| 31 | 31 | 'sent_to_admin' => false, |
| 32 | 32 | 'plain_text' => false, |
| 33 | - 'authorization_url' => $this->get_authorization_url( $this->object ), |
|
| 33 | + 'authorization_url' => $this->get_authorization_url($this->object), |
|
| 34 | 34 | 'email' => $this, |
| 35 | 35 | ), |
| 36 | 36 | '', |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'email_heading' => $this->get_heading(), |
| 54 | 54 | 'sent_to_admin' => false, |
| 55 | 55 | 'plain_text' => true, |
| 56 | - 'authorization_url' => $this->get_authorization_url( $this->object ), |
|
| 56 | + 'authorization_url' => $this->get_authorization_url($this->object), |
|
| 57 | 57 | 'email' => $this, |
| 58 | 58 | ), |
| 59 | 59 | '', |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * @param WC_Order $order The order whose payment needs authentication. |
| 69 | 69 | * @return string |
| 70 | 70 | */ |
| 71 | - public function get_authorization_url( $order ) { |
|
| 72 | - return add_query_arg( 'wc-stripe-confirmation', 1, $order->get_checkout_payment_url( false ) ); |
|
| 71 | + public function get_authorization_url($order) { |
|
| 72 | + return add_query_arg('wc-stripe-confirmation', 1, $order->get_checkout_payment_url(false)); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $this->form_fields = array( |
| 83 | 83 | 'enabled' => array( |
| 84 | - 'title' => _x( 'Enable/Disable', 'an email notification', 'woocommerce-gateway-stripe' ), |
|
| 84 | + 'title' => _x('Enable/Disable', 'an email notification', 'woocommerce-gateway-stripe'), |
|
| 85 | 85 | 'type' => 'checkbox', |
| 86 | - 'label' => __( 'Enable this email notification', 'woocommerce-gateway-stripe' ), |
|
| 86 | + 'label' => __('Enable this email notification', 'woocommerce-gateway-stripe'), |
|
| 87 | 87 | 'default' => 'yes', |
| 88 | 88 | ), |
| 89 | 89 | |
@@ -98,29 +98,29 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @param WC_Order $order The renewal order whose payment failed. |
| 100 | 100 | */ |
| 101 | - public function trigger( $order ) { |
|
| 102 | - if ( ! $this->is_enabled() ) { |
|
| 101 | + public function trigger($order) { |
|
| 102 | + if ( ! $this->is_enabled()) { |
|
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $this->object = $order; |
| 107 | 107 | |
| 108 | - if ( method_exists( $order, 'get_billing_email' ) ) { |
|
| 108 | + if (method_exists($order, 'get_billing_email')) { |
|
| 109 | 109 | $this->recipient = $order->get_billing_email(); |
| 110 | 110 | } else { |
| 111 | 111 | $this->recipient = $order->billing_email; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $this->find['order_date'] = '{order_date}'; |
| 115 | - if ( function_exists( 'wc_format_datetime' ) ) { // WC 3.0+ |
|
| 116 | - $this->replace['order_date'] = wc_format_datetime( $order->get_date_created() ); |
|
| 115 | + if (function_exists('wc_format_datetime')) { // WC 3.0+ |
|
| 116 | + $this->replace['order_date'] = wc_format_datetime($order->get_date_created()); |
|
| 117 | 117 | } else { // WC < 3.0 |
| 118 | - $this->replace['order_date'] = $order->date_created->date_i18n( wc_date_format() ); |
|
| 118 | + $this->replace['order_date'] = $order->date_created->date_i18n(wc_date_format()); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $this->find['order_number'] = '{order_number}'; |
| 122 | 122 | $this->replace['order_number'] = $order->get_order_number(); |
| 123 | 123 | |
| 124 | - $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); |
|
| 124 | + $this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments()); |
|
| 125 | 125 | } |
| 126 | 126 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if ( ! defined('ABSPATH')) { |
|
| 3 | 3 | exit; // Exit if accessed directly. |
| 4 | 4 | } |
| 5 | 5 | |
@@ -21,20 +21,20 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param WC_Email[] $email_classes All existing instances of WooCommerce emails. |
| 23 | 23 | */ |
| 24 | - public function __construct( $email_classes = array() ) { |
|
| 24 | + public function __construct($email_classes = array()) { |
|
| 25 | 25 | $this->id = 'failed_preorder_sca_authentication'; |
| 26 | - $this->title = __( 'Pre-order Payment Action Needed', 'woocommerce-gateway-stripe' ); |
|
| 27 | - $this->description = __( 'This is an order notification sent to the customer once a pre-order is complete, but additional payment steps are required.', 'woocommerce-gateway-stripe' ); |
|
| 26 | + $this->title = __('Pre-order Payment Action Needed', 'woocommerce-gateway-stripe'); |
|
| 27 | + $this->description = __('This is an order notification sent to the customer once a pre-order is complete, but additional payment steps are required.', 'woocommerce-gateway-stripe'); |
|
| 28 | 28 | $this->customer_email = true; |
| 29 | 29 | |
| 30 | 30 | $this->template_html = 'emails/failed-preorder-authentication.php'; |
| 31 | 31 | $this->template_plain = 'emails/plain/failed-preorder-authentication.php'; |
| 32 | - $this->template_base = plugin_dir_path( WC_STRIPE_MAIN_FILE ) . 'templates/'; |
|
| 32 | + $this->template_base = plugin_dir_path(WC_STRIPE_MAIN_FILE) . 'templates/'; |
|
| 33 | 33 | |
| 34 | 34 | // Use the "authentication required" hook to add the correct, later hook. |
| 35 | - add_action( 'wc_gateway_stripe_process_payment_authentication_required', array( $this, 'trigger' ) ); |
|
| 35 | + add_action('wc_gateway_stripe_process_payment_authentication_required', array($this, 'trigger')); |
|
| 36 | 36 | |
| 37 | - if ( isset( $email_classes['WC_Pre_Orders_Email_Pre_Order_Available'] ) ) { |
|
| 37 | + if (isset($email_classes['WC_Pre_Orders_Email_Pre_Order_Available'])) { |
|
| 38 | 38 | $this->original_email = $email_classes['WC_Pre_Orders_Email_Pre_Order_Available']; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @param WC_Order $order The order whose payment is failing. |
| 50 | 50 | */ |
| 51 | - public function trigger( $order ) { |
|
| 52 | - if ( class_exists( 'WC_Pre_Orders_Order' ) && WC_Pre_Orders_Order::order_contains_pre_order( $order->get_id() ) ) { |
|
| 53 | - if ( isset( $this->original_email ) ) { |
|
| 54 | - remove_action( 'wc_pre_order_status_completed_notification', array( $this->original_email, 'trigger' ), 10, 2 ); |
|
| 51 | + public function trigger($order) { |
|
| 52 | + if (class_exists('WC_Pre_Orders_Order') && WC_Pre_Orders_Order::order_contains_pre_order($order->get_id())) { |
|
| 53 | + if (isset($this->original_email)) { |
|
| 54 | + remove_action('wc_pre_order_status_completed_notification', array($this->original_email, 'trigger'), 10, 2); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - add_action( 'wc_pre_orders_pre_order_completed', array( $this, 'send_email' ), 10, 2 ); |
|
| 57 | + add_action('wc_pre_orders_pre_order_completed', array($this, 'send_email'), 10, 2); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | * @param WC_Order $order The order that is being paid. |
| 65 | 65 | * @param string $message The message, which should be added to the email. |
| 66 | 66 | */ |
| 67 | - public function send_email( $order, $message ) { |
|
| 67 | + public function send_email($order, $message) { |
|
| 68 | 68 | $this->custom_message = $message; |
| 69 | 69 | |
| 70 | - parent::trigger( $order ); |
|
| 70 | + parent::trigger($order); |
|
| 71 | 71 | |
| 72 | 72 | // Restore the action of the original email for other bulk actions. |
| 73 | - if ( isset( $this->original_email ) ) { |
|
| 74 | - add_action( 'wc_pre_order_status_completed_notification', array( $this->original_email, 'trigger' ), 10, 2 ); |
|
| 73 | + if (isset($this->original_email)) { |
|
| 74 | + add_action('wc_pre_order_status_completed_notification', array($this->original_email, 'trigger'), 10, 2); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @return string |
| 82 | 82 | */ |
| 83 | 83 | public function get_default_subject() { |
| 84 | - return __( 'Payment authorization needed for pre-order {order_number}', 'woocommerce-gateway-stripe' ); |
|
| 84 | + return __('Payment authorization needed for pre-order {order_number}', 'woocommerce-gateway-stripe'); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @return string |
| 91 | 91 | */ |
| 92 | 92 | public function get_default_heading() { |
| 93 | - return __( 'Payment authorization needed for pre-order {order_number}', 'woocommerce-gateway-stripe' ); |
|
| 93 | + return __('Payment authorization needed for pre-order {order_number}', 'woocommerce-gateway-stripe'); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |