Test Failed
Push — develop ( dc58b8...641a3a )
by Paul
10:23
created

ElementorSiteReview::get_upsale_data()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Elementor\Widgets;
4
5
use Elementor\Controls_Manager;
6
use Elementor\Group_Control_Typography;
7
use GeminiLabs\SiteReviews\License;
8
use GeminiLabs\SiteReviews\Review;
9
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewShortcode;
10
11
class ElementorSiteReview extends ElementorWidget
12
{
13
    public function get_icon(): string
14
    {
15
        return 'eicon-glsr-review';
16
    }
17
18
    public static function shortcodeClass(): string
19
    {
20
        return SiteReviewShortcode::class;
21
    }
22
23
    protected function get_upsale_data(): array
24
    {
25
        return [
26
            'condition' => !glsr(License::class)->isPremium(),
27
            'description' => esc_html_x('Upgrade to Site Reviews Premium and get a bunch of additional features and professional support.', 'admin-text', 'site-reviews'),
28
            'image' => glsr()->url('assets/images/premium.svg'),
29
            'image_alt' => esc_attr_x('Upgrade', 'admin-text', 'site-reviews'),
30
            'upgrade_text' => esc_html_x('Upgrade Now', 'admin-text', 'site-reviews'),
31
            'upgrade_url' => glsr_premium_url('site-reviews-premium'),
32
        ];
33
    }
34
35
    protected function styleConfig(): array
36
    {
37
        return [
38
            'style_align' => [
39
                'label' => esc_html_x('Alignment', 'admin-text', 'site-reviews'),
40
                'label_block' => false,
41
                'default' => 'left',
42
                'options' => [
43
                    'left' => [
44
                        'icon' => 'eicon-flex eicon-align-start-h',
45
                        'title' => esc_html_x('Start', 'admin-text', 'site-reviews'),
46
                    ],
47
                    'center' => [
48
                        'icon' => 'eicon-flex eicon-align-center-h',
49
                        'title' => esc_html_x('Center', 'admin-text', 'site-reviews'),
50
                    ],
51
                    'right' => [
52
                        'icon' => 'eicon-flex eicon-align-end-h',
53
                        'title' => esc_html_x('End', 'admin-text', 'site-reviews'),
54
                    ],
55
                ],
56
                'prefix_class' => 'items-justified-',
57
                'selectors' => [
58
                    '{{WRAPPER}} .glsr-summary-text' => 'text-align: {{VALUE}};',
59
                ],
60
                'type' => Controls_Manager::CHOOSE,
61
            ],
62
            'style_heading' => [
63
                'label' => esc_html_x('Heading', 'admin-text', 'site-reviews'),
64
                'selector' => '{{WRAPPER}} .glsr:not([data-theme]) h2, {{WRAPPER}} .glsr:not([data-theme]) h3, {{WRAPPER}} .glsr:not([data-theme]) h4',
65
                'type' => Group_Control_Typography::get_type(),
66
            ],
67
            'style_text' => [
68
                'label' => esc_html_x('Text', 'admin-text', 'site-reviews'),
69
                'selector' => '{{WRAPPER}} .glsr:not([data-theme])',
70
                'type' => Group_Control_Typography::get_type(),
71
            ],
72
            'style_rating_size' => [
73
                'is_responsive' => true,
74
                'label' => esc_html_x('Star Size', 'admin-text', 'site-reviews'),
75
                'selectors' => [
76
                    '{{WRAPPER}}' => '--glsr-review-star: {{SIZE}}{{UNIT}};',
77
                ],
78
                'size_units' => ['px', 'em', 'rem', 'custom'],
79
                'type' => Controls_Manager::SLIDER,
80
            ],
81
            'style_rating_color' => [
82
                'label' => esc_html_x('Star Color', 'admin-text', 'site-reviews'),
83
                'selectors' => [
84
                    '{{WRAPPER}} .glsr:not([data-theme])' => '--glsr-review-star-bg: {{VALUE}};',
85
                ],
86
                'type' => Controls_Manager::COLOR,
87
            ],
88
        ];
89
    }
90
}
91