/var/www/html_it/wp-content/plugins/elementor/modules/atomic-widgets/styles/style-fonts.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php

namespace Elementor\Modules\AtomicWidgets\Styles;

use 
Elementor\Core\Base\Document;
use 
Elementor\Core\Breakpoints\Breakpoint;
use 
Elementor\Core\Utils\Collection;
use 
Elementor\Modules\AtomicWidgets\Memo;
use 
Elementor\Modules\AtomicWidgets\Cache_Validity;
use 
Elementor\Plugin;

if ( ! 
defined'ABSPATH' ) ) {
    exit; 
// Exit if accessed directly.
}

const 
FONTS_KEY_PREFIX 'elementor_atomic_styles_fonts-';

class 
Style_Fonts {
    private 
string $style_key;

    public function 
__constructstring $style_key ) {
        
$this->style_key $style_key;
    }

    public static function 
makestring $style_key ) {
        return new static( 
$style_key );
    }

    public function 
addstring $font ) {
        
$style_fonts $this->get_fonts();

        if ( ! 
in_array$font$style_fontstrue ) ) {
            
$style_fonts[] = $font;

            
$this->update_fonts$style_fonts );
        }
    }

    public function 
get(): array {
        return 
$this->get_fonts();
    }

    public function 
clear() {
        
$this->update_fonts( [] );
    }

    private function 
get_fonts(): array {
        
$style_fonts_key $this->get_key();
        return 
get_option$style_fonts_key, [] );
    }

    private function 
update_fonts( array $fonts ) {
        
$style_fonts_key $this->get_key();
        
update_option$style_fonts_key$fonts );
    }

    private function 
get_key(): string {
        return 
FONTS_KEY_PREFIX $this->style_key;
    }
}