PluginProbe
MakeCommerce for WooCommerce / 3.0.9
MakeCommerce for WooCommerce v3.0.9
4.1.0 4.0.8 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.0 2.2.1 2.2.2 All 96 releases
← All changes | makecommerce.php +156 -393 2.2.13.0.9 View file →
@@ -1,435 +1,198 @@
1 1 <?php
2 -/*
3 - Plugin Name: MakeCommerce for WooCommerce
4 - Description: Adds MakeCommerce payment gateway and Itella/Omniva parcel machine shipping methods to Woocommerce checkout
5 - Version: 2.2.1
6 - Author: Maksekeskus AS
7 - Author URI: https://MakeCommerce.net/
8 - Text Domain: wc_makecommerce_domain
9 -*/
10 2
11 -if (!defined('ABSPATH')) {
12 - exit; // Exit if accessed directly.
3 +/**
4 + * @link https://makecommerce.net/
5 + * @since 3.0.0
6 + * @package Makecommerce
7 + *
8 + * @wordpress-plugin
9 + * Plugin Name: MakeCommerce
10 + * Plugin URI: https://makecommerce.net/
11 + * Description: Adds MakeCommerce/Simplecheckout payment gateway and Itella/Omniva/DPD parcel machine shipping methods to WooCommerce checkout
12 + * Version: 3.0.9
13 + * Author: Maksekeskus AS
14 + * Author URI: https://makecommerce.net/
15 + * License: GPL-2.0+
16 + * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
17 + * Text Domain: makecommerce
18 + * Domain Path: /languages
19 + * Requires at least: 5.6.1
20 + * Requires PHP: 7.4
21 + * WC requires at least: 5.0.0
22 + * WC tested up to: 5.4.1
23 + */
24 +
25 +// If this file is called directly, abort.
26 +if ( ! defined( 'WPINC' ) ) {
27 + die;
13 28 }
14 29
15 -include_once(ABSPATH.'wp-admin/includes/plugin.php');
16 -if (is_plugin_active('woocommerce/woocommerce.php')) {
30 +/**
31 + * Currently plugin version.
32 + * Start at version 3.0.0 and use SemVer - https://semver.org
33 + */
34 +define( 'MAKECOMMERCE_VERSION', '3.0.9' );
17 35
18 - define('WC_MC_VERSION', 2.0);
36 +//table name for banklinks
37 +define( 'MAKECOMMERCE_TABLENAME', 'mc_banklinks' );
38 +define( 'MAKECOMMERCE_SCO_TABLENAME', 'woocommerce_makecommerce_sc' );
19 39
20 - $enable_experimental = get_option('mk_checkout_sco', 'no');
21 - if ($enable_experimental === 'yes') {
22 - require_once(__DIR__.'/makecommerce-simplecheckout.php');
23 - }
24 - require_once(__DIR__.'/makecommerce-transport.php');
25 - require_once(__DIR__.'/makecommerce-payment.php');
40 +//WC makecommerce version
41 +define( 'WC_MC_VERSION', 2.0 );
26 42
27 - if (is_admin() && !extension_loaded('curl')) {
28 - add_action('admin_notices', function(){
29 - $class = 'notice notice-error';
30 - $message = __( 'You have enabled MakeCommerce module but it seems that you don\'t have CURL enabled. This way MakeCommerce unfortunately does not work!', 'wc_makecommerce_domain');
31 - printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
32 - });
33 - }
43 +/**
44 + * Check if we are ok to continue (if namesoace and class doesn't already exist)
45 + */
46 +if ( class_exists( 'MakeCommerce' ) || namespaceExists( 'MakeCommerce' ) ) {
34 47
48 + add_action( 'admin_notices', 'namespace_or_class_already_in_use' );
35 49
36 - global $mkDbTable;
37 - $mkDbTable = 'mc_banklinks';
50 + deactivate_makecommerce();
38 51
39 - function mc_install() {
40 - global $wpdb;
41 - global $mkDbTable;
42 -
43 - $tableName = $wpdb->prefix . $mkDbTable;
44 -
45 - $charset = $wpdb->get_charset_collate();
46 -
47 - $sql = "CREATE TABLE $tableName (
48 - id mediumint(9) NOT NULL AUTO_INCREMENT,
49 - type varchar(10) NOT NULL,
50 - country char(2) NOT NULL,
51 - name varchar(25) NOT NULL,
52 - url varchar(250) NOT NULL,
53 - UNIQUE KEY id (id)
54 - ) $charset;";
55 -
56 - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
57 - dbDelta( $sql );
58 - }
52 + return false;
53 +}
59 54
60 - register_activation_hook( __FILE__, 'mc_install' );
55 +/**
56 + * Check if a namespace already exists
57 + *
58 + * @since 3.0.0
59 + */
60 +function namespaceExists( $namespace ) {
61 61
62 - // On uninstall remove scheduled hook
63 - function mc_uninstall() {
64 - if (wp_next_scheduled ( 'mc_banklinks_update_cron' )) {
65 - wp_clear_scheduled_hook('mc_banklinks_update_cron');
66 - }
67 - }
68 -
69 - register_deactivation_hook(__FILE__, 'mc_uninstall');
70 -
71 - // WP schedule callable action
72 - add_action('mc_banklinks_update_cron', 'update_mc_banklinks');
73 - // Assign schedule if not set, update compatible no need to reactivate, format('U') php 5.2 compatible
74 - // Assigns task at 23.59.59 by local time, task runs if time has passed and somebody navigates the site
75 - if (! wp_next_scheduled ( 'mc_banklinks_update_cron' )) {
76 - $date = new DateTime();
77 - $date->setTime(04,10,00);
78 - $timestamp = intval($date->format('U'));
79 - //$local = 3600 * intval(get_option('gmt_offset'));
80 - //wp_schedule_event($timestamp - $local, 'twicedaily', 'mc_banklinks_update_cron');
81 - wp_schedule_event($timestamp, 'twicedaily', 'mc_banklinks_update_cron');
82 - }
83 -
84 - if (!class_exists('wc_makecommerce_domain')) {
85 - require_once('includes/vendor/autoload.php');
86 - require_once('includes/Maksekeskus.php');
87 - }
88 -
89 - function mk_check_payment() {
90 -
91 - global $woocommerce;
92 - $api = mk_get_api();
93 -
94 - $returnUrl = home_url();
62 + $namespace .= "\\";
63 +
64 + foreach ( get_declared_classes() as $name ) {
95 65
96 - $request = stripslashes_deep($_POST);
97 - if ($api->verifyMac($request)) {
98 - $data = $api->extractRequestData($request);
99 - $reference = false;
100 -
101 - if (!empty($data['error']) ) {
102 - wc_add_notice(__('Payment failed', 'wc_makecommerce_domain'), 'error');
103 - return $returnUrl;
104 - }
105 -
106 - if (!empty($data['message_type']) ) {
107 - if ($data['message_type'] == 'payment_return') {
108 - $transactionId = $data['transaction'];
109 - $reference = $data['reference'];
110 - $paymentStatus = $data['status'];
111 - }
112 - if ($data['message_type'] == 'token_return') {
113 - if (!empty($data['transaction']['reference'])) {
114 - $reference = $data['transaction']['reference'];
115 - }
116 - $paymentStatus = $data['transaction']['status'];
117 - $transactionId = $data['transaction']['id'];
118 -
119 - // for API backward compatibility - if we didn't find reference in the mesage, or the transaction state vas still PENDING
120 - // we'll fetch the transaction data from API, and make a payment request if needed
121 - // this all can be removed after 2017-jan
122 - if (!$reference or $paymentStatus == 'PENDING') {
123 - $transaction = $api->getTransaction($transactionId);
124 - if (!empty($transaction->reference)) {
125 - $reference = $transaction->reference;
126 - }
127 -
128 - $paymentStatus = $transaction->status;
129 -
130 - if ($paymentStatus == 'PENDING') {
131 - $paymentRequest = array(
132 - 'amount' => $transaction->amount,
133 - 'currency' => $transaction->currency,
134 - 'token' => $data['token']['id']
135 - );
136 - $payment = $api->createPayment($transactionId, $paymentRequest);
137 - // TODO: validate
138 - $paymentStatus = $payment->transaction->status;
139 - }
140 -
141 - }
142 -
143 -
144 - }
145 -
146 - }
66 + if ( strpos( $name, $namespace ) === 0 ) {
67 + return true;
147 68 }
69 + }
148 70
149 - // if we didn't find reference to an Order, we send user to shop landing-page. TODO: could be improved
150 - if (!$reference) { return $returnUrl; }
71 + return false;
72 +}
151 73
152 - $order = new WC_Order($reference);
153 - // if we din't find the Order, we send user to shop landing-page. TODO: could be improved
154 - if (!$order->id) { return $returnUrl; }
74 +/**
75 + * Shows error in admin that we cannot continue
76 + *
77 + * @since 3.0.0
78 + */
79 +function namespace_or_class_already_in_use() {
80 +
81 + ?>
82 + <div class="error notice">
83 + <p><?php _e( 'Cannot initiate MakeCommerce, a class and/or namespace called "MakeCommerce" is already in use somewhere else...', 'wc_makecommerce_domain' ); ?></p>
84 + </div>
85 + <?php
86 +}
155 87
156 - $returnUrl = $order->get_checkout_order_received_url();
88 +/**
89 + * Check if WooCommerce exists and is active. Can't do much without it
90 + */
91 +if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
157 92
158 - switch($paymentStatus) {
93 + if ( is_multisite() ) {
159 94
160 - case 'CANCELLED':
161 - $order->update_status( 'cancelled' );
162 - wc_add_notice(__('Payment transaction cancelled', 'wc_makecommerce_domain'), 'error');
163 - $returnUrl = $woocommerce->cart->get_cart_url();
164 - break;
95 + include_once( ABSPATH . "wp-admin/includes/plugin.php" );
96 + if ( !is_plugin_active_for_network( "woocommerce/woocommerce.php" ) ) {
97 + woocommerce_not_found_or_active();
165 98
166 - case 'COMPLETED':
167 - $orderNote = array();
168 - $orderNote[] = __('Transaction ID', 'wc_makecommerce_domain') . ': <a target=_blank href="'.$api->getEnvUrls()->merchantUrl.'/merchant/shop/deals/detail.html?id='. $transactionId .'">'.$transactionId.'</a>';
169 - $orderNote[] = __('Payment option', 'wc_makecommerce_domain') . ': ' . get_post_meta($order->id, '_makecommerce_preselected_method', true);
170 - $order->add_order_note(implode("\r\n", $orderNote));
171 -
172 - $order->payment_complete( $transactionId );
173 - $order->update_status( 'processing' );
174 - $woocommerce->cart->empty_cart();
175 - break;
176 -
99 + return false;
177 100 }
101 + } else {
102 + woocommerce_not_found_or_active();
178 103
179 - return $returnUrl;
104 + return false;
180 105 }
106 +}
181 107
108 +/**
109 + * If no WooCommerce is found
110 + *
111 + * @since 3.0.3
112 + */
113 +function woocommerce_not_found_or_active() {
182 114
115 + add_action( 'admin_notices', 'no_woocommerce_found' );
183 116
117 + deactivate_makecommerce();
118 +}
184 119
185 - $MKAPI = false;
186 - function mk_get_api() {
187 - global $MKAPI;
188 - if ($MKAPI) {
189 - //return $MKAPI;
190 - }
191 - $mk_api_type = get_option('mk_api_type', false);
192 - if (!$mk_api_type) {
193 - return false;
194 - }
195 - if ($mk_api_type !== 'live') {
196 - $key_prefix = $mk_api_type.'_';
197 - } else {
198 - $key_prefix = '';
199 - }
200 - $mk_shop_id = get_option('mk_'.$key_prefix.'shop_id', '');
201 - $mk_public_key = get_option('mk_'.$key_prefix.'public_key', '');
202 - $mk_private_key = get_option('mk_'.$key_prefix.'private_key', '');
203 - if (!$mk_shop_id || !$mk_public_key || !$mk_shop_id) {
204 - return false;
205 - }
206 - $MKAPI = new \Maksekeskus\Maksekeskus($mk_shop_id, $mk_public_key, $mk_private_key, $mk_api_type === 'live' ? false : true);
207 - return $MKAPI;
208 - }
120 +/**
121 + * Shows error in admin that we cannot continue
122 + *
123 + * @since 3.0.0
124 + */
125 +function no_woocommerce_found() {
126 +
127 + ?>
128 + <div class="error notice">
129 + <p><?php _e( 'Cannot initiate MakeCommerce, there seems to be no WooCommerce present or active...', 'wc_makecommerce_domain' ); ?></p>
130 + </div>
131 + <?php
132 +}
209 133
210 - function mk_is_api_set() {
211 - $mk_api_type = get_option('mk_api_type', false);
212 - if (!$mk_api_type) {
213 - return false;
214 - }
215 - if ($mk_api_type !== 'live') {
216 - $key_prefix = $mk_api_type.'_';
217 - } else {
218 - $key_prefix = '';
219 - }
220 - $mk_shop_id = get_option('mk_'.$key_prefix.'shop_id', '');
221 - $mk_public_key = get_option('mk_'.$key_prefix.'public_key', '');
222 - $mk_private_key = get_option('mk_'.$key_prefix.'private_key', '');
223 - if (!$mk_shop_id || !$mk_public_key || !$mk_shop_id) {
224 - return false;
225 - }
226 - return true;
134 +/**
135 + * Disable automatic updates for MakeCommerce plugin
136 + *
137 + * @since 3.0.1
138 + */
139 +function disable_makecommerce_automatic_updates( $should_update, $plugin ) {
140 +
141 + if ( ! isset( $plugin->plugin, $plugin->new_version ) ) {
142 + return $should_update;
227 143 }
228 144
229 -
230 - function mk_admin_error() {
231 - printf( '<div class="%1$s"><p>%2$s</p></div>', 'notice notice-error', __('Please check that you have configured correctly MakeCommerce API accesses', 'wc_makecommerce_domain'));
145 + if ( 'makecommerce/makecommerce.php' !== $plugin->plugin ) {
146 + return $should_update;
232 147 }
233 148
149 + return false;
150 +}
234 151
152 +add_filter( 'auto_update_plugin', 'disable_makecommerce_automatic_updates', 99, 2 );
235 153
236 - add_filter('query_vars', 'mk_cron_query_vars');
237 - add_action('parse_request', 'mk_parse_cron_update_vars');
154 +/**
155 + * The code that runs during plugin activation.
156 + * This action is documented in includes/class-makecommerce-activator.php
157 + *
158 + * @since 3.0.1
159 + */
160 +function activate_makecommerce() {
238 161
239 - function mk_cron_query_vars($vars) {
240 - $vars[] = 'mk-action';
241 - $vars[] = 'mk-shop-id';
242 - $vars[] = 'mk-test-shop-id';
243 - return $vars;
244 - }
162 + require_once plugin_dir_path( __FILE__ ) . 'includes/activator.php';
163 + MakeCommerce\Activator::activate();
164 +}
245 165
246 - function mk_parse_cron_update_vars($wp) {
247 - if (array_key_exists('mk-action', $wp->query_vars) && $wp->query_vars['mk-action'] == 'mk-update'
248 - && (array_key_exists('mk-shop-id', $wp->query_vars) || array_key_exists('mk-test-shop-id', $wp->query_vars) ) ) {
249 - if( (strlen($wp->query_vars['mk-shop-id']) && $wp->query_vars['mk-shop-id'] == get_option('mk_shop_id', false) )
250 - || (strlen($wp->query_vars['mk-test-shop-id']) && $wp->query_vars['mk-test-shop-id'] == get_option('mk_test_shop_id', false) ) ) {
251 - update_mc_banklinks();
252 - exit();
253 - }
254 - }
255 - }
166 +/**
167 + * The code that runs during plugin deactivation.
168 + * This action is documented in includes/class-makecommerce-deactivator.php
169 + *
170 + * @since 3.0.1
171 + */
172 +function deactivate_makecommerce() {
256 173
257 - function mk_admin_login_update($user_login, $user) {
258 - if(user_can( $user, 'administrator' )) {
259 - update_mc_banklinks();
260 - }
261 - }
262 - add_action('wp_login', 'mk_admin_login_update', 10, 2);
174 + require_once plugin_dir_path( __FILE__ ) . 'includes/deactivator.php';
175 + MakeCommerce\Deactivator::deactivate();
176 +}
263 177
178 +register_activation_hook( __FILE__, 'activate_makecommerce' );
179 +register_deactivation_hook( __FILE__, 'deactivate_makecommerce' );
264 180
181 +/**
182 + * The core plugin class that is used to define internationalization,
183 + * payment-specific hooks, and shipping-specific site hooks.
184 + */
185 +require plugin_dir_path( __FILE__ ) . 'includes/makecommerce.php';
265 186
266 - function mk_admin_add_api_settings($sections) {
267 - $sections['mk_api'] = __('MakeCommerce API access', 'wc_makecommerce_domain');
268 - return $sections;
269 - }
187 +/**
188 + * Begins execution of the plugin.
189 + *
190 + * @since 3.0.0
191 + */
192 +function run_makecommerce() {
270 193
271 - function mk_admin_api_settings($settings) {
272 - global $current_section;
273 - if ($current_section !== 'mk_api') {
274 - return $settings;
275 - }
276 - return array(
277 - array('type' => 'title', 'desc' => __get_logo_html()),
278 - array(
279 - 'type' => 'title',
280 - 'title' => __('MakeCommerce API access credentials', 'wc_makecommerce_domain'),
281 - 'desc' => __('To use MakeCommerce/Maksekeskus services you need to enter API credentials below here <br/> <br/>', 'wc_makecommerce_domain').
282 - sprintf( __('To further configure the Payment methods please go to <a href=."%s">MakeCommerce Checkout Options</a>, links to settings of our Shipment methods are listed below', 'wc_makecommerce_domain'), 'admin.php?page=wc-settings&tab=checkout&section=makecommerce'),
283 - 'id' => 'mk_api_settings'
284 - ),
285 - array(
286 - 'type' => 'select',
287 - 'title' => __('Current environment', 'wc_makecommerce_domain'),
288 - 'desc' => __('See more about <a href="https://maksekeskus.ee/en/for-developers/test-environment/">MakeCommerce Test environment</a>', 'wc_makecommerce_domain'),
289 - 'default' => 'live',
290 - 'options' => array(
291 - 'live' => __('Live', 'wc_makecommerce_domain'),
292 - 'test' => __('Test', 'wc_makecommerce_domain'),
293 - ),
294 - 'id' => 'mk_api_type'
295 - ),
296 - array(
297 - 'id' => 'mk_shop_id',
298 - 'type' => 'text',
299 - 'title' => __('Shop ID (live)', 'wc_makecommerce_domain'),
300 - 'desc' => __('Get it from <a href="https://merchant.maksekeskus.ee/api.html" target="_blank">Merchant Portal</a>','wc_makecommerce_domain'),
301 - 'class' => 'input-text regular-input',
302 - ),
303 - array(
304 - 'id' => 'mk_private_key',
305 - 'type' => 'text',
306 - 'title' => __('Secret key (live)', 'wc_makecommerce_domain'),
307 - 'class' => 'input-text regular-input',
308 - ),
309 - array(
310 - 'id' => 'mk_public_key',
311 - 'type' => 'text',
312 - 'title' => __('Publishable key (live)', 'wc_makecommerce_domain'),
313 - 'class' => 'input-text regular-input',
314 - ),
315 - array(
316 - 'id' => 'mk_test_shop_id',
317 - 'type' => 'text',
318 - 'title' => __('Shop ID (test)', 'wc_makecommerce_domain'),
319 - 'class' => 'input-text regular-input',
320 - 'default' => 'f64b4f20-5ef9-4b7b-a6fa-d623d87f0b9c',
321 - 'desc' => __('Get it from <a href="https://merchant-test.maksekeskus.ee/api.html" target="_blank">Merchant Portal Test</a>','wc_makecommerce_domain'),
322 - ),
323 - array(
324 - 'id' => 'mk_test_private_key',
325 - 'type' => 'text',
326 - 'title' => __('Secret key (test)', 'wc_makecommerce_domain'),
327 - 'default' => 'MPjcVMoRZPAucsTuGK5ZukOlV7BlzgSvXOowJUkk9IFSQPVooRwcVOxzz3mhEpgM',
328 - 'class' => 'input-text regular-input',
329 - ),
330 - array(
331 - 'id' => 'mk_test_public_key',
332 - 'type' => 'text',
333 - 'title' => __('Publishable key (test)', 'wc_makecommerce_domain'),
334 - 'default' => '7Hog41ci2mKkmtviMycWxpNx14pNP70m',
335 - 'class' => 'input-text regular-input',
336 - ),
337 - array('type' => 'sectionend', 'id' => 'mk_api_settings'),
338 - array(
339 - 'type' => 'title',
340 - 'desc' => '<br><hr><br>',
341 - ),
342 - array(
343 - 'id' => 'mk_module_title',
344 - 'type' => 'title',
345 - 'title' => __('Makecommerce modules', 'wc_makecommerce_domain'),
346 - 'desc' => __('Our plugin adds several modules to your shop. Here you can switch off modules that are not important for you, they will disappear from Woocommerce settings menus.<br> Each active module have their own settings dialog, where they must also be Enabled before use.', 'wc_makecommerce_domain'),
347 - 'class' => '',
348 - ),
349 - array(
350 - 'id' => 'mk_transport_apt_omniva',
351 - 'type' => 'checkbox',
352 - 'default' => 'yes',
353 - 'title' => __('Omniva Parcel Machine', 'wc_makecommerce_domain'),
354 - 'desc' => __('enable Omniva parcel machines shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=parcelmachine_omniva')).')',
355 - 'class' => '',
356 - ),
357 - array(
358 - 'id' => 'mk_transport_apt_smartpost',
359 - 'type' => 'checkbox',
360 - 'default' => 'yes',
361 - 'title' => __('SmartPOST Parcel Machine', 'wc_makecommerce_domain'),
362 - 'desc' => __('enable SmartPOST parcel machines shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=parcelmachine_smartpost')).')',
363 - 'class' => '',
364 - ),
365 - // array(
366 - // 'id' => 'mk_transport_apt_dpd',
367 - // 'type' => 'checkbox',
368 - // 'default' => 'no',
369 - // 'title' => __('DPD Pickup Network', 'wc_makecommerce_domain'),
370 - // 'desc' => __('enable DPD Pickup network shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=parcelmachine_dpd')).')',
371 - // 'class' => '',
372 - // ),
373 - array(
374 - 'id' => 'mk_transport_courier_omniva',
375 - 'type' => 'checkbox',
376 - 'default' => 'yes',
377 - 'title' => __('Omniva Courier', 'wc_makecommerce_domain'),
378 - 'desc' => __('enable Omniva courier shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=courier_omniva')).')',
379 - 'class' => '',
380 - ),
381 - array(
382 - 'id' => 'mk_transport_courier_smartpost',
383 - 'type' => 'checkbox',
384 - 'default' => 'yes',
385 - 'title' => __('SmartPOST Courier', 'wc_makecommerce_domain'),
386 - 'desc' => __('enable SmartPOST courier shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=courier_smartpost')).')',
387 - 'class' => '',
388 - ),
389 - array(
390 - 'id' => 'mk_checkout_sco',
391 - 'type' => 'checkbox',
392 - 'title' => __('SimpleCheckout', 'wc_makecommerce_domain'),
393 - 'desc' => __('enable SimpleCheckout&trade; Checkout method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=checkout&section=makecommerce_sc')).')',
394 - 'class' => '',
395 - ),
396 - array(
397 - 'id' => 'mk_javascript_ui',
398 - 'type' => 'api_javascript_ui',
399 - ),
400 - array('type' => 'sectionend', 'id' => 'mk_api_settings')
401 - );
402 - }
403 -
404 - function mk_admin_save_api_settings() {
405 - // reload banklinks
406 - global $current_section;
407 - if ($current_section !== 'mk_api') {
408 - return;
409 - }
410 - update_mc_banklinks();
411 - }
194 + $makeCommerce = new MakeCommerce();
195 + $makeCommerce->run();
196 +}
412 197
413 - function mk_admin_plugin_settings_link($links) {
414 - $settings_link = '<a href="admin.php?page=wc-settings&tab=api&section=mk_api">API '.__('Settings').'</a>';
415 - array_unshift($links, $settings_link);
416 - return $links;
417 - }
418 - add_filter('woocommerce_get_settings_api', 'mk_admin_api_settings', 10, 2);
419 - add_action('woocommerce_get_sections_api', 'mk_admin_add_api_settings');
420 - add_action('woocommerce_settings_saved', 'mk_admin_save_api_settings', 30, 0);
421 - add_filter("plugin_action_links_".plugin_basename(__FILE__), 'mk_admin_plugin_settings_link' );
422 -
423 - function __get_logo_html() {
424 - return '<div class="makecommerce-info">'.
425 - '<div class="makecommerce-logo">'.
426 - '<a target="_blank" href="http://maksekeskus.ee"><img src="'. plugins_url('/images/makecommerce_logo_en.svg', __FILE__) .'" class="makecommerce-logo"></a>'.
427 - '</div>'.
428 - '<div class="makecommerce-links">'.
429 - '<div class="makecommerce-link"><a target="_blank" href="https://merchant.maksekeskus.ee">Merchant Portal</a></div>'.
430 - '<div class="makecommerce-link"><a target="_blank" href="https://makecommerce.net/">makecommerce.net</a></div>'.
431 - '<div class="makecommerce-link"><a target="_blank" href="http://maksekeskus.ee">maksekeskus.ee</a></div>'.
432 - '</div>'.
433 - '</div>';
434 - }
435 -}
198 +run_makecommerce();