@@ -51,29 +51,29 @@ discard block |
||
| 51 | 51 | $this->title = $this->extraConfig['PAGANTIS_TITLE']; |
| 52 | 52 | |
| 53 | 53 | //Useful vars |
| 54 | - $this->template_path = plugin_dir_path(__FILE__) . '../templates/'; |
|
| 54 | + $this->template_path = plugin_dir_path(__FILE__).'../templates/'; |
|
| 55 | 55 | $this->allowed_currencies = array("EUR");
|
| 56 | - $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php'; |
|
| 56 | + $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)).'/WC_Pagantis.php'; |
|
| 57 | 57 | $this->plugin_info = get_file_data($this->mainFileLocation, array('Version' => 'Version'), false);
|
| 58 | 58 | |
| 59 | 59 | //Panel form fields |
| 60 | - $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php');//Panel options |
|
| 60 | + $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php'); //Panel options |
|
| 61 | 61 | $this->init_settings(); |
| 62 | 62 | |
| 63 | 63 | $this->extraConfig = $this->getExtraConfig(); |
| 64 | 64 | |
| 65 | - $this->settings['ok_url'] = ($this->extraConfig['PAGANTIS_URL_OK']!='')?$this->extraConfig['PAGANTIS_URL_OK']:$this->generateOkUrl(); |
|
| 66 | - $this->settings['ko_url'] = ($this->extraConfig['PAGANTIS_URL_KO']!='')?$this->extraConfig['PAGANTIS_URL_KO']:$this->generateKoUrl(); |
|
| 65 | + $this->settings['ok_url'] = ($this->extraConfig['PAGANTIS_URL_OK']!='') ? $this->extraConfig['PAGANTIS_URL_OK'] : $this->generateOkUrl(); |
|
| 66 | + $this->settings['ko_url'] = ($this->extraConfig['PAGANTIS_URL_KO']!='') ? $this->extraConfig['PAGANTIS_URL_KO'] : $this->generateKoUrl(); |
|
| 67 | 67 | foreach ($this->settings as $setting_key => $setting_value) {
|
| 68 | 68 | $this->$setting_key = $setting_value; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | //Hooks |
| 72 | - add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this,'process_admin_options')); //Save plugin options
|
|
| 73 | - add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields
|
|
| 74 | - add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form
|
|
| 75 | - add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification
|
|
| 76 | - add_filter('woocommerce_payment_complete_order_status', array($this,'pagantisCompleteStatus'), 10, 3);
|
|
| 72 | + add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this, 'process_admin_options')); //Save plugin options
|
|
| 73 | + add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields
|
|
| 74 | + add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form
|
|
| 75 | + add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification
|
|
| 76 | + add_filter('woocommerce_payment_complete_order_status', array($this, 'pagantisCompleteStatus'), 10, 3);
|
|
| 77 | 77 | add_filter('load_textdomain_mofile', array($this, 'loadPagantisTranslation'), 10, 2);
|
| 78 | 78 | } |
| 79 | 79 | |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function loadPagantisTranslation($mofile, $domain) |
| 87 | 87 | {
|
| 88 | - if ('pagantis' === $domain) {
|
|
| 89 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
| 88 | + if ('pagantis'===$domain) {
|
|
| 89 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
| 90 | 90 | } |
| 91 | 91 | return $mofile; |
| 92 | 92 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $template_fields = array( |
| 106 | 106 | 'panel_header' => $this->title, |
| 107 | 107 | 'panel_description' => $this->method_description, |
| 108 | - 'button1_label' => __('Login to panel of ', 'pagantis') . ucfirst(WcPagantisGateway::METHOD_ID),
|
|
| 108 | + 'button1_label' => __('Login to panel of ', 'pagantis').ucfirst(WcPagantisGateway::METHOD_ID),
|
|
| 109 | 109 | 'button2_label' => __('Documentation', 'pagantis'),
|
| 110 | 110 | 'logo' => $this->icon, |
| 111 | 111 | 'settings' => $this->generate_settings_html($this->form_fields, false) |
@@ -119,24 +119,24 @@ discard block |
||
| 119 | 119 | public function pagantisCheckFields() |
| 120 | 120 | {
|
| 121 | 121 | $error_string = ''; |
| 122 | - if ($this->settings['enabled'] !== 'yes') {
|
|
| 122 | + if ($this->settings['enabled']!=='yes') {
|
|
| 123 | 123 | return; |
| 124 | 124 | } elseif (!version_compare(phpversion(), '5.3.0', '>=')) {
|
| 125 | - $error_string = __(' is not compatible with your php and/or curl version', 'pagantis');
|
|
| 125 | + $error_string = __(' is not compatible with your php and/or curl version', 'pagantis');
|
|
| 126 | 126 | $this->settings['enabled'] = 'no'; |
| 127 | 127 | } elseif ($this->settings['pagantis_public_key']=="" || $this->settings['pagantis_private_key']=="") {
|
| 128 | 128 | $error_string = __(' is not configured correctly, the fields Public Key and Secret Key are mandatory for use this plugin', 'pagantis');
|
| 129 | 129 | $this->settings['enabled'] = 'no'; |
| 130 | 130 | } elseif (!in_array(get_woocommerce_currency(), $this->allowed_currencies)) {
|
| 131 | - $error_string = __(' only can be used in Euros', 'pagantis');
|
|
| 131 | + $error_string = __(' only can be used in Euros', 'pagantis');
|
|
| 132 | 132 | $this->settings['enabled'] = 'no'; |
| 133 | - } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS']<'2' |
|
| 134 | - || $this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS']>'12') {
|
|
| 133 | + } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'] < '2' |
|
| 134 | + || $this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'] > '12') {
|
|
| 135 | 135 | $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis');
|
| 136 | - } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS']<'2' |
|
| 137 | - || $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS']>'12') {
|
|
| 136 | + } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] < '2' |
|
| 137 | + || $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] > '12') {
|
|
| 138 | 138 | $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis');
|
| 139 | - } elseif ($this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']<0) {
|
|
| 139 | + } elseif ($this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] < 0) {
|
|
| 140 | 140 | $error_string = __(' can not have a minimum amount less than 0', 'pagantis');
|
| 141 | 141 | } |
| 142 | 142 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $shippingAddress = $order->get_address('shipping');
|
| 172 | 172 | $billingAddress = $order->get_address('billing');
|
| 173 | - if ($shippingAddress['address_1'] == '') {
|
|
| 173 | + if ($shippingAddress['address_1']=='') {
|
|
| 174 | 174 | $shippingAddress = $billingAddress; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | ->setNationalId($national_id) |
| 198 | 198 | ->setTaxId($tax_id) |
| 199 | 199 | ; |
| 200 | - $orderBillingAddress = new Address(); |
|
| 200 | + $orderBillingAddress = new Address(); |
|
| 201 | 201 | $orderBillingAddress |
| 202 | 202 | ->setZipCode($billingAddress['postcode']) |
| 203 | 203 | ->setFullName($billingAddress['first_name']." ".$billingAddress['last_name']) |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | wc_get_template('iframe.php', $template_fields, '', $this->template_path);
|
| 329 | 329 | } |
| 330 | 330 | } catch (\Exception $exception) {
|
| 331 | - wc_add_notice(__('Payment error ', 'pagantis') . $exception->getMessage(), 'error');
|
|
| 331 | + wc_add_notice(__('Payment error ', 'pagantis').$exception->getMessage(), 'error');
|
|
| 332 | 332 | $checkout_url = get_permalink(wc_get_page_id('checkout'));
|
| 333 | 333 | wp_redirect($checkout_url); |
| 334 | 334 | exit; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | public function pagantisNotification() |
| 342 | 342 | {
|
| 343 | 343 | try {
|
| 344 | - $origin = ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'Notify' : 'Order'; |
|
| 344 | + $origin = ($_SERVER['REQUEST_METHOD']=='POST') ? 'Notify' : 'Order'; |
|
| 345 | 345 | |
| 346 | 346 | include_once('notifyController.php');
|
| 347 | 347 | $notify = new WcPagantisNotify(); |
@@ -380,10 +380,10 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | public function pagantisCompleteStatus($status, $order_id, $order) |
| 382 | 382 | {
|
| 383 | - if ($order->get_payment_method() == WcPagantisGateway::METHOD_ID) {
|
|
| 384 | - if ($order->get_status() == 'failed') {
|
|
| 383 | + if ($order->get_payment_method()==WcPagantisGateway::METHOD_ID) {
|
|
| 384 | + if ($order->get_status()=='failed') {
|
|
| 385 | 385 | $status = 'processing'; |
| 386 | - } elseif ($order->get_status() == 'pending' && $status=='completed') {
|
|
| 386 | + } elseif ($order->get_status()=='pending' && $status=='completed') {
|
|
| 387 | 387 | $status = 'processing'; |
| 388 | 388 | } |
| 389 | 389 | } |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $allowedCountries = unserialize($this->extraConfig['PAGANTIS_ALLOWED_COUNTRIES']); |
| 408 | 408 | $allowedCountry = (in_array(strtolower($locale), $allowedCountries)); |
| 409 | 409 | if ($this->enabled==='yes' && $this->pagantis_public_key!='' && $this->pagantis_private_key!='' && |
| 410 | - (int)$this->get_order_total()>$this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] && $allowedCountry) {
|
|
| 410 | + (int) $this->get_order_total() > $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] && $allowedCountry) {
|
|
| 411 | 411 | return true; |
| 412 | 412 | } |
| 413 | 413 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | $redirectUrl = $order->get_checkout_payment_url(true); //pagantisReceiptPage function |
| 437 | 437 | if (strpos($redirectUrl, 'order-pay=')===false) {
|
| 438 | - $redirectUrl.="&order-pay=".$order_id; |
|
| 438 | + $redirectUrl .= "&order-pay=".$order_id; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | return array( |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | ); |
| 445 | 445 | |
| 446 | 446 | } catch (Exception $e) {
|
| 447 | - wc_add_notice(__('Payment error ', 'pagantis') . $e->getMessage(), 'error');
|
|
| 447 | + wc_add_notice(__('Payment error ', 'pagantis').$e->getMessage(), 'error');
|
|
| 448 | 448 | return array(); |
| 449 | 449 | } |
| 450 | 450 | } |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | private function generateUrl($url) |
| 505 | 505 | {
|
| 506 | 506 | $parsed_url = parse_url($url); |
| 507 | - if ($parsed_url !== false) {
|
|
| 507 | + if ($parsed_url!==false) {
|
|
| 508 | 508 | $parsed_url['query'] = !isset($parsed_url['query']) ? '' : $parsed_url['query']; |
| 509 | 509 | parse_str($parsed_url['query'], $arrayParams); |
| 510 | 510 | foreach ($arrayParams as $keyParam => $valueParam) {
|
@@ -552,11 +552,10 @@ discard block |
||
| 552 | 552 | private function getKeysUrl($order, $url) |
| 553 | 553 | {
|
| 554 | 554 | $defaultFields = (get_class($order)=='WC_Order') ? |
| 555 | - array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) :
|
|
| 556 | - array(); |
|
| 555 | + array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) : array();
|
|
| 557 | 556 | |
| 558 | 557 | $parsedUrl = parse_url($url); |
| 559 | - if ($parsedUrl !== false) {
|
|
| 558 | + if ($parsedUrl!==false) {
|
|
| 560 | 559 | //Replace parameters from url |
| 561 | 560 | $parsedUrl['query'] = $this->getKeysParametersUrl($parsedUrl['query'], $defaultFields); |
| 562 | 561 | |
@@ -601,7 +600,7 @@ discard block |
||
| 601 | 600 | foreach ($arrayParams as $keyParam => $valueParam) {
|
| 602 | 601 | preg_match('#\{{.*?}\}#', $valueParam, $match);
|
| 603 | 602 | if (count($match)) {
|
| 604 | - $key = str_replace(array('{{','}}'), array('',''), $match[0]);
|
|
| 603 | + $key = str_replace(array('{{', '}}'), array('', ''), $match[0]);
|
|
| 605 | 604 | $arrayParams[$keyParam] = $defaultFields[$key]; |
| 606 | 605 | } |
| 607 | 606 | } |
@@ -616,13 +615,13 @@ discard block |
||
| 616 | 615 | */ |
| 617 | 616 | private function unparseUrl($parsed_url) |
| 618 | 617 | {
|
| 619 | - $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |
|
| 618 | + $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; |
|
| 620 | 619 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
| 621 | - $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |
|
| 622 | - $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; |
|
| 623 | - $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; |
|
| 620 | + $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; |
|
| 621 | + $query = isset($parsed_url['query']) ? '?'.$parsed_url['query'] : ''; |
|
| 622 | + $fragment = isset($parsed_url['fragment']) ? '#'.$parsed_url['fragment'] : ''; |
|
| 624 | 623 | $path = $parsed_url['path']; |
| 625 | - return $scheme . $host . $port . $path . $query . $fragment; |
|
| 624 | + return $scheme.$host.$port.$path.$query.$fragment; |
|
| 626 | 625 | } |
| 627 | 626 | |
| 628 | 627 | /** |
@@ -644,20 +643,20 @@ discard block |
||
| 644 | 643 | $is_guest = "false"; |
| 645 | 644 | $sign_up = substr($current_user->user_registered, 0, 10); |
| 646 | 645 | $customer_orders = get_posts(array( |
| 647 | - 'numberposts' => - 1, |
|
| 646 | + 'numberposts' => -1, |
|
| 648 | 647 | 'meta_key' => '_customer_user', |
| 649 | 648 | 'meta_value' => $current_user->ID, |
| 650 | - 'post_type' => array( 'shop_order' ), |
|
| 651 | - 'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded' ), |
|
| 649 | + 'post_type' => array('shop_order'),
|
|
| 650 | + 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'),
|
|
| 652 | 651 | )); |
| 653 | 652 | } else {
|
| 654 | 653 | $is_guest = "true"; |
| 655 | 654 | $customer_orders = get_posts(array( |
| 656 | - 'numberposts' => - 1, |
|
| 655 | + 'numberposts' => -1, |
|
| 657 | 656 | 'meta_key' => '_billing_email', |
| 658 | 657 | 'meta_value' => $billingEmail, |
| 659 | - 'post_type' => array( 'shop_order' ), |
|
| 660 | - 'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded'), |
|
| 658 | + 'post_type' => array('shop_order'),
|
|
| 659 | + 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'),
|
|
| 661 | 660 | )); |
| 662 | 661 | foreach ($customer_orders as $customer_order) {
|
| 663 | 662 | if (trim($sign_up)=='' || |
@@ -686,7 +685,7 @@ discard block |
||
| 686 | 685 | //Check if id exists |
| 687 | 686 | $resultsSelect = $wpdb->get_results("select * from $tableName where id='$orderId'");
|
| 688 | 687 | $countResults = count($resultsSelect); |
| 689 | - if ($countResults == 0) {
|
|
| 688 | + if ($countResults==0) {
|
|
| 690 | 689 | $wpdb->insert( |
| 691 | 690 | $tableName, |
| 692 | 691 | array('id' => $orderId, 'order_id' => $pagantisOrderId),
|
@@ -711,7 +710,7 @@ discard block |
||
| 711 | 710 | global $wpdb; |
| 712 | 711 | $tableName = $wpdb->prefix.self::ORDERS_TABLE; |
| 713 | 712 | |
| 714 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) {
|
|
| 713 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) {
|
|
| 715 | 714 | $charset_collate = $wpdb->get_charset_collate(); |
| 716 | 715 | $sql = "CREATE TABLE $tableName ( id int, order_id varchar(50), wc_order_id varchar(50), |
| 717 | 716 | UNIQUE KEY id (id)) $charset_collate"; |
@@ -744,9 +743,9 @@ discard block |
||
| 744 | 743 | */ |
| 745 | 744 | private function getNationalId($order) |
| 746 | 745 | {
|
| 747 | - foreach ((array)$order->get_meta_data() as $mdObject) {
|
|
| 746 | + foreach ((array) $order->get_meta_data() as $mdObject) {
|
|
| 748 | 747 | $data = $mdObject->get_data(); |
| 749 | - if ($data['key'] == 'vat_number') {
|
|
| 748 | + if ($data['key']=='vat_number') {
|
|
| 750 | 749 | return $data['value']; |
| 751 | 750 | } |
| 752 | 751 | } |
@@ -766,9 +765,9 @@ discard block |
||
| 766 | 765 | */ |
| 767 | 766 | private function getTaxId($order) |
| 768 | 767 | {
|
| 769 | - foreach ((array)$order->get_meta_data() as $mdObject) {
|
|
| 768 | + foreach ((array) $order->get_meta_data() as $mdObject) {
|
|
| 770 | 769 | $data = $mdObject->get_data(); |
| 771 | - if ($data['key'] == 'billing_cfpiva') {
|
|
| 770 | + if ($data['key']=='billing_cfpiva') {
|
|
| 772 | 771 | return $data['value']; |
| 773 | 772 | } |
| 774 | 773 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function loadPagantisTranslation($mofile, $domain) |
| 79 | 79 | { |
| 80 | - if ('pagantis' === $domain) { |
|
| 81 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
| 80 | + if ('pagantis'===$domain) { |
|
| 81 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
| 82 | 82 | } |
| 83 | 83 | return $mofile; |
| 84 | 84 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $tableName = $wpdb->prefix.self::CONFIG_TABLE; |
| 93 | 93 | |
| 94 | 94 | //Check if table exists |
| 95 | - $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName; |
|
| 95 | + $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName; |
|
| 96 | 96 | if ($tableExists) { |
| 97 | 97 | $charset_collate = $wpdb->get_charset_collate(); |
| 98 | 98 | $sql = "CREATE TABLE IF NOT EXISTS $tableName ( |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | $locale = strtolower(strstr(get_locale(), '_', true)); |
| 147 | 147 | $allowedCountries = unserialize($this->extraConfig['PAGANTIS_ALLOWED_COUNTRIES']); |
| 148 | 148 | $allowedCountry = (in_array(strtolower($locale), $allowedCountries)); |
| 149 | - if ($cfg['enabled'] !== 'yes' || $cfg['pagantis_public_key'] == '' || $cfg['pagantis_private_key'] == '' || |
|
| 150 | - $cfg['simulator'] !== 'yes' || $product->price < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] || |
|
| 151 | - !$allowedCountry ) { |
|
| 149 | + if ($cfg['enabled']!=='yes' || $cfg['pagantis_public_key']=='' || $cfg['pagantis_private_key']=='' || |
|
| 150 | + $cfg['simulator']!=='yes' || $product->price < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] || |
|
| 151 | + !$allowedCountry) { |
|
| 152 | 152 | return; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function addPagantisGateway($methods) |
| 176 | 176 | { |
| 177 | - if (! class_exists('WC_Payment_Gateway')) { |
|
| 177 | + if (!class_exists('WC_Payment_Gateway')) { |
|
| 178 | 178 | return $methods; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function pagantisRowMeta($links, $file) |
| 231 | 231 | { |
| 232 | - if ($file == plugin_basename(__FILE__)) { |
|
| 232 | + if ($file==plugin_basename(__FILE__)) { |
|
| 233 | 233 | $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>'; |
| 234 | 234 | $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'. |
| 235 | 235 | __('API documentation', 'pagantis').'</a>'; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $tableName = $wpdb->prefix.self::LOGS_TABLE; |
| 258 | 258 | $query = "select * from $tableName where createdAt>$from and createdAt<$to order by createdAt desc"; |
| 259 | 259 | $results = $wpdb->get_results($query); |
| 260 | - if (isset($results) && $privateKey == $secretKey) { |
|
| 260 | + if (isset($results) && $privateKey==$secretKey) { |
|
| 261 | 261 | foreach ($results as $key => $result) { |
| 262 | 262 | $response[$key]['timestamp'] = $result->createdAt; |
| 263 | 263 | $response[$key]['log'] = json_decode($result->log); |
@@ -284,12 +284,12 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $filters = ($data->get_params()); |
| 286 | 286 | $secretKey = $filters['secret']; |
| 287 | - $cfg = get_option('woocommerce_pagantis_settings'); |
|
| 287 | + $cfg = get_option('woocommerce_pagantis_settings'); |
|
| 288 | 288 | $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null; |
| 289 | - if ($privateKey != $secretKey) { |
|
| 289 | + if ($privateKey!=$secretKey) { |
|
| 290 | 290 | $response['status'] = 401; |
| 291 | 291 | $response['result'] = 'Unauthorized'; |
| 292 | - } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 292 | + } elseif ($_SERVER['REQUEST_METHOD']=='POST') { |
|
| 293 | 293 | if (count($_POST)) { |
| 294 | 294 | foreach ($_POST as $config => $value) { |
| 295 | 295 | if (isset($this->defaultConfigs[$config]) && $response['status']==null) { |
@@ -16,17 +16,17 @@ |
||
| 16 | 16 | function loadSimulator() |
| 17 | 17 | { |
| 18 | 18 | var locale = '<?php echo $locale; ?>'; |
| 19 | - var positionSelector = '<?php echo $positionSelector;?>'; |
|
| 19 | + var positionSelector = '<?php echo $positionSelector; ?>'; |
|
| 20 | 20 | if (positionSelector === 'default') { |
| 21 | 21 | positionSelector = '.PagantisSimulator'; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - var priceSelector = '<?php echo $priceSelector;?>'; |
|
| 24 | + var priceSelector = '<?php echo $priceSelector; ?>'; |
|
| 25 | 25 | if (priceSelector === 'default') { |
| 26 | 26 | priceSelector = findPriceSelector(); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - var quantitySelector = '<?php echo $quantitySelector;?>'; |
|
| 29 | + var quantitySelector = '<?php echo $quantitySelector; ?>'; |
|
| 30 | 30 | if (quantitySelector === 'default') { |
| 31 | 31 | quantitySelector = 'div.quantity>input'; |
| 32 | 32 | } |