Diff: STRATO-apps/wordpress_03/app/wp-content/themes/blocksy/inc/classes/db-versioning/v2-1-0.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
namespace Blocksy\DbVersioning;
4
+
5
+
class V210 {
6
+
public function migrate() {
7
+
$this->migrate_background_to_color([
8
+
'background_id' => 'compare_modal_background',
9
+
'default_color' => 'var(--theme-palette-color-8)'
10
+
]);
11
+
12
+
$this->migrate_background_to_color([
13
+
'background_id' => 'compare_modal_backdrop',
14
+
'default_color' => 'rgba(18, 21, 25, 0.8)'
15
+
]);
16
+
17
+
$this->migrate_background_to_color([
18
+
'background_id' => 'product_compare_bar_background',
19
+
'default_color' => \Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT')
20
+
]);
21
+
}
22
+
23
+
private function migrate_background_to_color($args = []) {
24
+
$args = wp_parse_args($args, [
25
+
'background_id' => null,
26
+
'color_id' => null,
27
+
'default_color' => '#000000'
28
+
]);
29
+
30
+
// Same ID by default.
31
+
if (! $args['color_id']) {
32
+
$args['color_id'] = $args['background_id'];
33
+
}
34
+
35
+
$background = get_theme_mod($args['background_id'], '__empty__');
36
+
37
+
if (
38
+
$background === '__empty__'
39
+
||
40
+
! isset($background['backgroundColor'])
41
+
) {
42
+
return;
43
+
}
44
+
45
+
blocksy_print($background);
46
+
47
+
$next_color = $args['default_color'];
48
+
49
+
if (
50
+
! empty($background['backgroundColor'])
51
+
&&
52
+
! empty($background['backgroundColor']['default'])
53
+
&&
54
+
! empty($background['backgroundColor']['default']['color'])
55
+
) {
56
+
$next_color = $background['backgroundColor']['default']['color'];
57
+
}
58
+
59
+
set_theme_mod($args['color_id'], [
60
+
'default' => ['color' => $next_color]
61
+
]);
62
+
}
63
+
}
64
+