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\Shortcodes\SiteReviewsSummaryShortcode; |
9
|
|
|
|
10
|
|
|
class ElementorSiteReviewsSummary extends ElementorWidget |
11
|
|
|
{ |
12
|
|
|
public function get_icon(): string |
13
|
|
|
{ |
14
|
|
|
return 'eicon-glsr-summary'; |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
public static function shortcodeClass(): string |
18
|
|
|
{ |
19
|
|
|
return SiteReviewsSummaryShortcode::class; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
protected function get_upsale_data(): array |
23
|
|
|
{ |
24
|
|
|
return [ |
25
|
|
|
'condition' => !glsr(License::class)->isPremium(), |
26
|
|
|
'description' => esc_html_x('Upgrade to Site Reviews Premium and get a bunch of additional features and professional support.', 'admin-text', 'site-reviews'), |
27
|
|
|
'image' => glsr()->url('assets/images/premium.svg'), |
28
|
|
|
'image_alt' => esc_attr_x('Upgrade', 'admin-text', 'site-reviews'), |
29
|
|
|
'upgrade_text' => esc_html_x('Upgrade Now', 'admin-text', 'site-reviews'), |
30
|
|
|
'upgrade_url' => glsr_premium_url('site-reviews-premium'), |
31
|
|
|
]; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
protected function styleConfig(): array |
35
|
|
|
{ |
36
|
|
|
return [ |
37
|
|
|
'style_preset' => [ |
38
|
|
|
'label' => esc_html_x('Style', 'admin-text', 'site-reviews'), |
39
|
|
|
'label_block' => false, |
40
|
|
|
'options' => [ |
41
|
|
|
'1' => esc_html_x('Style 1', 'admin-text', 'site-reviews'), |
42
|
|
|
'2' => esc_html_x('Style 2', 'admin-text', 'site-reviews'), |
43
|
|
|
'3' => esc_html_x('Style 3', 'admin-text', 'site-reviews'), |
44
|
|
|
], |
45
|
|
|
'placeholder' => esc_html_x('Default', 'admin-text', 'site-reviews'), |
46
|
|
|
'prefix_class' => 'is-style-', |
47
|
|
|
'type' => Controls_Manager::SELECT, |
48
|
|
|
], |
49
|
|
|
'style_align' => [ |
50
|
|
|
'label' => esc_html_x('Alignment', 'admin-text', 'site-reviews'), |
51
|
|
|
'label_block' => false, |
52
|
|
|
'default' => 'left', |
53
|
|
|
'options' => [ |
54
|
|
|
'left' => [ |
55
|
|
|
'icon' => 'eicon-flex eicon-align-start-h', |
56
|
|
|
'title' => esc_html_x('Start', 'admin-text', 'site-reviews'), |
57
|
|
|
], |
58
|
|
|
'center' => [ |
59
|
|
|
'icon' => 'eicon-flex eicon-align-center-h', |
60
|
|
|
'title' => esc_html_x('Center', 'admin-text', 'site-reviews'), |
61
|
|
|
], |
62
|
|
|
'right' => [ |
63
|
|
|
'icon' => 'eicon-flex eicon-align-end-h', |
64
|
|
|
'title' => esc_html_x('End', 'admin-text', 'site-reviews'), |
65
|
|
|
], |
66
|
|
|
], |
67
|
|
|
'prefix_class' => 'items-justified-', |
68
|
|
|
'selectors' => [ |
69
|
|
|
'{{WRAPPER}} .glsr-summary-text' => 'text-align: {{VALUE}};', |
70
|
|
|
], |
71
|
|
|
'type' => Controls_Manager::CHOOSE, |
72
|
|
|
], |
73
|
|
|
'style_max_width' => [ |
74
|
|
|
'default' => [ |
75
|
|
|
'unit' => '%', |
76
|
|
|
], |
77
|
|
|
'is_responsive' => true, |
78
|
|
|
'label' => esc_html_x('Max Width', 'admin-text', 'site-reviews'), |
79
|
|
|
'selectors' => [ |
80
|
|
|
'{{WRAPPER}}' => '--glsr-max-w: {{SIZE}}{{UNIT}};', |
81
|
|
|
], |
82
|
|
|
'size_units' => ['%', 'px', 'em', 'rem', 'custom'], |
83
|
|
|
'type' => Controls_Manager::SLIDER, |
84
|
|
|
], |
85
|
|
|
'style_rating_separator' => [ |
86
|
|
|
'label' => esc_html_x('Rating', 'admin-text', 'site-reviews'), |
87
|
|
|
'separator' => 'before', |
88
|
|
|
'type' => Controls_Manager::HEADING, |
89
|
|
|
], |
90
|
|
|
'style_rating_color' => [ |
91
|
|
|
'global' => [ |
92
|
|
|
'default' => '', |
93
|
|
|
], |
94
|
|
|
'label' => esc_html_x('Star Color', 'admin-text', 'site-reviews'), |
95
|
|
|
'label_block' => false, |
96
|
|
|
'selectors' => [ |
97
|
|
|
'{{WRAPPER}} .glsr:not([data-theme])' => '--glsr-summary-star-bg: {{VALUE}}', |
98
|
|
|
], |
99
|
|
|
'type' => Controls_Manager::COLOR, |
100
|
|
|
], |
101
|
|
|
'style_rating_size' => [ |
102
|
|
|
'is_responsive' => true, |
103
|
|
|
'label' => esc_html_x('Star Size', 'admin-text', 'site-reviews'), |
104
|
|
|
'selectors' => [ |
105
|
|
|
'{{WRAPPER}}' => '--glsr-summary-star: {{SIZE}}{{UNIT}};', |
106
|
|
|
], |
107
|
|
|
'size_units' => ['px', 'em', 'rem', 'custom'], |
108
|
|
|
'type' => Controls_Manager::SLIDER, |
109
|
|
|
], |
110
|
|
|
'style_rating_typography' => [ |
111
|
|
|
'label' => esc_html_x('Typography', 'admin-text', 'site-reviews'), |
112
|
|
|
'selector' => '{{WRAPPER}} .glsr-summary-rating', |
113
|
|
|
'type' => Group_Control_Typography::get_type(), |
114
|
|
|
], |
115
|
|
|
'style_text_separator' => [ |
116
|
|
|
'label' => esc_html_x('Text', 'admin-text', 'site-reviews'), |
117
|
|
|
'separator' => 'before', |
118
|
|
|
'type' => Controls_Manager::HEADING, |
119
|
|
|
], |
120
|
|
|
'style_text_typography' => [ |
121
|
|
|
'type' => 'typography', |
122
|
|
|
'label' => esc_html_x('Typography', 'admin-text', 'site-reviews'), |
123
|
|
|
'selector' => '{{WRAPPER}} .glsr-summary-text', |
124
|
|
|
], |
125
|
|
|
'style_bar_separator' => [ |
126
|
|
|
'label' => esc_html_x('Bars', 'admin-text', 'site-reviews'), |
127
|
|
|
'separator' => 'before', |
128
|
|
|
'type' => Controls_Manager::HEADING, |
129
|
|
|
], |
130
|
|
|
'style_bar_color' => [ |
131
|
|
|
'global' => [ |
132
|
|
|
'default' => '', |
133
|
|
|
], |
134
|
|
|
'label' => esc_html_x('Color', 'admin-text', 'site-reviews'), |
135
|
|
|
'label_block' => false, |
136
|
|
|
'selectors' => [ |
137
|
|
|
'{{WRAPPER}}' => '--glsr-bar-bg: {{VALUE}}', |
138
|
|
|
], |
139
|
|
|
'type' => Controls_Manager::COLOR, |
140
|
|
|
], |
141
|
|
|
'style_bar_gap' => [ |
142
|
|
|
'is_responsive' => true, |
143
|
|
|
'label' => esc_html_x('Gap', 'admin-text', 'site-reviews'), |
144
|
|
|
'selectors' => [ |
145
|
|
|
'{{WRAPPER}}' => '--glsr-bar-spacing: {{SIZE}}{{UNIT}};', |
146
|
|
|
], |
147
|
|
|
'size_units' => ['px', 'em', 'rem', 'custom'], |
148
|
|
|
'type' => Controls_Manager::SLIDER, |
149
|
|
|
], |
150
|
|
|
'style_bar_size' => [ |
151
|
|
|
'is_responsive' => true, |
152
|
|
|
'label' => esc_html_x('Percent Bar Height', 'admin-text', 'site-reviews'), |
153
|
|
|
'selectors' => [ |
154
|
|
|
'{{WRAPPER}}' => '--glsr-bar-size: {{SIZE}}{{UNIT}};', |
155
|
|
|
], |
156
|
|
|
'size_units' => ['px', 'em', 'rem', 'custom'], |
157
|
|
|
'type' => Controls_Manager::SLIDER, |
158
|
|
|
], |
159
|
|
|
'style_bar_typography' => [ |
160
|
|
|
'label' => esc_html_x('Typography', 'admin-text', 'site-reviews'), |
161
|
|
|
'selector' => '{{WRAPPER}} .glsr-summary-percentages', |
162
|
|
|
'type' => Group_Control_Typography::get_type(), |
163
|
|
|
], |
164
|
|
|
]; |
165
|
|
|
} |
166
|
|
|
} |
167
|
|
|
|