Skip to content

Commit 87508b9

Browse files
authored
Merge pull request #32 from jovialcore/master
Fix for the php deprecated dynamic property warning Support for PHP 8.2 Decrease logs due of missing method property in a class Code cleaning
2 parents ee9d064 + af70e22 commit 87508b9

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

classes/class-wc-tpayway.php

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,29 @@ class WC_TPAYWAY extends WC_Payment_Gateway
1010
/**
1111
* WC_TPAYWAY constructor.
1212
*/
13+
14+
private $id;
15+
private $domain;
16+
private $icon;
17+
private $method_title;
18+
private $has_fields;
19+
private $curlExtension;
20+
private $ratehrkfixed;
21+
private $tecajnaHnbApi;
22+
private $api_version;
23+
private $title;
24+
private $settings;
25+
private $shop_id;
26+
private $acq_id;
27+
private $pg_domain;
28+
private $checkout_msg;
29+
private $description;
30+
private $msg;
31+
32+
1333
public function __construct()
1434
{
35+
1536
$this->id = 'WC_TPAYWAY';
1637
$this->domain = 'tcom-payway-wc';
1738
$this->icon = apply_filters('woocommerce_payway_icon', TCOM_PAYWAY_URL . 'assets/images/payway.png');
@@ -33,7 +54,7 @@ public function __construct()
3354
$this->title = isset($settings['title']) ? $settings['title'] : '';
3455
$this->shop_id = isset($settings['mer_id']) ? $settings['mer_id'] : '';
3556
$this->acq_id = isset($settings['acq_id']) ? $settings['acq_id'] : '';
36-
$this->pg_domain = $this->get_option( 'pg_domain' );
57+
$this->pg_domain = $this->get_option('pg_domain');
3758
$this->checkout_msg = isset($settings['checkout_msg']) ? $settings['checkout_msg'] : '';
3859
$this->description = isset($settings['description']) ? $settings['description'] : '';
3960

@@ -83,8 +104,8 @@ function init_form_fields()
83104
'default' => 'prod',
84105
'desc_tip' => true,
85106
'options' => array(
86-
'test' => __( 'Test Mode', 'woocommerce' ),
87-
'prod' => __( 'Prod Mode', 'woocommerce' ),
107+
'test' => __('Test Mode', 'woocommerce'),
108+
'prod' => __('Prod Mode', 'woocommerce'),
88109
),
89110
),
90111
'mer_id' => array(
@@ -110,7 +131,7 @@ function init_form_fields()
110131

111132
public function admin_options()
112133
{
113-
$hnbRatesUri = "<a href=" . $this->tecajnaHnbApi .">HNB rates</a>";
134+
$hnbRatesUri = "<a href=" . $this->tecajnaHnbApi . ">HNB rates</a>";
114135

115136
echo '<h3>' . __('PayWay Hrvatski Telekom payment gateway', 'tcom-payway-wc') . '</h3>';
116137
echo '<p>' . __('<a target="_blank" href="https://www.hrvatskitelekom.hr/poslovni/ict/payway/">PayWay Hrvatski Telekom</a> is payment gateway from telecom Hrvatski Telekom who provides payment gateway services as dedicated services to clients in Croatia.', 'tcom-payway-wc') . '</p>';
@@ -120,7 +141,7 @@ public function admin_options()
120141
echo '<p>';
121142
echo '<p>' . 'HNB rates fetched: ' . $this->get_last_modified_hnb_file() . '</p>';
122143
echo '<p>Preferred currency will be EUR, make sure that default currency on your webshop is set to EUR</p>';
123-
echo '<p>Other currency will automatically calculated and sent to PayWay using HNB rates: USD (Wordpress) to HRK (PayWay) using ' .$hnbRatesUri . '</p>';
144+
echo '<p>Other currency will automatically calculated and sent to PayWay using HNB rates: USD (Wordpress) to HRK (PayWay) using ' . $hnbRatesUri . '</p>';
124145
echo '</p>';
125146
}
126147

@@ -180,7 +201,7 @@ private function update_hnb_currency()
180201
clearstatcache();
181202
if (filesize($file)) {
182203
// If file is older than a day
183-
if (time()-filemtime($file) > (24 * 3600)) {
204+
if (time() - filemtime($file) > (24 * 3600)) {
184205
file_put_contents($file, $this->get_hnb_currency());
185206
}
186207
}
@@ -207,7 +228,8 @@ private function get_last_modified_hnb_file()
207228
*
208229
* @return array|string|string[]|void
209230
*/
210-
private function fetch_hnb_currency($currency) {
231+
private function fetch_hnb_currency($currency)
232+
{
211233

212234
$file = __DIR__ . '/tecajnv2.json';
213235
$filecontents = file_get_contents($file);
@@ -219,7 +241,6 @@ private function fetch_hnb_currency($currency) {
219241
/** @var float $val */
220242
return str_replace(",", ".", $val['srednji_tecaj']);
221243
}
222-
223244
}
224245

225246
return 1;
@@ -487,7 +508,7 @@ function check_tcompayway_response()
487508
// $text = '<html><meta charset="utf-8"><body><center>';
488509
// $text .= __('Redirecting...', 'tcom-payway-wc');
489510
// $text .= '</center><script>setTimeout(function(){ window.location.replace("' . home_url() . '"); },1500);</script></body></html>';
490-
511+
491512
// echo $text;
492513

493514
// exit;

0 commit comments

Comments
 (0)