File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66Author: Buckaroo
77Author URI: http://www.buckaroo.nl
88Description: Buckaroo payment system plugin for WooCommerce.
9- Version: 4.7.2
9+ Version: 4.7.3
1010Text Domain: wc-buckaroo-bpe-gateway
1111Domain Path: /languages
1212License: GPLv2 or later
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class Plugin
1616 *
1717 * @var string
1818 */
19- public const VERSION = '4.7.2 ' ;
19+ public const VERSION = '4.7.3 ' ;
2020
2121 /**
2222 * Instance of PaymentGatewayRegistry.
Original file line number Diff line number Diff line change 99use Throwable ;
1010use Buckaroo \Woocommerce \Install \Migration \Versions \DisableAutoloadForSettings ;
1111use Buckaroo \Woocommerce \Install \Migration \Versions \MigrateIdealToIdealWero ;
12+ use Buckaroo \Woocommerce \Install \Migration \Versions \MigrateKlarnaPayLaterLabels ;
1213
1314/**
1415 * Core class for handling migrations
@@ -187,6 +188,7 @@ protected function get_migration_items()
187188 new SetupTransactionsAndLogs (),
188189 new DisableAutoloadForSettings (),
189190 new MigrateIdealToIdealWero (),
191+ new MigrateKlarnaPayLaterLabels (),
190192 ];
191193 }
192194
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Buckaroo \Woocommerce \Install \Migration \Versions ;
4+
5+ use Buckaroo \Woocommerce \Install \Migration \Migration ;
6+
7+ /**
8+ * Cleans up legacy "Klarna: Pay later" front-end label and description values
9+ * stored for the Klarna (MoR) gateway (`buckaroo_klarnapay`) in earlier plugin
10+ * versions, before the gateway was renamed to just "Klarna".
11+ */
12+ class MigrateKlarnaPayLaterLabels implements Migration
13+ {
14+ public $ version = '4.7.3 ' ;
15+
16+ public function execute ()
17+ {
18+ $ optionKey = 'woocommerce_buckaroo_klarnapay_settings ' ;
19+ $ settings = get_option ($ optionKey );
20+
21+ if (! is_array ($ settings )) {
22+ return ;
23+ }
24+
25+ $ needsUpdate = false ;
26+
27+ if (isset ($ settings ['title ' ]) && stripos ($ settings ['title ' ], 'Pay later ' ) !== false ) {
28+ $ settings ['title ' ] = 'Klarna ' ;
29+ $ needsUpdate = true ;
30+ }
31+
32+ if (isset ($ settings ['description ' ]) && stripos ($ settings ['description ' ], 'Pay later ' ) !== false ) {
33+ $ settings ['description ' ] = 'Pay with Klarna ' ;
34+ $ needsUpdate = true ;
35+ }
36+
37+ if ($ needsUpdate ) {
38+ update_option ($ optionKey , $ settings , 'no ' );
39+ }
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments