@@ -41,29 +41,29 @@ discard block |
||
| 41 | 41 | $this->title = $this->extraConfig['PAGANTIS_TITLE']; |
| 42 | 42 | |
| 43 | 43 | //Useful vars |
| 44 | - $this->template_path = plugin_dir_path(__FILE__) . '../templates/'; |
|
| 44 | + $this->template_path = plugin_dir_path(__FILE__).'../templates/'; |
|
| 45 | 45 | $this->allowed_currencies = array("EUR");
|
| 46 | - $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php'; |
|
| 46 | + $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)).'/WC_Pagantis.php'; |
|
| 47 | 47 | $this->plugin_info = get_file_data($this->mainFileLocation, array('Version' => 'Version'), false);
|
| 48 | 48 | |
| 49 | 49 | //Panel form fields |
| 50 | - $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php');//Panel options |
|
| 50 | + $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php'); //Panel options |
|
| 51 | 51 | $this->init_settings(); |
| 52 | 52 | |
| 53 | 53 | $this->extraConfig = $this->getExtraConfig(); |
| 54 | 54 | |
| 55 | - $this->settings['ok_url'] = ($this->extraConfig['PAGANTIS_URL_OK']!='')?$this->extraConfig['PAGANTIS_URL_OK']:$this->generateOkUrl(); |
|
| 56 | - $this->settings['ko_url'] = ($this->extraConfig['PAGANTIS_URL_KO']!='')?$this->extraConfig['PAGANTIS_URL_KO']:$this->generateKoUrl(); |
|
| 55 | + $this->settings['ok_url'] = ($this->extraConfig['PAGANTIS_URL_OK']!='') ? $this->extraConfig['PAGANTIS_URL_OK'] : $this->generateOkUrl(); |
|
| 56 | + $this->settings['ko_url'] = ($this->extraConfig['PAGANTIS_URL_KO']!='') ? $this->extraConfig['PAGANTIS_URL_KO'] : $this->generateKoUrl(); |
|
| 57 | 57 | foreach ($this->settings as $setting_key => $setting_value) {
|
| 58 | 58 | $this->$setting_key = $setting_value; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | //Hooks |
| 62 | - add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this,'process_admin_options')); //Save plugin options
|
|
| 63 | - add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields
|
|
| 64 | - add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form
|
|
| 65 | - add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification
|
|
| 66 | - add_filter('woocommerce_payment_complete_order_status', array($this,'pagantisCompleteStatus'), 10, 3);
|
|
| 62 | + add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this, 'process_admin_options')); //Save plugin options
|
|
| 63 | + add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields
|
|
| 64 | + add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form
|
|
| 65 | + add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification
|
|
| 66 | + add_filter('woocommerce_payment_complete_order_status', array($this, 'pagantisCompleteStatus'), 10, 3);
|
|
| 67 | 67 | add_filter('load_textdomain_mofile', array($this, 'loadPagantisTranslation'), 10, 2);
|
| 68 | 68 | } |
| 69 | 69 | |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function loadPagantisTranslation($mofile, $domain) |
| 77 | 77 | {
|
| 78 | - if ('pagantis' === $domain) {
|
|
| 79 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
| 78 | + if ('pagantis'===$domain) {
|
|
| 79 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
| 80 | 80 | } |
| 81 | 81 | return $mofile; |
| 82 | 82 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $template_fields = array( |
| 96 | 96 | 'panel_header' => $this->title, |
| 97 | 97 | 'panel_description' => $this->method_description, |
| 98 | - 'button1_label' => __('Login to panel of ', 'pagantis') . ucfirst(WcPagantisGateway::METHOD_ID),
|
|
| 98 | + 'button1_label' => __('Login to panel of ', 'pagantis').ucfirst(WcPagantisGateway::METHOD_ID),
|
|
| 99 | 99 | 'button2_label' => __('Documentation', 'pagantis'),
|
| 100 | 100 | 'logo' => $this->icon, |
| 101 | 101 | 'settings' => $this->generate_settings_html($this->form_fields, false) |
@@ -109,24 +109,24 @@ discard block |
||
| 109 | 109 | public function pagantisCheckFields() |
| 110 | 110 | {
|
| 111 | 111 | $error_string = ''; |
| 112 | - if ($this->settings['enabled'] !== 'yes') {
|
|
| 112 | + if ($this->settings['enabled']!=='yes') {
|
|
| 113 | 113 | return; |
| 114 | 114 | } elseif (!version_compare(phpversion(), '5.3.0', '>=')) {
|
| 115 | - $error_string = __(' is not compatible with your php and/or curl version', 'pagantis');
|
|
| 115 | + $error_string = __(' is not compatible with your php and/or curl version', 'pagantis');
|
|
| 116 | 116 | $this->settings['enabled'] = 'no'; |
| 117 | 117 | } elseif ($this->settings['pagantis_public_key']=="" || $this->settings['pagantis_private_key']=="") {
|
| 118 | 118 | $error_string = __(' is not configured correctly, the fields Public Key and Secret Key are mandatory for use this plugin', 'pagantis');
|
| 119 | 119 | $this->settings['enabled'] = 'no'; |
| 120 | 120 | } elseif (!in_array(get_woocommerce_currency(), $this->allowed_currencies)) {
|
| 121 | - $error_string = __(' only can be used in Euros', 'pagantis');
|
|
| 121 | + $error_string = __(' only can be used in Euros', 'pagantis');
|
|
| 122 | 122 | $this->settings['enabled'] = 'no'; |
| 123 | - } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS']<'2' |
|
| 124 | - || $this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS']>'12') {
|
|
| 123 | + } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'] < '2' |
|
| 124 | + || $this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'] > '12') {
|
|
| 125 | 125 | $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis');
|
| 126 | - } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS']<'2' |
|
| 127 | - || $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS']>'12') {
|
|
| 126 | + } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] < '2' |
|
| 127 | + || $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] > '12') {
|
|
| 128 | 128 | $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis');
|
| 129 | - } elseif ($this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']<0) {
|
|
| 129 | + } elseif ($this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] < 0) {
|
|
| 130 | 130 | $error_string = __(' can not have a minimum amount less than 0', 'pagantis');
|
| 131 | 131 | } |
| 132 | 132 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | $shippingAddress = $order->get_address('shipping');
|
| 162 | 162 | $billingAddress = $order->get_address('billing');
|
| 163 | - if ($shippingAddress['address_1'] == '') {
|
|
| 163 | + if ($shippingAddress['address_1']=='') {
|
|
| 164 | 164 | $shippingAddress = $billingAddress; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | ->setFixPhone($shippingAddress['phone']) |
| 183 | 183 | ->setMobilePhone($shippingAddress['phone']) |
| 184 | 184 | ; |
| 185 | - $orderBillingAddress = new Address(); |
|
| 185 | + $orderBillingAddress = new Address(); |
|
| 186 | 186 | $orderBillingAddress |
| 187 | 187 | ->setZipCode($billingAddress['postcode']) |
| 188 | 188 | ->setFullName($billingAddress['fist_name']." ".$billingAddress['last_name']) |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | wc_get_template('iframe.php', $template_fields, '', $this->template_path);
|
| 302 | 302 | } |
| 303 | 303 | } catch (\Exception $exception) {
|
| 304 | - wc_add_notice(__('Payment error ', 'pagantis') . $exception->getMessage(), 'error');
|
|
| 304 | + wc_add_notice(__('Payment error ', 'pagantis').$exception->getMessage(), 'error');
|
|
| 305 | 305 | $checkout_url = get_permalink(wc_get_page_id('checkout'));
|
| 306 | 306 | wp_redirect($checkout_url); |
| 307 | 307 | exit; |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | public function pagantisNotification() |
| 315 | 315 | {
|
| 316 | 316 | try {
|
| 317 | - $origin = ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'Notify' : 'Order'; |
|
| 317 | + $origin = ($_SERVER['REQUEST_METHOD']=='POST') ? 'Notify' : 'Order'; |
|
| 318 | 318 | |
| 319 | 319 | include_once('notifyController.php');
|
| 320 | 320 | $notify = new WcPagantisNotify(); |
@@ -353,10 +353,10 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | public function pagantisCompleteStatus($status, $order_id, $order) |
| 355 | 355 | {
|
| 356 | - if ($order->get_payment_method() == WcPagantisGateway::METHOD_ID) {
|
|
| 357 | - if ($order->get_status() == 'failed') {
|
|
| 356 | + if ($order->get_payment_method()==WcPagantisGateway::METHOD_ID) {
|
|
| 357 | + if ($order->get_status()=='failed') {
|
|
| 358 | 358 | $status = 'processing'; |
| 359 | - } elseif ($order->get_status() == 'pending' && $status=='completed') {
|
|
| 359 | + } elseif ($order->get_status()=='pending' && $status=='completed') {
|
|
| 360 | 360 | $status = 'processing'; |
| 361 | 361 | } |
| 362 | 362 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | public function is_available() |
| 378 | 378 | {
|
| 379 | 379 | if ($this->enabled==='yes' && $this->pagantis_public_key!='' && $this->pagantis_private_key!='' && |
| 380 | - (int)$this->get_order_total()>$this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']) {
|
|
| 380 | + (int) $this->get_order_total() > $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']) {
|
|
| 381 | 381 | return true; |
| 382 | 382 | } |
| 383 | 383 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | |
| 406 | 406 | $redirectUrl = $order->get_checkout_payment_url(true); //pagantisReceiptPage function |
| 407 | 407 | if (strpos($redirectUrl, 'order-pay=')===false) {
|
| 408 | - $redirectUrl.="&order-pay=".$order_id; |
|
| 408 | + $redirectUrl .= "&order-pay=".$order_id; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | return array( |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | ); |
| 415 | 415 | |
| 416 | 416 | } catch (Exception $e) {
|
| 417 | - wc_add_notice(__('Payment error ', 'pagantis') . $e->getMessage(), 'error');
|
|
| 417 | + wc_add_notice(__('Payment error ', 'pagantis').$e->getMessage(), 'error');
|
|
| 418 | 418 | return array(); |
| 419 | 419 | } |
| 420 | 420 | } |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | private function generateUrl($url) |
| 467 | 467 | {
|
| 468 | 468 | $parsed_url = parse_url($url); |
| 469 | - if ($parsed_url !== false) {
|
|
| 469 | + if ($parsed_url!==false) {
|
|
| 470 | 470 | $parsed_url['query'] = !isset($parsed_url['query']) ? '' : $parsed_url['query']; |
| 471 | 471 | parse_str($parsed_url['query'], $arrayParams); |
| 472 | 472 | foreach ($arrayParams as $keyParam => $valueParam) {
|
@@ -514,11 +514,10 @@ discard block |
||
| 514 | 514 | private function getKeysUrl($order, $url) |
| 515 | 515 | {
|
| 516 | 516 | $defaultFields = (get_class($order)=='WC_Order') ? |
| 517 | - array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) :
|
|
| 518 | - array(); |
|
| 517 | + array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) : array();
|
|
| 519 | 518 | |
| 520 | 519 | $parsedUrl = parse_url($url); |
| 521 | - if ($parsedUrl !== false) {
|
|
| 520 | + if ($parsedUrl!==false) {
|
|
| 522 | 521 | //Replace parameters from url |
| 523 | 522 | $parsedUrl['query'] = $this->getKeysParametersUrl($parsedUrl['query'], $defaultFields); |
| 524 | 523 | |
@@ -563,7 +562,7 @@ discard block |
||
| 563 | 562 | foreach ($arrayParams as $keyParam => $valueParam) {
|
| 564 | 563 | preg_match('#\{{.*?}\}#', $valueParam, $match);
|
| 565 | 564 | if (count($match)) {
|
| 566 | - $key = str_replace(array('{{','}}'), array('',''), $match[0]);
|
|
| 565 | + $key = str_replace(array('{{', '}}'), array('', ''), $match[0]);
|
|
| 567 | 566 | $arrayParams[$keyParam] = $defaultFields[$key]; |
| 568 | 567 | } |
| 569 | 568 | } |
@@ -578,13 +577,13 @@ discard block |
||
| 578 | 577 | */ |
| 579 | 578 | private function unparseUrl($parsed_url) |
| 580 | 579 | {
|
| 581 | - $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |
|
| 580 | + $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; |
|
| 582 | 581 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
| 583 | - $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |
|
| 584 | - $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; |
|
| 585 | - $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; |
|
| 582 | + $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; |
|
| 583 | + $query = isset($parsed_url['query']) ? '?'.$parsed_url['query'] : ''; |
|
| 584 | + $fragment = isset($parsed_url['fragment']) ? '#'.$parsed_url['fragment'] : ''; |
|
| 586 | 585 | $path = $parsed_url['path']; |
| 587 | - return $scheme . $host . $port . $path . $query . $fragment; |
|
| 586 | + return $scheme.$host.$port.$path.$query.$fragment; |
|
| 588 | 587 | } |
| 589 | 588 | |
| 590 | 589 | /** |
@@ -606,20 +605,20 @@ discard block |
||
| 606 | 605 | $is_guest = "false"; |
| 607 | 606 | $sign_up = substr($current_user->user_registered, 0, 10); |
| 608 | 607 | $customer_orders = get_posts(array( |
| 609 | - 'numberposts' => - 1, |
|
| 608 | + 'numberposts' => -1, |
|
| 610 | 609 | 'meta_key' => '_customer_user', |
| 611 | 610 | 'meta_value' => $current_user->ID, |
| 612 | - 'post_type' => array( 'shop_order' ), |
|
| 613 | - 'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded' ), |
|
| 611 | + 'post_type' => array('shop_order'),
|
|
| 612 | + 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'),
|
|
| 614 | 613 | )); |
| 615 | 614 | } else {
|
| 616 | 615 | $is_guest = "true"; |
| 617 | 616 | $customer_orders = get_posts(array( |
| 618 | - 'numberposts' => - 1, |
|
| 617 | + 'numberposts' => -1, |
|
| 619 | 618 | 'meta_key' => '_billing_email', |
| 620 | 619 | 'meta_value' => $billingEmail, |
| 621 | - 'post_type' => array( 'shop_order' ), |
|
| 622 | - 'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded'), |
|
| 620 | + 'post_type' => array('shop_order'),
|
|
| 621 | + 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'),
|
|
| 623 | 622 | )); |
| 624 | 623 | foreach ($customer_orders as $customer_order) {
|
| 625 | 624 | if (trim($sign_up)=='' || |
@@ -648,7 +647,7 @@ discard block |
||
| 648 | 647 | //Check if id exists |
| 649 | 648 | $resultsSelect = $wpdb->get_results("select * from $tableName where id='$orderId'");
|
| 650 | 649 | $countResults = count($resultsSelect); |
| 651 | - if ($countResults == 0) {
|
|
| 650 | + if ($countResults==0) {
|
|
| 652 | 651 | $wpdb->insert( |
| 653 | 652 | $tableName, |
| 654 | 653 | array('id' => $orderId, 'order_id' => $pagantisOrderId),
|
@@ -673,7 +672,7 @@ discard block |
||
| 673 | 672 | global $wpdb; |
| 674 | 673 | $tableName = $wpdb->prefix.self::ORDERS_TABLE; |
| 675 | 674 | |
| 676 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) {
|
|
| 675 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) {
|
|
| 677 | 676 | $charset_collate = $wpdb->get_charset_collate(); |
| 678 | 677 | $sql = "CREATE TABLE $tableName ( id int, order_id varchar(50), wc_order_id varchar(50), |
| 679 | 678 | UNIQUE KEY id (id)) $charset_collate"; |
@@ -3,17 +3,17 @@ |
||
| 3 | 3 | |
| 4 | 4 | function loadSimulator() |
| 5 | 5 | { |
| 6 | - var positionSelector = '<?php echo $positionSelector;?>'; |
|
| 6 | + var positionSelector = '<?php echo $positionSelector; ?>'; |
|
| 7 | 7 | if (positionSelector === 'default') { |
| 8 | 8 | positionSelector = '.PagantisSimulator'; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | - var priceSelector = '<?php echo $priceSelector;?>'; |
|
| 11 | + var priceSelector = '<?php echo $priceSelector; ?>'; |
|
| 12 | 12 | if (priceSelector === 'default') { |
| 13 | 13 | priceSelector = 'div.summary.entry-summary span.woocommerce-Price-amount.amount'; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - var quantitySelector = '<?php echo $quantitySelector;?>'; |
|
| 16 | + var quantitySelector = '<?php echo $quantitySelector; ?>'; |
|
| 17 | 17 | if (quantitySelector === 'default') { |
| 18 | 18 | quantitySelector = 'div.quantity>input'; |
| 19 | 19 | } |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function loadPagantisTranslation($mofile, $domain) |
| 78 | 78 | { |
| 79 | - if ('pagantis' === $domain) { |
|
| 80 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
| 79 | + if ('pagantis'===$domain) { |
|
| 80 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
| 81 | 81 | } |
| 82 | 82 | return $mofile; |
| 83 | 83 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $tableName = $wpdb->prefix.self::CONFIG_TABLE; |
| 92 | 92 | |
| 93 | 93 | //Check if table exists |
| 94 | - $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName; |
|
| 94 | + $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName; |
|
| 95 | 95 | if ($tableExists) { |
| 96 | 96 | $charset_collate = $wpdb->get_charset_collate(); |
| 97 | 97 | $sql = "CREATE TABLE IF NOT EXISTS $tableName ( |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | global $product; |
| 143 | 143 | |
| 144 | 144 | $cfg = get_option('woocommerce_pagantis_settings'); |
| 145 | - if ($cfg['enabled'] !== 'yes' || $cfg['pagantis_public_key'] == '' || $cfg['pagantis_private_key'] == '' || |
|
| 146 | - $cfg['simulator'] !== 'yes' || $product->price < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] ) { |
|
| 145 | + if ($cfg['enabled']!=='yes' || $cfg['pagantis_public_key']=='' || $cfg['pagantis_private_key']=='' || |
|
| 146 | + $cfg['simulator']!=='yes' || $product->price < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']) { |
|
| 147 | 147 | return; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function addPagantisGateway($methods) |
| 170 | 170 | { |
| 171 | - if (! class_exists('WC_Payment_Gateway')) { |
|
| 171 | + if (!class_exists('WC_Payment_Gateway')) { |
|
| 172 | 172 | return $methods; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | public function pagantisRowMeta($links, $file) |
| 225 | 225 | { |
| 226 | - if ($file == plugin_basename(__FILE__)) { |
|
| 226 | + if ($file==plugin_basename(__FILE__)) { |
|
| 227 | 227 | $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>'; |
| 228 | 228 | $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'. |
| 229 | 229 | __('API documentation', 'pagantis').'</a>'; |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $tableName = $wpdb->prefix.self::LOGS_TABLE; |
| 252 | 252 | $query = "select * from $tableName where createdAt>$from and createdAt<$to order by createdAt desc"; |
| 253 | 253 | $results = $wpdb->get_results($query); |
| 254 | - if (isset($results) && $privateKey == $secretKey) { |
|
| 254 | + if (isset($results) && $privateKey==$secretKey) { |
|
| 255 | 255 | foreach ($results as $key => $result) { |
| 256 | 256 | $response[$key]['timestamp'] = $result->createdAt; |
| 257 | 257 | $response[$key]['log'] = json_decode($result->log); |
@@ -278,12 +278,12 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $filters = ($data->get_params()); |
| 280 | 280 | $secretKey = $filters['secret']; |
| 281 | - $cfg = get_option('woocommerce_pagantis_settings'); |
|
| 281 | + $cfg = get_option('woocommerce_pagantis_settings'); |
|
| 282 | 282 | $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null; |
| 283 | - if ($privateKey != $secretKey) { |
|
| 283 | + if ($privateKey!=$secretKey) { |
|
| 284 | 284 | $response['status'] = 401; |
| 285 | 285 | $response['result'] = 'Unauthorized'; |
| 286 | - } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 286 | + } elseif ($_SERVER['REQUEST_METHOD']=='POST') { |
|
| 287 | 287 | if (count($_POST)) { |
| 288 | 288 | foreach ($_POST as $config => $value) { |
| 289 | 289 | if (isset($this->defaultConfigs[$config]) && $response['status']==null) { |