Skip to content

Commit

Permalink
"Prevent errors and warnings on PHP8 Compatibility"
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLuisMoLlo committed May 10, 2023
1 parent 0764ac8 commit eb0931a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 25 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@

### Changed

- SalesLayer-Conn class version updated.
- SalesLayer-Conn class version updated.

## [2.4] - 2023-05-09

### Changed

- SalesLayer-Conn class version updated.


44 changes: 22 additions & 22 deletions admin/lib/SalesLayer-Conn-Woo.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class SalesLayer_Conn_Woo
*/
public function __construct($codeConn = null, $secretKey = null, $SSL = null, $url = null, $forceuft8 = true)
{
if ($this->__has_system_requirements()) {
if ($this->has_system_requirements()) {
if (true == $forceuft8) {
ini_set('default_charset', 'utf-8');
}
Expand All @@ -117,10 +117,10 @@ public function __construct($codeConn = null, $secretKey = null, $SSL = null, $u
*
* @return bool
*/
private function __has_system_requirements()
private function has_system_requirements()
{
if (!extension_loaded('curl')) {
$this->__trigger_error('Missing PHP curl extension', 100);
$this->trigger_error('Missing PHP curl extension', 100);

return false;
}
Expand All @@ -135,7 +135,7 @@ private function __has_system_requirements()
*
* @return string
*/
private function __get_api_url($last_update = false)
private function get_api_url($last_update = false)
{
if (null != $this->__secretKey) {
$time = time();
Expand Down Expand Up @@ -173,7 +173,7 @@ private function __get_api_url($last_update = false)
/**
* Clean previous error code.
*/
private function __clean_error()
private function clean_error()
{
$this->response_error = 0;
$this->response_error_message = '';
Expand All @@ -190,7 +190,7 @@ public function set_identification($codeConn, $secretKey = null)
$this->__codeConn = $codeConn;
$this->__secretKey = $secretKey;

$this->__clean_error();
$this->clean_error();
}

/**
Expand Down Expand Up @@ -334,21 +334,21 @@ public function get_info($last_update = null, $params = null, $connector_type =
$params['pagination'] = $this->output_pagination;
}

$stat = $this->call($this->__get_api_url($last_update), $params);
$stat = $this->call($this->get_api_url($last_update), $params);

if ($stat) {

if ( $connector_type
&& isset($this->data_returned['schema']['connector_type'])
&& $this->data_returned['schema']['connector_type'] != $connector_type) {

$this->__trigger_error('Wrong connector type: '.$this->data_returned['schema']['connector_type'], 105);
$this->trigger_error('Wrong connector type: '.$this->data_returned['schema']['connector_type'], 105);

} else {

$this->__clean_error();
$this->clean_error();

return $this->__parsing_json_returned();
return $this->parsing_json_returned();
}
}
}
Expand Down Expand Up @@ -397,9 +397,9 @@ public function get_next_page_info()

if ($stat) {

$this->__clean_error();
$this->clean_error();

return $this->__parsing_json_returned();
return $this->parsing_json_returned();
}
}

Expand Down Expand Up @@ -484,11 +484,11 @@ public function set_info($update_items = [], $delete_items = [], $compression =
$params['compression'] = 1;
}

$stat = $this->call($this->__get_api_url(), $params);
$stat = $this->call($this->get_api_url(), $params);

if ($stat && is_array($this->data_returned)) {

$stat = $this->__parsing_json_returned();
$stat = $this->parsing_json_returned();

return (floatval($this->connect_API_version) > 1.17 ? $stat : $this->data_returned['input_response']);
}
Expand Down Expand Up @@ -584,8 +584,8 @@ public function check_input_tracking()

if ($stat) {

$this->__clean_error();
$this->__parsing_json_returned();
$this->clean_error();
$this->parsing_json_returned();

if (!$this->response_input_tracking_status) {

Expand Down Expand Up @@ -703,16 +703,16 @@ public function call ($url, $params = []) {
return true;

} else {
$this->__trigger_error('Void response or malformed: '.$response, 101);
$this->trigger_error('Void response or malformed: '.$response, 101);
}
} else {
$this->__trigger_error('Error connection: '.curl_error($ch), 102);
$this->trigger_error('Error connection: '.curl_error($ch), 102);
}

curl_close($ch);

} else {
$this->__trigger_error('Incorrect URL call: '.$url, 100);
$this->trigger_error('Incorrect URL call: '.$url, 100);
}

return false;
Expand All @@ -733,7 +733,7 @@ public function get_data_returned()
*
* @return bool
*/
private function __parsing_json_returned()
private function parsing_json_returned()
{

if (null !== $this->data_returned) {
Expand All @@ -759,7 +759,7 @@ private function __parsing_json_returned()
$message_error = 'API error';
}

$this->__trigger_error($message_error, $this->data_returned['error']);
$this->trigger_error($message_error, $this->data_returned['error']);

} else {

Expand Down Expand Up @@ -986,7 +986,7 @@ private function __parsing_json_returned()
* @param string $message error text
* @param int $errnum error identificator
*/
public function __trigger_error($message, $errnum)
public function trigger_error($message, $errnum)
{
if (0 === $this->response_error) {
$this->response_error = $errnum;
Expand Down
2 changes: 1 addition & 1 deletion saleslayer_woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: SalesLayer WooCommerce
Plugin URI: http://support.saleslayer.com/
Description: Plugin que permite sincronizar tu catalogo desde SalesLayer a WooCommerce.
Version: 2.3.3
Version: 2.4
Author: Sales Layer
Author URI: http://saleslayer.com/
License: GPL2
Expand Down
2 changes: 1 addition & 1 deletion settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ini_set('display_errors', 0);
error_reporting(E_ALL ^ E_NOTICE);

define('SLYR_WC_version', "2.3.3");
define('SLYR_WC_version', "2.4");

global $wp_version;
if (version_compare($wp_version,'4.5','>=')) {
Expand Down

0 comments on commit eb0931a

Please sign in to comment.