@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | defined( 'ABSPATH' ) || die( 'This plugin must be run within the scope of WordPress.' ); |
3 | 3 | |
4 | -if ( ! class_exists( 'EDU_KlarnaCheckout' ) ) { |
|
4 | +if ( !class_exists( 'EDU_KlarnaCheckout' ) ) { |
|
5 | 5 | class EDU_KlarnaCheckout extends EDU_Integration { |
6 | 6 | public function __construct() { |
7 | 7 | $this->id = 'eduadmin-klarnacheckout'; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | - if ( ! empty( $_POST['act'] ) && 'bookCourse' === $_POST['act'] ) { |
|
54 | + if ( !empty( $_POST['act'] ) && 'bookCourse' === $_POST['act'] ) { |
|
55 | 55 | $ebi->NoRedirect = true; |
56 | 56 | } |
57 | 57 | } |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | defined( 'ABSPATH' ) || die( 'This plugin must be run within the scope of WordPress.' ); |
3 | 3 | |
4 | -if ( ! class_exists( 'EDU_KlarnaCheckout' ) ) { |
|
5 | - class EDU_KlarnaCheckout extends EDU_Integration { |
|
6 | - public function __construct() { |
|
4 | +if ( ! class_exists( 'EDU_KlarnaCheckout' ) ) { |
|
5 | + class EDU_KlarnaCheckout extends EDU_Integration { |
|
6 | + public function __construct() { |
|
7 | 7 | $this->id = 'eduadmin-klarnacheckout'; |
8 | 8 | $this->displayName = __( 'Klarna Checkout', 'eduadmin-wp-klarna-checkout' ); |
9 | 9 | $this->description = ''; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @param int $booking_id |
23 | 23 | */ |
24 | - public function test_page( $attributes ) { |
|
24 | + public function test_page( $attributes ) { |
|
25 | 25 | $attributes = shortcode_atts( |
26 | 26 | array( |
27 | 27 | 'bookingid' => 0, |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @param EduAdmin_BookingInfo|null $ebi |
48 | 48 | */ |
49 | - public function intercept_booking( $ebi = null ) { |
|
50 | - if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
49 | + public function intercept_booking( $ebi = null ) { |
|
50 | + if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | - if ( ! empty( $_POST['act'] ) && 'bookCourse' === $_POST['act'] ) { |
|
54 | + if ( ! empty( $_POST['act'] ) && 'bookCourse' === $_POST['act'] ) { |
|
55 | 55 | $ebi->NoRedirect = true; |
56 | 56 | } |
57 | 57 | } |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * @param EduAdmin_BookingInfo|null $ebi |
61 | 61 | */ |
62 | - public function process_booking( $ebi = null ) { |
|
63 | - if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
62 | + public function process_booking( $ebi = null ) { |
|
63 | + if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | include_once 'checkout-page.php'; |
71 | 71 | } |
72 | 72 | |
73 | - public function process_klarnaresponse() { |
|
74 | - if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
73 | + public function process_klarnaresponse() { |
|
74 | + if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | - public function init_form_fields() { |
|
79 | + public function init_form_fields() { |
|
80 | 80 | $this->setting_fields = array( |
81 | 81 | 'enabled' => array( |
82 | 82 | 'title' => __( 'Enabled', 'edauadmin-wp-klarna-checkout' ), |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return Klarna_Checkout_Order |
112 | 112 | */ |
113 | - public function create_checkout( $ebi = null ) { |
|
113 | + public function create_checkout( $ebi = null ) { |
|
114 | 114 | $create = array(); |
115 | 115 | $create['locale'] = strtolower( str_replace( '_', '-', get_locale() ) ); |
116 | 116 | $create['cart'] = array(); |
117 | 117 | $create['cart']['items'] = array(); |
118 | 118 | |
119 | - try { |
|
119 | + try { |
|
120 | 120 | $connector = Klarna_Checkout_Connector::create( |
121 | 121 | '', |
122 | 122 | Klarna_Checkout_Connector::BASE_TEST_URL |
@@ -126,7 +126,8 @@ discard block |
||
126 | 126 | $order->create( $create ); |
127 | 127 | |
128 | 128 | return $order; |
129 | - } catch ( Klarna_Checkout_ApiErrorException $ex ) { |
|
129 | + } |
|
130 | + catch ( Klarna_Checkout_ApiErrorException $ex ) { |
|
130 | 131 | EDU()->write_debug( $ex->getMessage() ); |
131 | 132 | EDU()->write_debug( $ex->getPayload() ); |
132 | 133 | EDU()->write_debug( $create ); |
@@ -1,2 +1,2 @@ |
||
1 | 1 | <?php |
2 | -EDU()->write_debug($checkout); |
|
2 | +EDU()->write_debug( $checkout ); |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
30 | 30 | */ |
31 | 31 | |
32 | -add_action( 'admin_init', function () { |
|
33 | - if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) { |
|
34 | - add_action( 'admin_notices', function () { |
|
32 | +add_action( 'admin_init', function() { |
|
33 | + if ( is_admin() && current_user_can( 'activate_plugins' ) && ( !is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && !is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) { |
|
34 | + add_action( 'admin_notices', function() { |
|
35 | 35 | ?> |
36 | 36 | <div class="error"> |
37 | 37 | <p><?php esc_html_e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-wp-klarna-checkout' ); ?></p> |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | } |
46 | 46 | } ); |
47 | 47 | |
48 | -if ( ! class_exists( 'EDU_KlarnaCheckout_Loader' ) ) { |
|
48 | +if ( !class_exists( 'EDU_KlarnaCheckout_Loader' ) ) { |
|
49 | 49 | final class EDU_KlarnaCheckout_Loader { |
50 | 50 | public function __construct() { |
51 | 51 | add_action( 'plugins_loaded', array( $this, 'init' ) ); |
52 | 52 | } |
53 | 53 | |
54 | 54 | public function init() { |
55 | - if ( ! class_exists( 'Klarna_Checkout_Connector' ) ) { |
|
55 | + if ( !class_exists( 'Klarna_Checkout_Connector' ) ) { |
|
56 | 56 | require_once __DIR__ . '/klarna_kco_php_4.0.0/src/Klarna/Checkout.php'; |
57 | 57 | } |
58 | 58 |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
30 | 30 | */ |
31 | 31 | |
32 | -add_action( 'admin_init', function () { |
|
33 | - if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) { |
|
34 | - add_action( 'admin_notices', function () { |
|
32 | +add_action( 'admin_init', function () { |
|
33 | + if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) { |
|
34 | + add_action( 'admin_notices', function () { |
|
35 | 35 | ?> |
36 | 36 | <div class="error"> |
37 | 37 | <p><?php esc_html_e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-wp-klarna-checkout' ); ?></p> |
@@ -39,24 +39,24 @@ discard block |
||
39 | 39 | <?php |
40 | 40 | } ); |
41 | 41 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
42 | - if ( isset( $_GET['activate'] ) ) { |
|
42 | + if ( isset( $_GET['activate'] ) ) { |
|
43 | 43 | unset( $_GET['activate'] ); |
44 | 44 | } |
45 | 45 | } |
46 | 46 | } ); |
47 | 47 | |
48 | -if ( ! class_exists( 'EDU_KlarnaCheckout_Loader' ) ) { |
|
49 | - final class EDU_KlarnaCheckout_Loader { |
|
50 | - public function __construct() { |
|
48 | +if ( ! class_exists( 'EDU_KlarnaCheckout_Loader' ) ) { |
|
49 | + final class EDU_KlarnaCheckout_Loader { |
|
50 | + public function __construct() { |
|
51 | 51 | add_action( 'plugins_loaded', array( $this, 'init' ) ); |
52 | 52 | } |
53 | 53 | |
54 | - public function init() { |
|
55 | - if ( ! class_exists( 'Klarna_Checkout_Connector' ) ) { |
|
54 | + public function init() { |
|
55 | + if ( ! class_exists( 'Klarna_Checkout_Connector' ) ) { |
|
56 | 56 | require_once __DIR__ . '/klarna_kco_php_4.0.0/src/Klarna/Checkout.php'; |
57 | 57 | } |
58 | 58 | |
59 | - if ( class_exists( 'EDU_Integration' ) ) { |
|
59 | + if ( class_exists( 'EDU_Integration' ) ) { |
|
60 | 60 | |
61 | 61 | require_once __DIR__ . '/class-edu-klarnacheckout.php'; |
62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - public function add_integration( $integrations ) { |
|
67 | + public function add_integration( $integrations ) { |
|
68 | 68 | $integrations[] = 'EDU_KlarnaCheckout'; |
69 | 69 | |
70 | 70 | return $integrations; |