PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.11.84
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.11.84
4.11.84 4.11.83 4.11.82 4.11.80 4.11.81 4.11.79 4.11.78 4.11.77 4.11.76 4.11.75 3.20.5 4.11.69 3.20.6 4.11.7 3.20.7 4.11.70 3.20.8 4.11.71 3.20.9 4.11.72 3.21.1 4.11.73 3.21.2 4.11.74 3.21.3 4.11.8 3.21.4 4.11.9 3.21.5 4.2.0 3.21.6 4.2.1 3.3.0 4.2.2 3.3.1 4.2.3 3.3.2 4.2.4 3.3.3 4.2.5 3.3.4 4.2.6 3.3.5 4.2.7 3.3.6 4.2.8 3.3.7 4.2.9 3.3.8 4.3.0 3.3.9 4.3.1 3.4.0 4.3.2 3.4.1 4.3.3 3.4.2 4.3.4 3.4.3 4.3.5 3.4.4 4.3.6 3.4.5 4.3.7 3.4.6 4.3.8 3.4.7 4.3.9 3.4.8 4.4.0 3.4.9 4.4.1 3.5.0 4.4.2 3.5.1 4.4.3 3.5.2 4.4.4 3.5.3 4.4.5 3.5.4 4.4.6 3.5.5 4.4.7 3.5.6 4.4.8 3.5.7 4.4.9 3.5.8 4.5.0 3.5.9 4.5.1 3.6.0 4.5.2 3.6.1 4.5.3 3.6.2 4.5.4 3.6.3 4.5.5 3.6.4 4.5.6 3.6.5 4.5.7 3.6.6 4.5.8 3.6.7 4.5.9 3.6.8 4.6.0 3.6.9 4.6.1 3.7.0 4.7.0 3.7.1 4.7.1 3.7.2 4.7.2 3.7.3 4.7.3 3.7.4 4.7.4 3.7.5 4.7.5 3.7.6 4.7.6 3.7.7 4.7.7 3.7.8 4.7.8 3.7.9 4.7.9 3.8.0 4.8.0 3.8.1 4.8.1 3.8.2 4.8.10 3.8.3 4.8.11 3.8.4 4.8.2 3.8.5 4.8.3 3.8.6 4.8.4 3.8.7 4.8.5 3.8.8 4.8.6 3.8.9 4.8.7 3.9.0 4.8.8 3.9.1 4.8.9 3.9.2 4.9.0 3.9.3 4.9.0-beta1 3.9.4 4.9.0-beta2 3.9.5 4.9.1 3.9.6 4.9.10 3.9.7 4.9.11 3.9.8 4.9.12 3.9.9 4.9.13 4.0.1 4.9.14 4.0.3 4.9.15 4.0.4 4.9.16 4.0.5 4.9.17 4.0.6 4.9.18 4.0.7 4.9.19 4.0.8 4.9.2 4.0.9 4.9.20 4.1.0 4.9.21 4.1.1 4.9.22 4.1.2 4.9.23 4.1.3 4.9.24 trunk 4.1.4 4.9.25 1.0 4.1.5 4.9.26 1.01 4.1.6 4.9.27 1.02 4.1.7 4.9.28 1.03 4.1.8 4.9.29 1.04 4.1.9 4.9.3 1.05 4.10.0 4.9.30 1.06 4.10.1 4.9.31 1.07 4.10.10 4.9.32 1.08 4.10.11 4.9.33 1.09 4.10.12 4.9.34 2.0 4.10.13 4.9.35 2.0.1 4.10.14 4.9.36 2.0.2 4.10.15 4.9.37 2.0.3 4.10.16 4.9.38 2.0.4 4.10.17 4.9.39 2.0.5 4.10.18 4.9.4 2.0.6 4.10.19 4.9.40 2.0.7 4.10.2 4.9.41 2.0.8 4.10.20 4.9.42 2.0.9 4.10.21 4.9.43 2.1.0 4.10.22 4.9.45 2.1.1 4.10.23 4.9.46 2.1.2 4.10.24 4.9.47 2.1.3 4.10.25 4.9.48 2.1.4 4.10.26 4.9.49 2.1.5 4.10.27 4.9.5 2.1.5-beta1 4.10.28 4.9.50 2.1.6 4.10.29 4.9.51 2.1.7 4.10.3 4.9.52 2.1.8 4.10.30 4.9.53 2.1.9 4.10.31 4.9.54 2.2.0 4.10.32 4.9.55 2.2.1 4.10.33 4.9.56 2.2.2 4.10.34 4.9.57 2.2.3 4.10.35 4.9.6 2.2.4 4.10.36 4.9.7 2.2.5 4.10.37 4.9.8 2.2.6 4.10.38 4.9.9 2.2.7 4.10.39 2.2.8 4.10.4 2.2.9 4.10.40 2.3.0 4.10.41 2.3.1 4.10.42 2.3.2 4.10.43 2.3.3 4.10.44 2.3.4 4.10.45 2.3.5 4.10.46 2.3.6 4.10.47 2.3.7 4.10.48 2.3.8 4.10.49 2.3.9 4.10.5 2.4.0 4.10.50 2.4.1 4.10.51 2.5.0 4.10.52 2.5.1 4.10.53 2.5.2 4.10.54 2.5.3 4.10.55 2.5.4 4.10.56 2.5.5 4.10.57 2.5.6 4.10.58 2.5.7 4.10.59 2.5.8 4.10.6 2.5.9 4.10.60 2.6.0 4.10.61 2.6.1 4.10.62 2.6.2 4.10.63 2.6.3 4.10.64 2.6.4 4.10.65 2.6.5 4.10.66 2.6.6 4.10.67 2.6.7 4.10.68 2.6.8 4.10.69 2.6.9 4.10.7 2.7.0 4.10.70 2.7.1 4.10.71 2.7.2 4.10.72 2.7.3 4.10.73 2.7.4 4.10.74 2.7.5 4.10.75 2.7.6 4.10.76 2.7.7 4.10.77 2.7.8 4.10.78 2.7.9 4.10.79 2.8.0 4.10.8 2.8.1 4.10.80 2.8.2 4.10.81 2.8.3 4.10.82 2.8.4 4.10.83 2.8.5 4.10.84 2.8.6 4.10.85 2.8.7 4.10.86 2.8.8 4.10.87 2.8.9 4.10.88 2.9.0 4.10.89 2.9.1 4.10.9 2.9.2 4.10.90 2.9.3 4.11.0 2.9.4 4.11.1 2.9.5 4.11.10 2.9.6 4.11.11 2.9.7 4.11.12 2.9.8 4.11.13 2.9.9 4.11.14 3.0.0 4.11.15 3.0.1 4.11.16 3.0.2 4.11.17 3.0.3 4.11.18 3.0.4 4.11.19 3.0.5 4.11.2 3.0.6 4.11.20 3.0.7 4.11.21 3.0.8 4.11.22 3.0.9 4.11.23 3.1.0 4.11.24 3.1.1 4.11.25 3.1.2 4.11.26 3.1.3 4.11.27 3.1.4 4.11.28 3.1.5 4.11.29 3.1.6 4.11.3 3.1.7 4.11.30 3.1.8 4.11.31 3.1.9 4.11.32 3.10.0 4.11.33 3.10.1 4.11.34 3.10.2 4.11.35 3.10.3 4.11.36 3.10.4 4.11.37 3.10.5 4.11.38 3.10.6 4.11.39 3.10.7 4.11.4 3.10.8 4.11.40 3.10.9 4.11.41 3.11.0 4.11.42 3.11.1 4.11.43 3.11.2 4.11.44 3.11.3 4.11.45 3.11.4 4.11.46 3.11.5 4.11.47 3.11.6 4.11.48 3.11.7 4.11.49 3.11.8 4.11.5 3.11.9 4.11.50 3.12.0 4.11.51 3.12.1 4.11.52 3.12.2 4.11.53 3.12.3 4.11.54 3.2.0 4.11.55 3.2.1 4.11.56 3.2.2 4.11.57 3.2.3 4.11.58 3.2.4 4.11.59 3.2.5 4.11.6 3.2.6 4.11.60 3.2.7 4.11.61 3.2.8 4.11.62 3.2.9 4.11.63 3.20.0 4.11.64 3.20.1 4.11.65 3.20.2 4.11.66 3.20.3 4.11.67 3.20.4 4.11.68
premium-addons-for-elementor / widgets / premium-countdown.php
premium-addons-for-elementor / widgets Last commit date
dep 3 weeks ago premium-banner.php 1 day ago premium-blog.php 2 weeks ago premium-button.php 2 weeks ago premium-carousel.php 2 weeks ago premium-contactform.php 2 weeks ago premium-countdown.php 2 weeks ago premium-counter.php 2 weeks ago premium-dual-header.php 2 weeks ago premium-fancytext.php 2 weeks ago premium-grid.php 2 weeks ago premium-icon-list.php 2 weeks ago premium-image-button.php 2 weeks ago premium-image-scroll.php 2 weeks ago premium-image-separator.php 2 weeks ago premium-lottie.php 2 weeks ago premium-maps.php 2 days ago premium-media-wheel.php 2 weeks ago premium-mobile-menu.php 2 weeks ago premium-modalbox.php 2 days ago premium-nav-menu.php 2 weeks ago premium-notifications.php 2 weeks ago premium-person.php 2 weeks ago premium-pinterest-feed.php 2 weeks ago premium-post-ticker.php 2 weeks ago premium-pricing-table.php 2 days ago premium-progressbar.php 2 weeks ago premium-search-form.php 2 days ago premium-svg-drawer.php 2 weeks ago premium-tcloud.php 2 weeks ago premium-testimonials.php 2 weeks ago premium-textual-showcase.php 2 weeks ago premium-tiktok-feed.php 2 weeks ago premium-title.php 2 days ago premium-videobox.php 2 weeks ago premium-vscroll.php 2 weeks ago premium-weather.php 2 weeks ago premium-world-clock.php 2 weeks ago
premium-countdown.php
1938 lines
1 <?php
2 /**
3 * Premium Countdown.
4 */
5
6 namespace PremiumAddons\Widgets;
7
8 // Elementor Classes.
9 use Elementor\Modules\DynamicTags\Module as TagsModule;
10 use Elementor\Plugin;
11 use Elementor\Widget_Base;
12 use Elementor\Controls_Manager;
13 use Elementor\Group_Control_Border;
14 use Elementor\Group_Control_Text_Shadow;
15 use Elementor\Group_Control_Typography;
16 use Elementor\Group_Control_Box_Shadow;
17 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
18 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
19
20 // PHP Classes.
21 use Datetime;
22 use DateTimeZone;
23
24 // PremiumAddons Classes.
25 use PremiumAddons\Includes\Helper_Functions;
26 use PremiumAddons\Includes\Controls\Premium_Background;
27
28 if ( ! defined( 'ABSPATH' ) ) {
29 exit; // Exit if accessed directly.
30 }
31
32 /**
33 * Class Premium_Countdown
34 */
35 class Premium_Countdown extends Widget_Base {
36
37 /**
38 * Retrieve Widget Name.
39 *
40 * @since 1.0.0
41 * @access public
42 */
43 public function get_name() {
44 return 'premium-countdown-timer';
45 }
46
47 /**
48 * Retrieve Widget Title.
49 *
50 * @since 1.0.0
51 * @access public
52 */
53 public function get_title() {
54 return __( 'Countdown', 'premium-addons-for-elementor' );
55 }
56
57 /**
58 * Retrieve Widget Icon.
59 *
60 * @since 1.0.0
61 * @access public
62 *
63 * @return string widget icon.
64 */
65 public function get_icon() {
66 return 'pa-countdown';
67 }
68
69 /**
70 * Widget preview refresh button.
71 *
72 * @since 1.0.0
73 * @access public
74 */
75 public function is_reload_preview_required() {
76 return true;
77 }
78
79 /**
80 * Retrieve Widget Dependent CSS.
81 *
82 * @since 1.0.0
83 * @access public
84 *
85 * @return array CSS style handles.
86 */
87 public function get_style_depends() {
88 return array(
89 'pa-glass',
90 'pa-flipclock',
91 'premium-addons',
92 );
93 }
94
95 /**
96 * Retrieve Widget Dependent JS.
97 *
98 * @since 1.0.0
99 * @access public
100 *
101 * @return array JS script handles.
102 */
103 public function get_script_depends() {
104 return array(
105 'pa-glass',
106 'countdown-translator',
107 'pa-countdown',
108 'pa-flipclock',
109 'premium-addons',
110 );
111 }
112
113 /**
114 * Retrieve Widget Keywords.
115 *
116 * @since 1.0.0
117 * @access public
118 *
119 * @return array Widget keywords.
120 */
121 public function get_keywords() {
122 return array( 'pa', 'premium', 'premium countdown', 'counter', 'time', 'event', 'timer' );
123 }
124
125 /**
126 * Retrieve Widget Categories.
127 *
128 * @since 1.5.1
129 * @access public
130 *
131 * @return array Widget categories.
132 */
133 public function get_categories() {
134 return array( 'premium-elements' );
135 }
136
137 /**
138 * Retrieve Widget Support URL.
139 *
140 * @access public
141 *
142 * @return string support URL.
143 */
144 public function get_custom_help_url() {
145 return 'https://premiumaddons.com/support/';
146 }
147
148 public function has_widget_inner_wrapper(): bool {
149 return ! Helper_Functions::check_elementor_experiment( 'e_optimized_markup' );
150 }
151
152 /**
153 * Register Countdown controls.
154 *
155 * @since 1.0.0
156 * @access protected
157 */
158 protected function register_controls() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
159
160 $papro_activated = Helper_Functions::check_papro_version();
161
162 $options = apply_filters(
163 'pa_countdown_options',
164 array(
165 'styles' => array(
166 'default' => __( 'Default', 'premium-addons-for-elementor' ),
167 'featured' => __( 'Featured Unit', 'premium-addons-for-elementor' ),
168 'circle' => __( 'Circle (Pro)', 'premium-addons-for-elementor' ),
169 'rotate' => __( 'Rotate (Pro)', 'premium-addons-for-elementor' ),
170 'flipping' => __( 'Flip (Pro)', 'premium-addons-for-elementor' ),
171 ),
172 'style_condition' => array( 'circle', 'rotate', 'flipping' ),
173 )
174 );
175
176 $this->start_controls_section(
177 'countdown_section',
178 array(
179 'label' => __( 'Countdown', 'premium-addons-for-elementor' ),
180 )
181 );
182
183 $demo = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-countdown-widget-2/', 'countdown', 'wp-editor', 'demo' );
184 Helper_Functions::add_templates_controls( $this, 'countdown', $demo );
185
186 $this->add_control(
187 'premium_countdown_type',
188 array(
189 'label' => __( 'Type', 'premium-addons-for-elementor' ),
190 'type' => Controls_Manager::SELECT,
191 'options' => array(
192 'fixed' => __( 'Fixed Timer', 'premium-addons-for-elementor' ),
193 'evergreen' => __( 'Evergreen Timer', 'premium-addons-for-elementor' ),
194 ),
195 'default' => 'fixed',
196 )
197 );
198
199 $this->add_control(
200 'premium_countdown_date_time',
201 array(
202 'label' => __( 'Due Date', 'premium-addons-for-elementor' ),
203 'description' => __( 'Date format is (yyyy/mm/dd). Time format is (hh:mm:ss). Example: 2020-01-01 09:30.', 'premium-addons-for-elementor' ),
204 'type' => Controls_Manager::DATE_TIME,
205 'picker_options' => array(
206 'format' => 'Ym/d H:m:s',
207 ),
208 'default' => gmdate( 'Y/m/d H:m:s', strtotime( '+ 2 Day' ) ),
209 'dynamic' => array(
210 'active' => true,
211 ),
212 'condition' => array(
213 'premium_countdown_type' => 'fixed',
214 ),
215 )
216 );
217
218 $this->add_control(
219 'premium_countdown_eve_days',
220 array(
221 'label' => __( 'Days', 'premium-addons-for-elementor' ),
222 'type' => Controls_Manager::NUMBER,
223 'min' => '0',
224 'dynamic' => array( 'active' => true ),
225 'render_type' => 'template',
226 'default' => 2,
227 'condition' => array(
228 'premium_countdown_type' => 'evergreen',
229 ),
230 )
231 );
232
233 $this->add_control(
234 'premium_countdown_eve_hours',
235 array(
236 'label' => __( 'Hours', 'premium-addons-for-elementor' ),
237 'type' => Controls_Manager::NUMBER,
238 'min' => '0',
239 'max' => '23',
240 'dynamic' => array( 'active' => true ),
241 'render_type' => 'template',
242 'default' => 3,
243 'condition' => array(
244 'premium_countdown_type' => 'evergreen',
245 ),
246 )
247 );
248
249 $this->add_control(
250 'premium_countdown_eve_min',
251 array(
252 'label' => __( 'Minutes', 'premium-addons-for-elementor' ),
253 'type' => Controls_Manager::NUMBER,
254 'min' => '0',
255 'max' => '59',
256 'dynamic' => array( 'active' => true ),
257 'render_type' => 'template',
258 'default' => 0,
259 'condition' => array(
260 'premium_countdown_type' => 'evergreen',
261 ),
262 )
263 );
264
265 $this->add_control(
266 'premium_countdown_eve_reset',
267 array(
268 'label' => __( 'Reset', 'premium-addons-for-elementor' ),
269 'type' => Controls_Manager::SWITCHER,
270 'condition' => array(
271 'premium_countdown_type' => 'evergreen',
272 ),
273 )
274 );
275
276 $this->add_control(
277 'premium_countdown_eve_reset_hours',
278 array(
279 'label' => __( 'Hours', 'premium-addons-for-elementor' ),
280 'type' => Controls_Manager::NUMBER,
281 'min' => '0',
282 'dynamic' => array( 'active' => true ),
283 'render_type' => 'template',
284 'default' => 24,
285 'condition' => array(
286 'premium_countdown_type' => 'evergreen',
287 'premium_countdown_eve_reset' => 'yes',
288 ),
289 )
290 );
291
292 $this->add_control(
293 'premium_countdown_eve_reset_min',
294 array(
295 'label' => __( 'Minutes', 'premium-addons-for-elementor' ),
296 'type' => Controls_Manager::NUMBER,
297 'min' => '0',
298 'max' => '59',
299 'dynamic' => array( 'active' => true ),
300 'render_type' => 'template',
301 'default' => 0,
302 'condition' => array(
303 'premium_countdown_type' => 'evergreen',
304 'premium_countdown_eve_reset' => 'yes',
305 ),
306 )
307 );
308
309 $this->add_control(
310 'timezone',
311 array(
312 'label' => __( 'Timezone', 'premium-addons-for-elementor' ),
313 'type' => Controls_Manager::SELECT,
314 'description' => __( 'Select the timezone to calculate the time left.', 'premium-addons-for-elementor' ),
315 'options' => array(
316 'wp-time' => __( 'WordPress Default', 'premium-addons-for-elementor' ),
317 'user-time' => __( 'User Local Time', 'premium-addons-for-elementor' ),
318 ),
319 'default' => 'wp-time',
320 )
321 );
322
323 $this->add_control(
324 'premium_countdown_units',
325 array(
326 'label' => __( 'Time Units', 'premium-addons-for-elementor' ),
327 'type' => Controls_Manager::SELECT2,
328 'description' => __( 'Select the time units that you want to display in countdown timer.', 'premium-addons-for-elementor' ),
329 'options' => array(
330 'Y' => __( 'Years', 'premium-addons-for-elementor' ),
331 'O' => __( 'Months', 'premium-addons-for-elementor' ),
332 'D' => __( 'Days', 'premium-addons-for-elementor' ),
333 'H' => __( 'Hours', 'premium-addons-for-elementor' ),
334 'M' => __( 'Minutes', 'premium-addons-for-elementor' ),
335 'S' => __( 'Seconds', 'premium-addons-for-elementor' ),
336 ),
337 'default' => array( 'D', 'H', 'M', 'S' ),
338 'multiple' => true,
339 'separator' => 'after',
340 'condition' => array(
341 'style!' => 'flipping',
342 ),
343 )
344 );
345
346 $this->end_controls_section();
347
348 $this->start_controls_section(
349 'display_options_section',
350 array(
351 'label' => __( 'Display Options', 'premium-addons-for-elementor' ),
352 )
353 );
354
355 $this->add_control(
356 'style',
357 array(
358 'label' => __( 'Style', 'premium-addons-for-elementor' ),
359 'type' => Controls_Manager::SELECT,
360 'options' => $options['styles'],
361 'default' => 'default',
362 )
363 );
364
365 $this->add_control(
366 'flip_language',
367 array(
368 'label' => __( 'Language', 'premium-addons-for-elementor' ),
369 'type' => Controls_Manager::SELECT,
370 'options' => array(
371 'english' => __( 'English', 'premium-addons-for-elementor' ),
372 'danish' => __( 'Danish', 'premium-addons-for-elementor' ),
373 'german' => __( 'German', 'premium-addons-for-elementor' ),
374 'spanish' => __( 'Spanish', 'premium-addons-for-elementor' ),
375 'finnish' => __( 'Finnish', 'premium-addons-for-elementor' ),
376 'french' => __( 'French', 'premium-addons-for-elementor' ),
377 'italian' => __( 'Italian', 'premium-addons-for-elementor' ),
378 'hebrew' => __( 'Hebrew', 'premium-addons-for-elementor' ),
379 'dutch' => __( 'Dutch', 'premium-addons-for-elementor' ),
380 'portuguese' => __( 'Portuguese', 'premium-addons-for-elementor' ),
381 'russian' => __( 'Russian', 'premium-addons-for-elementor' ),
382 'swedish' => __( 'Swedish', 'premium-addons-for-elementor' ),
383 'korean' => __( 'Korean', 'premium-addons-for-elementor' ),
384 'czech' => __( 'Czech', 'premium-addons-for-elementor' ),
385 'arabic' => __( 'Arabic', 'premium-addons-for-elementor' ),
386 'persian' => __( 'Persian', 'premium-addons-for-elementor' ),
387 'japanese' => __( 'Japanese', 'premium-addons-for-elementor' ),
388 'polish' => __( 'Polish', 'premium-addons-for-elementor' ),
389 'romanian' => __( 'Romanian', 'premium-addons-for-elementor' ),
390 'turkish' => __( 'Turkish', 'premium-addons-for-elementor' ),
391 'slovak' => __( 'Slovak', 'premium-addons-for-elementor' ),
392 'thai' => __( 'Thai', 'premium-addons-for-elementor' ),
393 'chinese' => __( 'Chinese', 'premium-addons-for-elementor' ),
394 'norwegian' => __( 'Norwegian', 'premium-addons-for-elementor' ),
395 'latvian' => __( 'Latvian', 'premium-addons-for-elementor' ),
396 ),
397 'default' => 'english',
398 )
399 );
400
401 $this->add_control(
402 'featured_unit',
403 array(
404 'label' => __( 'Featured Time Unit', 'premium-addons-for-elementor' ),
405 'type' => Controls_Manager::SELECT,
406 'options' => array(
407 '0' => __( 'Years', 'premium-addons-for-elementor' ),
408 '1' => __( 'Months', 'premium-addons-for-elementor' ),
409 '3' => __( 'Days', 'premium-addons-for-elementor' ),
410 '4' => __( 'Hours', 'premium-addons-for-elementor' ),
411 '5' => __( 'Minutes', 'premium-addons-for-elementor' ),
412 '6' => __( 'Seconds', 'premium-addons-for-elementor' ),
413 ),
414 'default' => '3',
415 'condition' => array(
416 'style' => 'featured',
417 ),
418 )
419 );
420
421 $this->add_responsive_control(
422 'featured_unit_size',
423 array(
424 'label' => __( 'Featured Unit Width (PX)', 'premium-addons-for-elementor' ),
425 'type' => Controls_Manager::SLIDER,
426 'range' => array(
427 'px' => array(
428 'min' => 1,
429 'max' => 300,
430 ),
431 ),
432 'selectors' => array(
433 '{{WRAPPER}} .countdown-section:first-child .countdown-amount' => 'width: {{SIZE}}px',
434 ),
435 'condition' => array(
436 'style' => 'featured',
437 ),
438 )
439 );
440
441 if ( ! $papro_activated ) {
442
443 $get_pro = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'countdown-widget', 'wp-editor', 'get-pro' );
444
445 $this->add_control(
446 'notification_notice',
447 array(
448 'type' => Controls_Manager::RAW_HTML,
449 'raw' => __( 'This option is available in Premium Addons Pro. ', 'premium-addons-for-elementor' ) . '<a href="' . esc_url( $get_pro ) . '" target="_blank">' . __( 'Upgrade now!', 'premium-addons-for-elementor' ) . '</a>',
450 'content_classes' => 'papro-upgrade-notice',
451 'condition' => array(
452 'style' => $options['style_condition'],
453 ),
454 )
455 );
456
457 }
458
459 $this->add_responsive_control(
460 'digit_size',
461 array(
462 'label' => __( 'Digit Size (px)', 'premium-addons-for-elementor' ),
463 'type' => Controls_Manager::SLIDER,
464 'range' => array(
465 'px' => array(
466 'min' => 1,
467 'max' => 200,
468 ),
469 ),
470 'default' => array(
471 'unit' => 'px',
472 'size' => 60,
473 ),
474 'render_type' => 'template',
475 'selectors' => array(
476 '{{WRAPPER}} .countdown-amount' => 'width: {{SIZE}}px; height: {{SIZE}}px;',
477 '{{WRAPPER}}.premium-countdown-block .countdown-period span' => 'width: {{SIZE}}px;',
478 '{{WRAPPER}} .premium-countdown-flipping .flip' => 'width: {{SIZE}}px;',
479 ),
480 )
481 );
482
483 $this->add_control(
484 'unit_inside_circle',
485 array(
486 'label' => __( 'Add Units Inside Digits', 'premium-addons-for-elementor' ),
487 'type' => Controls_Manager::SWITCHER,
488 'prefix_class' => 'premium-countdown-uinside-',
489 'render_type' => 'template',
490 'condition' => array(
491 'style!' => 'flipping',
492 ),
493 )
494 );
495
496 $this->add_control(
497 'unit_position',
498 array(
499 'label' => __( 'Time Units Position', 'premium-addons-for-elementor' ),
500 'type' => Controls_Manager::SELECT,
501 'options' => array(
502 'inline' => __( 'Inline', 'premium-addons-for-elementor' ),
503 'block' => __( 'Block', 'premium-addons-for-elementor' ),
504 ),
505 'prefix_class' => 'premium-countdown-',
506 'render_type' => 'template',
507 'default' => 'block',
508 'condition' => array(
509 'unit_inside_circle!' => 'yes',
510 ),
511 )
512 );
513
514 $this->add_responsive_control(
515 'units_valignment',
516 array(
517 'label' => __( 'Units Alignment', 'premium-addons-for-elementor' ),
518 'type' => Controls_Manager::CHOOSE,
519 'options' => array(
520 'flex-start' => array(
521 'title' => __( 'Top', 'premium-addons-for-elementor' ),
522 'icon' => 'eicon-arrow-up',
523 ),
524 'center' => array(
525 'title' => __( 'Center', 'premium-addons-for-elementor' ),
526 'icon' => 'eicon-text-align-justify',
527 ),
528 'flex-end' => array(
529 'title' => __( 'Bottom', 'premium-addons-for-elementor' ),
530 'icon' => 'eicon-arrow-down',
531 ),
532 ),
533 'default' => 'flex-end',
534 'toggle' => false,
535 'condition' => array(
536 'unit_position' => 'inline',
537 'unit_inside_circle!' => 'yes',
538 'style!' => 'circle',
539 ),
540 'selectors' => array(
541 '{{WRAPPER}}.premium-countdown-inline .countdown-section, {{WRAPPER}}.premium-countdown-inline .flip-unit-wrap' => 'align-items: {{VALUE}};',
542 ),
543 )
544 );
545
546 $this->add_control(
547 'premium_countdown_separator',
548 array(
549 'label' => __( 'Digits Separator', 'premium-addons-for-elementor' ),
550 'type' => Controls_Manager::SWITCHER,
551 'default' => 'yes',
552 'conditions' => array(
553 'relation' => 'or',
554 'terms' => array(
555 array(
556 'name' => 'unit_position',
557 'value' => 'block',
558 ),
559 array(
560 'name' => 'unit_inside_circle',
561 'value' => 'yes',
562 ),
563 ),
564 ),
565 )
566 );
567
568 $this->add_control(
569 'premium_countdown_separator_text',
570 array(
571 'label' => __( 'Separator Shape', 'premium-addons-for-elementor' ),
572 'type' => Controls_Manager::SELECT,
573 'options' => array(
574 ':' => __( 'Colon', 'premium-addons-for-elementor' ),
575 '.' => __( 'Dot', 'premium-addons-for-elementor' ),
576 'custom' => __( 'Custom', 'premium-addons-for-elementor' ),
577 ),
578 'default' => ':',
579 'conditions' => array(
580 'terms' => array(
581 array(
582 'name' => 'premium_countdown_separator',
583 'value' => 'yes',
584 ),
585 array(
586 'relation' => 'or',
587 'terms' => array(
588 array(
589 'name' => 'unit_position',
590 'value' => 'block',
591 ),
592 array(
593 'name' => 'unit_inside_circle',
594 'value' => 'yes',
595 ),
596 ),
597 ),
598 ),
599 ),
600 )
601 );
602
603 $this->add_control(
604 'custom_separator',
605 array(
606 'label' => __( 'Separator Text', 'premium-addons-for-elementor' ),
607 'type' => Controls_Manager::TEXT,
608 'conditions' => array(
609 'terms' => array(
610 array(
611 'name' => 'premium_countdown_separator',
612 'value' => 'yes',
613 ),
614 array(
615 'name' => 'premium_countdown_separator_text',
616 'value' => 'custom',
617 ),
618 array(
619 'relation' => 'or',
620 'terms' => array(
621 array(
622 'name' => 'unit_position',
623 'value' => 'block',
624 ),
625 array(
626 'name' => 'unit_inside_circle',
627 'value' => 'yes',
628 ),
629 ),
630 ),
631 ),
632 ),
633 'ai' => array(
634 'active' => false,
635 ),
636 )
637 );
638
639 $this->add_responsive_control(
640 'premium_countdown_align',
641 array(
642 'label' => __( 'Alignment', 'premium-addons-for-elementor' ),
643 'type' => Controls_Manager::CHOOSE,
644 'options' => array(
645 'left' => array(
646 'title' => __( 'Left', 'premium-addons-for-elementor' ),
647 'icon' => 'eicon-text-align-left',
648 ),
649 'center' => array(
650 'title' => __( 'Center', 'premium-addons-for-elementor' ),
651 'icon' => 'eicon-text-align-center',
652 ),
653 'right' => array(
654 'title' => __( 'Right', 'premium-addons-for-elementor' ),
655 'icon' => 'eicon-text-align-right',
656 ),
657 ),
658 'toggle' => false,
659 'default' => 'center',
660 'selectors' => array(
661 '{{WRAPPER}} .premium-countdown' => 'justify-content: {{VALUE}};',
662 ),
663 )
664 );
665
666 $this->end_controls_section();
667
668 $this->start_controls_section(
669 'expire_section',
670 array(
671 'label' => __( 'After Expire', 'premium-addons-for-elementor' ),
672 )
673 );
674
675 $this->add_control(
676 'expiration_type',
677 array(
678 'label' => __( 'Choose Action', 'premium-addons-for-elementor' ),
679 'label_block' => false,
680 'type' => Controls_Manager::SELECT,
681 'description' => __( 'Choose whether if you want to set a message or a redirect link or leave it as digits', 'premium-addons-for-elementor' ),
682 'options' => array(
683 'default' => __( 'Default', 'premium-addons-for-elementor' ),
684 'text' => __( 'Message', 'premium-addons-for-elementor' ),
685 'restart' => __( 'Restart', 'premium-addons-for-elementor' ),
686 'url' => __( 'Redirection Link', 'premium-addons-for-elementor' ),
687 ),
688 'default' => 'text',
689 )
690 );
691
692 $this->add_control(
693 'change_digits',
694 array(
695 'label' => __( 'Change Digits To', 'premium-addons-for-elementor' ),
696 'type' => Controls_Manager::SELECT,
697 'description' => __( 'Choose whether if you want to set a message or a redirect link or leave it as digits', 'premium-addons-for-elementor' ),
698 'options' => array(
699 'default' => __( 'None', 'premium-addons-for-elementor' ),
700 'dash' => __( 'Dash', 'premium-addons-for-elementor' ),
701 'done' => __( 'D-O-N-E', 'premium-addons-for-elementor' ),
702 ),
703 'default' => 'default',
704 'condition' => array(
705 'expiration_type' => 'default',
706 'style!' => 'flipping',
707 ),
708 )
709 );
710
711 $this->add_control(
712 'expiration_text',
713 array(
714 'label' => __( 'Text', 'premium-addons-for-elementor' ),
715 'type' => Controls_Manager::WYSIWYG,
716 'dynamic' => array( 'active' => true ),
717 'default' => __( 'Countdown Expired!', 'premium-addons-for-elementor' ),
718 'condition' => array(
719 'expiration_type' => 'text',
720 ),
721 )
722 );
723
724 $this->add_control(
725 'expiration_url',
726 array(
727 'label' => __( 'URL', 'premium-addons-for-elementor' ),
728 'type' => Controls_Manager::TEXT,
729 'dynamic' => array(
730 'active' => true,
731 'categories' => array(
732 TagsModule::POST_META_CATEGORY,
733 TagsModule::URL_CATEGORY,
734 ),
735 ),
736 'label_block' => true,
737 'condition' => array(
738 'expiration_type' => 'url',
739 ),
740 'ai' => array(
741 'active' => false,
742 ),
743 )
744 );
745
746 $this->add_control(
747 'restart_days',
748 array(
749 'label' => __( 'Days', 'premium-addons-for-elementor' ),
750 'type' => Controls_Manager::NUMBER,
751 'default' => 1,
752 'condition' => array(
753 'expiration_type' => 'restart',
754 ),
755 )
756 );
757
758 $this->add_control(
759 'restart_hours',
760 array(
761 'label' => __( 'Hours', 'premium-addons-for-elementor' ),
762 'type' => Controls_Manager::NUMBER,
763 'default' => 2,
764 'condition' => array(
765 'expiration_type' => 'restart',
766 ),
767 )
768 );
769
770 $this->add_control(
771 'restart_minutes',
772 array(
773 'label' => __( 'Minutes', 'premium-addons-for-elementor' ),
774 'type' => Controls_Manager::NUMBER,
775 'default' => 55,
776 'condition' => array(
777 'expiration_type' => 'restart',
778 ),
779 )
780 );
781
782 $this->add_control(
783 'restart_notice',
784 array(
785 'raw' => __( 'When the action is set to restart, all times will be calculated based on WordPress default timezone.', 'premium-addons-for-elementor' ),
786 'type' => Controls_Manager::RAW_HTML,
787 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
788 'condition' => array(
789 'expiration_type' => 'restart',
790 ),
791 )
792 );
793
794 $this->end_controls_section();
795
796 $this->start_controls_section(
797 'premium_countdown_transaltion',
798 array(
799 'label' => __( 'Strings Translation', 'premium-addons-for-elementor' ),
800 'condition' => array(
801 'style' => '',
802 ),
803 )
804 );
805
806 $this->add_control(
807 'premium_countdown_day_singular',
808 array(
809 'label' => __( 'Day (Singular)', 'premium-addons-for-elementor' ),
810 'type' => Controls_Manager::TEXT,
811 'dynamic' => array( 'active' => true ),
812 'default' => 'Day',
813 )
814 );
815
816 $this->add_control(
817 'premium_countdown_day_plural',
818 array(
819 'label' => __( 'Day (Plural)', 'premium-addons-for-elementor' ),
820 'type' => Controls_Manager::TEXT,
821 'dynamic' => array( 'active' => true ),
822 'default' => 'Days',
823 )
824 );
825
826 $this->add_control(
827 'premium_countdown_month_singular',
828 array(
829 'label' => __( 'Month (Singular)', 'premium-addons-for-elementor' ),
830 'type' => Controls_Manager::TEXT,
831 'dynamic' => array( 'active' => true ),
832 'default' => 'Month',
833 )
834 );
835
836 $this->add_control(
837 'premium_countdown_month_plural',
838 array(
839 'label' => __( 'Months (Plural)', 'premium-addons-for-elementor' ),
840 'type' => Controls_Manager::TEXT,
841 'dynamic' => array( 'active' => true ),
842 'default' => 'Months',
843 )
844 );
845
846 $this->add_control(
847 'premium_countdown_year_singular',
848 array(
849 'label' => __( 'Year (Singular)', 'premium-addons-for-elementor' ),
850 'type' => Controls_Manager::TEXT,
851 'dynamic' => array( 'active' => true ),
852 'default' => 'Year',
853 )
854 );
855
856 $this->add_control(
857 'premium_countdown_year_plural',
858 array(
859 'label' => __( 'Years (Plural)', 'premium-addons-for-elementor' ),
860 'type' => Controls_Manager::TEXT,
861 'dynamic' => array( 'active' => true ),
862 'default' => 'Years',
863 )
864 );
865
866 $this->add_control(
867 'premium_countdown_hour_singular',
868 array(
869 'label' => __( 'Hour (Singular)', 'premium-addons-for-elementor' ),
870 'type' => Controls_Manager::TEXT,
871 'dynamic' => array( 'active' => true ),
872 'default' => 'Hour',
873 )
874 );
875
876 $this->add_control(
877 'premium_countdown_hour_plural',
878 array(
879 'label' => __( 'Hours (Plural)', 'premium-addons-for-elementor' ),
880 'type' => Controls_Manager::TEXT,
881 'dynamic' => array( 'active' => true ),
882 'default' => 'Hours',
883 )
884 );
885
886 $this->add_control(
887 'premium_countdown_minute_singular',
888 array(
889 'label' => __( 'Minute (Singular)', 'premium-addons-for-elementor' ),
890 'type' => Controls_Manager::TEXT,
891 'dynamic' => array( 'active' => true ),
892 'default' => 'Minute',
893 )
894 );
895
896 $this->add_control(
897 'premium_countdown_minute_plural',
898 array(
899 'label' => __( 'Minutes (Plural)', 'premium-addons-for-elementor' ),
900 'type' => Controls_Manager::TEXT,
901 'dynamic' => array( 'active' => true ),
902 'default' => 'Minutes',
903 )
904 );
905
906 $this->add_control(
907 'premium_countdown_second_singular',
908 array(
909 'label' => __( 'Second (Singular)', 'premium-addons-for-elementor' ),
910 'type' => Controls_Manager::TEXT,
911 'dynamic' => array( 'active' => true ),
912 'default' => 'Second',
913 )
914 );
915
916 $this->add_control(
917 'premium_countdown_second_plural',
918 array(
919 'label' => __( 'Seconds (Plural)', 'premium-addons-for-elementor' ),
920 'type' => Controls_Manager::TEXT,
921 'dynamic' => array( 'active' => true ),
922 'default' => 'Seconds',
923 )
924 );
925
926 $this->end_controls_section();
927
928 $this->start_controls_section(
929 'section_pa_docs',
930 array(
931 'label' => __( 'Help & Docs', 'premium-addons-for-elementor' ),
932 )
933 );
934
935 $doc1_url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/elementor-countdown-widget-tutorial/', 'countdown-widget', 'wp-editor', 'get-support' );
936
937 $this->add_control(
938 'doc_1',
939 array(
940 'type' => Controls_Manager::RAW_HTML,
941 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc1_url, __( 'Getting started »', 'premium-addons-for-elementor' ) ),
942 'content_classes' => 'editor-pa-doc',
943 )
944 );
945
946 Helper_Functions::register_element_feedback_controls( $this );
947
948 $this->end_controls_section();
949
950 Helper_Functions::register_papro_promotion_controls( $this, 'countdown' );
951
952 $this->start_controls_section(
953 'premium_countdown_typhography',
954 array(
955 'label' => __( 'Digits', 'premium-addons-for-elementor' ),
956 'tab' => Controls_Manager::TAB_STYLE,
957 )
958 );
959
960 $this->add_control(
961 'premium_countdown_digit_color',
962 array(
963 'label' => __( 'Color', 'premium-addons-for-elementor' ),
964 'type' => Controls_Manager::COLOR,
965 'global' => array(
966 'default' => Global_Colors::COLOR_SECONDARY,
967 ),
968 'selectors' => array(
969 '{{WRAPPER}} .countdown-amount, {{WRAPPER}} .inn' => 'color: {{VALUE}};',
970 ),
971 )
972 );
973
974 $this->add_control(
975 'circle_stroke_color',
976 array(
977 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ),
978 'type' => Controls_Manager::COLOR,
979 'selectors' => array(
980 '{{WRAPPER}} .countdown-svg path' => 'stroke: {{VALUE}};',
981 ),
982 'condition' => array(
983 'style' => 'circle',
984 ),
985 )
986 );
987
988 $this->add_responsive_control(
989 'circle_stroke_width',
990 array(
991 'label' => __( 'Stroke Width (px)', 'premium-addons-for-elementor' ),
992 'type' => Controls_Manager::SLIDER,
993 'range' => array(
994 'px' => array(
995 'min' => 1,
996 'max' => 15,
997 ),
998 ),
999 'default' => array(
1000 'unit' => 'px',
1001 'size' => 4,
1002 ),
1003 'render_type' => 'template',
1004 'selectors' => array(
1005 '{{WRAPPER}} .countdown-svg path' => 'stroke-width: {{SIZE}}px',
1006 '{{WRAPPER}}' => '--pa-countdown-stroke-width: {{SIZE}}',
1007 ),
1008 'condition' => array(
1009 'style' => 'circle',
1010 ),
1011 )
1012 );
1013
1014 $this->add_group_control(
1015 Group_Control_Typography::get_type(),
1016 array(
1017 'name' => 'premium_countdown_digit_typo',
1018 'global' => array(
1019 'default' => Global_Typography::TYPOGRAPHY_TEXT,
1020 ),
1021 'selector' => '{{WRAPPER}} .countdown-amount, {{WRAPPER}} .inn',
1022 )
1023 );
1024
1025 $this->add_group_control(
1026 Premium_Background::get_type(),
1027 array(
1028 'name' => 'premium_countdown_timer_digit_bg',
1029 'types' => array( 'classic', 'gradient' ),
1030 'selector' => '{{WRAPPER}} .countdown-amount, {{WRAPPER}} .inn',
1031 'fields_options' => array(
1032 'background' => array(
1033 'default' => 'classic',
1034 ),
1035 'color' => array(
1036 'global' => array(
1037 'default' => Global_Colors::COLOR_PRIMARY,
1038 ),
1039 ),
1040 ),
1041 )
1042 );
1043
1044 $this->add_control(
1045 'digts_lq_effect',
1046 array(
1047 'label' => __( 'Liquid Glass Effect', 'premium-addons-for-elementor' ),
1048 'type' => Controls_Manager::SELECT,
1049 'description' => sprintf(
1050 /* translators: 1: `<a>` opening tag, 2: `</a>` closing tag. */
1051 esc_html__( 'Important: Make sure this element has a semi-transparent background color to see the effect. See all presets from %1$shere%2$s.', 'premium-addons-for-elementor' ),
1052 '<a href="https://premiumaddons.com/liquid-glass/" target="_blank">',
1053 '</a>'
1054 ),
1055 'options' => array(
1056 'none' => __( 'None', 'premium-addons-for-elementor' ),
1057 'glass1' => __( 'Preset 01', 'premium-addons-for-elementor' ),
1058 'glass2' => __( 'Preset 02', 'premium-addons-for-elementor' ),
1059 'glass3' => apply_filters( 'pa_pro_label', __( 'Preset 03 (Pro)', 'premium-addons-for-elementor' ) ),
1060 'glass4' => apply_filters( 'pa_pro_label', __( 'Preset 04 (Pro)', 'premium-addons-for-elementor' ) ),
1061 'glass5' => apply_filters( 'pa_pro_label', __( 'Preset 05 (Pro)', 'premium-addons-for-elementor' ) ),
1062 'glass6' => apply_filters( 'pa_pro_label', __( 'Preset 06 (Pro)', 'premium-addons-for-elementor' ) ),
1063 ),
1064 'prefix_class' => 'premium-lq__',
1065 'default' => 'none',
1066 'label_block' => true,
1067 'render_type' => 'template',
1068 'condition' => array(
1069 'style!' => 'flipping',
1070 ),
1071 )
1072 );
1073
1074 $this->add_control(
1075 'flip_separator_color',
1076 array(
1077 'label' => __( 'Separator Color', 'premium-addons-for-elementor' ),
1078 'type' => Controls_Manager::COLOR,
1079 'selectors' => array(
1080 '{{WRAPPER}} .flip-clock-wrapper div.up::after' => 'background-color: {{VALUE}};',
1081 ),
1082 'condition' => array(
1083 'style' => 'flipping',
1084 ),
1085 )
1086 );
1087
1088 $this->add_group_control(
1089 Group_Control_Text_Shadow::get_type(),
1090 array(
1091 'name' => 'digits_shadow',
1092 'selector' => '{{WRAPPER}} .countdown-amount span, {{WRAPPER}} .inn',
1093
1094 )
1095 );
1096
1097 $this->add_group_control(
1098 Group_Control_Box_Shadow::get_type(),
1099 array(
1100 'name' => 'premium_countdown_units_shadow',
1101 'selector' => '{{WRAPPER}} .countdown-amount, {{WRAPPER}} .flip',
1102 )
1103 );
1104
1105 $this->add_group_control(
1106 Group_Control_Border::get_type(),
1107 array(
1108 'name' => 'premium_countdown_digits_border',
1109 'selector' => '{{WRAPPER}} .countdown-amount, {{WRAPPER}} .premium-countdown-figure, {{WRAPPER}} .flip',
1110 'condition' => array(
1111 'style!' => 'circle',
1112 ),
1113 )
1114 );
1115
1116 $this->add_control(
1117 'premium_countdown_digit_border_radius',
1118 array(
1119 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1120 'type' => Controls_Manager::SLIDER,
1121 'size_units' => array( 'px', '%', 'em' ),
1122 'selectors' => array(
1123 '{{WRAPPER}} .countdown-amount, {{WRAPPER}} .flip' => 'border-radius: {{SIZE}}{{UNIT}};',
1124 ),
1125 'condition' => array(
1126 'style!' => 'circle',
1127 'digit_adv_radius!' => 'yes',
1128 ),
1129 )
1130 );
1131
1132 $this->add_control(
1133 'digit_adv_radius',
1134 array(
1135 'label' => __( 'Advanced Border Radius', 'premium-addons-for-elementor' ),
1136 'type' => Controls_Manager::SWITCHER,
1137 'description' => __( 'Apply custom radius values. Get the radius value from ', 'premium-addons-for-elementor' ) . '<a href="https://9elements.github.io/fancy-border-radius/" target="_blank">here</a>' . __( '. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=S0BJazLHV-M" target="_blank">tutorial</a>',
1138 'condition' => array(
1139 'style!' => 'circle',
1140 ),
1141 )
1142 );
1143
1144 $this->add_control(
1145 'digit_adv_radius_value',
1146 array(
1147 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1148 'type' => Controls_Manager::TEXT,
1149 'dynamic' => array( 'active' => true ),
1150 'selectors' => array(
1151 '{{WRAPPER}} .countdown-amount, {{WRAPPER}} .flip' => 'border-radius: {{VALUE}};',
1152 ),
1153 'condition' => array(
1154 'style!' => 'circle',
1155 'digit_adv_radius' => 'yes',
1156 ),
1157 'ai' => array(
1158 'active' => false,
1159 ),
1160 )
1161 );
1162
1163 $this->add_responsive_control(
1164 'digits_margin',
1165 array(
1166 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1167 'type' => Controls_Manager::DIMENSIONS,
1168 'size_units' => array( 'px', '%', 'em' ),
1169 'selectors' => array(
1170 '{{WRAPPER}} .flip' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1171 ),
1172 'condition' => array(
1173 'style' => 'flipping',
1174 ),
1175 )
1176 );
1177
1178 $this->add_responsive_control(
1179 'digits_padding',
1180 array(
1181 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1182 'type' => Controls_Manager::DIMENSIONS,
1183 'size_units' => array( 'px', '%', 'em' ),
1184 'selectors' => array(
1185 '{{WRAPPER}} .countdown-amount' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1186 ),
1187 'condition' => array(
1188 'style!' => 'flipping',
1189 ),
1190 )
1191 );
1192
1193 $this->end_controls_section();
1194
1195 $this->start_controls_section(
1196 'premium_countdown_unit_style',
1197 array(
1198 'label' => __( 'Units', 'premium-addons-for-elementor' ),
1199 'tab' => Controls_Manager::TAB_STYLE,
1200 )
1201 );
1202
1203 $this->add_control(
1204 'premium_countdown_unit_color',
1205 array(
1206 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1207 'type' => Controls_Manager::COLOR,
1208 'global' => array(
1209 'default' => Global_Colors::COLOR_SECONDARY,
1210 ),
1211 'selectors' => array(
1212 '{{WRAPPER}} .countdown-period, {{WRAPPER}} .premium-countdown-label, {{WRAPPER}} .flip-clock-label' => 'color: {{VALUE}};',
1213 ),
1214 )
1215 );
1216
1217 $this->add_group_control(
1218 Group_Control_Typography::get_type(),
1219 array(
1220 'name' => 'premium_countdown_unit_typo',
1221 'global' => array(
1222 'default' => Global_Typography::TYPOGRAPHY_SECONDARY,
1223 ),
1224 'selector' => '{{WRAPPER}} .countdown-period, {{WRAPPER}} .premium-countdown-label, {{WRAPPER}} .flip-clock-label',
1225 )
1226 );
1227
1228 $this->add_control(
1229 'premium_countdown_unit_backcolor',
1230 array(
1231 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
1232 'type' => Controls_Manager::COLOR,
1233 'selectors' => array(
1234 '{{WRAPPER}} .countdown-period span, {{WRAPPER}} .premium-countdown-label, {{WRAPPER}} .flip-unit' => 'background-color: {{VALUE}};',
1235 ),
1236 )
1237 );
1238
1239 $this->add_group_control(
1240 Group_Control_Border::get_type(),
1241 array(
1242 'name' => 'premium_countdown_units_border',
1243 'selector' => '{{WRAPPER}} .countdown-period span, {{WRAPPER}} .premium-countdown-label, {{WRAPPER}} .flip-unit',
1244 )
1245 );
1246
1247 $this->add_control(
1248 'premium_countdown_units_border_radius',
1249 array(
1250 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1251 'type' => Controls_Manager::SLIDER,
1252 'size_units' => array( 'px', '%', 'em' ),
1253 'selectors' => array(
1254 '{WRAPPER}} .countdown-period span, {{WRAPPER}} .premium-countdown-label, {{WRAPPER}} .flip-unit' => 'border-radius: {{SIZE}}{{UNIT}};',
1255 ),
1256 )
1257 );
1258
1259 $this->add_group_control(
1260 Group_Control_Text_Shadow::get_type(),
1261 array(
1262 'name' => 'units_shadow',
1263 'selector' => '{{WRAPPER}} .countdown-period span, {{WRAPPER}} .flip-clock-label',
1264
1265 )
1266 );
1267
1268 $this->add_responsive_control(
1269 'units_margin',
1270 array(
1271 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1272 'type' => Controls_Manager::DIMENSIONS,
1273 'size_units' => array( 'px', 'em', '%' ),
1274 'selectors' => array(
1275 '{{WRAPPER}} .countdown-period, {{WRAPPER}} .premium-countdown-label, {{WRAPPER}} .flip-unit' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1276 ),
1277 )
1278 );
1279
1280 $this->add_responsive_control(
1281 'units_padding',
1282 array(
1283 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1284 'type' => Controls_Manager::DIMENSIONS,
1285 'size_units' => array( 'px', 'em', '%' ),
1286 'selectors' => array(
1287 '{{WRAPPER}} .countdown-period span, {{WRAPPER}} .premium-countdown-label, {{WRAPPER}} .flip-unit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1288 ),
1289 )
1290 );
1291
1292 $this->end_controls_section();
1293
1294 $this->start_controls_section(
1295 'featured_unit_style',
1296 array(
1297 'label' => __( 'Featured Unit', 'premium-addons-for-elementor' ),
1298 'tab' => Controls_Manager::TAB_STYLE,
1299 'condition' => array(
1300 'style' => 'featured',
1301 ),
1302 )
1303 );
1304
1305 $this->add_control(
1306 'featured_digit_color',
1307 array(
1308 'label' => __( 'Digit Color', 'premium-addons-for-elementor' ),
1309 'type' => Controls_Manager::COLOR,
1310 'selectors' => array(
1311 '{{WRAPPER}} .countdown-section:first-child .countdown-amount' => 'color: {{VALUE}};',
1312 ),
1313 )
1314 );
1315
1316 $this->add_group_control(
1317 Group_Control_Typography::get_type(),
1318 array(
1319 'name' => 'featured_digit_typo',
1320 'label' => __( 'Digit Typography', 'premium-addons-for-elementor' ),
1321 'selector' => '{{WRAPPER}} .countdown-section:first-child .countdown-amount',
1322 )
1323 );
1324
1325 $this->add_control(
1326 'featured_unit_color',
1327 array(
1328 'label' => __( 'Unit Color', 'premium-addons-for-elementor' ),
1329 'type' => Controls_Manager::COLOR,
1330 'selectors' => array(
1331 '{{WRAPPER}} .countdown-section:first-child .countdown-period' => 'color: {{VALUE}};',
1332 ),
1333 )
1334 );
1335
1336 $this->add_group_control(
1337 Group_Control_Typography::get_type(),
1338 array(
1339 'name' => 'featured_unit_typo',
1340 'label' => __( 'Unit Typography', 'premium-addons-for-elementor' ),
1341 'selector' => '{{WRAPPER}} .countdown-section:first-child .countdown-period',
1342 )
1343 );
1344
1345 $this->add_responsive_control(
1346 'featured_unit_spacing',
1347 array(
1348 'label' => __( 'Spacing', 'premium-addons-for-elementor' ),
1349 'type' => Controls_Manager::SLIDER,
1350 'size_units' => array( 'px', 'em', '%' ),
1351 'selectors' => array(
1352 '{{WRAPPER}} .countdown-section:first-child .countdown-period' => 'margin-top: {{SIZE}}{{UNIT}}',
1353 ),
1354 )
1355 );
1356
1357 $this->add_responsive_control(
1358 'featured_digit_padding',
1359 array(
1360 'label' => __( 'Digit Padding', 'premium-addons-for-elementor' ),
1361 'type' => Controls_Manager::DIMENSIONS,
1362 'size_units' => array( 'px', 'em', '%' ),
1363 'selectors' => array(
1364 '{{WRAPPER}} .countdown-section:first-child .countdown-amount' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1365 ),
1366 )
1367 );
1368
1369 $this->end_controls_section();
1370
1371 $this->start_controls_section(
1372 'premium_countdown_separator_style',
1373 array(
1374 'label' => __( 'Separator', 'premium-addons-for-elementor' ),
1375 'tab' => Controls_Manager::TAB_STYLE,
1376 'conditions' => array(
1377 'terms' => array(
1378 array(
1379 'name' => 'premium_countdown_separator',
1380 'value' => 'yes',
1381 ),
1382 array(
1383 'relation' => 'or',
1384 'terms' => array(
1385 array(
1386 'name' => 'unit_position',
1387 'value' => 'block',
1388 ),
1389 array(
1390 'name' => 'unit_inside_circle',
1391 'value' => 'yes',
1392 ),
1393 ),
1394 ),
1395 ),
1396 ),
1397 )
1398 );
1399
1400 $this->add_control(
1401 'premium_countdown_separator_color',
1402 array(
1403 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1404 'type' => Controls_Manager::COLOR,
1405 'global' => array(
1406 'default' => Global_Colors::COLOR_SECONDARY,
1407 ),
1408 'selectors' => array(
1409 '{{WRAPPER}} .countdown_separator' => 'color: {{VALUE}};',
1410 '{{WRAPPER}} .countdown-separator-circle' => 'background-color: {{VALUE}};',
1411 ),
1412 )
1413 );
1414
1415 $this->add_responsive_control(
1416 'premium_countdown_separator_size',
1417 array(
1418 'label' => __( 'Size', 'premium-addons-for-elementor' ),
1419 'type' => Controls_Manager::SLIDER,
1420 'range' => array(
1421 'px' => array(
1422 'min' => 1,
1423 'max' => 100,
1424 ),
1425 ),
1426 'selectors' => array(
1427 '{{WRAPPER}} .countdown_separator' => 'font-size: {{SIZE}}px;',
1428 '{{WRAPPER}} .countdown-separator-circle' => 'width: {{SIZE}}px; height: {{SIZE}}px;',
1429 ),
1430 )
1431 );
1432
1433 $this->add_responsive_control(
1434 'separator_spacing',
1435 array(
1436 'label' => __( 'Spacing', 'premium-addons-for-elementor' ),
1437 'type' => Controls_Manager::SLIDER,
1438 'size_units' => array( 'px', 'em' ),
1439 'selectors' => array(
1440 '{{WRAPPER}} .countdown_separator' => 'margin-right: {{SIZE}}{{UNIT}}; margin-left: {{SIZE}}{{UNIT}};',
1441 ),
1442 )
1443 );
1444
1445 $this->end_controls_section();
1446
1447 $this->start_controls_section(
1448 'boxes_style',
1449 array(
1450 'label' => __( 'Boxes', 'premium-addons-for-elementor' ),
1451 'tab' => Controls_Manager::TAB_STYLE,
1452 )
1453 );
1454
1455 $this->add_control(
1456 'boxes_bg_color',
1457 array(
1458 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
1459 'type' => Controls_Manager::COLOR,
1460 'selectors' => array(
1461 '{{WRAPPER}} .countdown-section, {{WRAPPER}} .flip-unit-wrap' => 'background-color: {{VALUE}};',
1462 ),
1463 )
1464 );
1465
1466 $this->add_group_control(
1467 Group_Control_Box_Shadow::get_type(),
1468 array(
1469 'name' => 'boxes_shadow',
1470 'selector' => '{{WRAPPER}} .countdown-section, {{WRAPPER}} .flip-unit-wrap',
1471 )
1472 );
1473
1474 $this->add_group_control(
1475 Group_Control_Border::get_type(),
1476 array(
1477 'name' => 'boxes_border',
1478 'selector' => '{{WRAPPER}} .countdown-section, {{WRAPPER}} .flip-unit-wrap',
1479 )
1480 );
1481
1482 $this->add_control(
1483 'boxes_border_radius',
1484 array(
1485 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1486 'type' => Controls_Manager::SLIDER,
1487 'size_units' => array( 'px', '%', 'em' ),
1488 'selectors' => array(
1489 '{{WRAPPER}} .countdown-section, {{WRAPPER}} .flip-unit-wrap' => 'border-radius: {{SIZE}}{{UNIT}};',
1490 ),
1491 'condition' => array(
1492 'boxes_adv_radius!' => 'yes',
1493 ),
1494 )
1495 );
1496
1497 $this->add_control(
1498 'boxes_adv_radius',
1499 array(
1500 'label' => __( 'Advanced Border Radius', 'premium-addons-for-elementor' ),
1501 'type' => Controls_Manager::SWITCHER,
1502 'description' => __( 'Apply custom radius values. Get the radius value from ', 'premium-addons-for-elementor' ) . '<a href="https://9elements.github.io/fancy-border-radius/" target="_blank">here</a>' . __( '. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=S0BJazLHV-M" target="_blank">tutorial</a>',
1503 )
1504 );
1505
1506 $this->add_control(
1507 'boxes_adv_radius_value',
1508 array(
1509 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1510 'type' => Controls_Manager::TEXT,
1511 'dynamic' => array( 'active' => true ),
1512 'selectors' => array(
1513 '{{WRAPPER}} .countdown-section, {{WRAPPER}} .flip-unit-wrap' => 'border-radius: {{VALUE}};',
1514 ),
1515 'condition' => array(
1516 'boxes_adv_radius' => 'yes',
1517 ),
1518 'ai' => array(
1519 'active' => false,
1520 ),
1521 )
1522 );
1523
1524 $this->add_responsive_control(
1525 'boxes_margin',
1526 array(
1527 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1528 'type' => Controls_Manager::DIMENSIONS,
1529 'size_units' => array( 'px', '%', 'em' ),
1530 'selectors' => array(
1531 '{{WRAPPER}} .countdown-section, {{WRAPPER}} .flip-unit-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1532 ),
1533 )
1534 );
1535
1536 $this->add_responsive_control(
1537 'boxes_padding',
1538 array(
1539 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1540 'type' => Controls_Manager::DIMENSIONS,
1541 'size_units' => array( 'px', '%', 'em' ),
1542 'selectors' => array(
1543 '{{WRAPPER}} .countdown-section, {{WRAPPER}} .flip-unit-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1544 ),
1545 )
1546 );
1547
1548 $this->end_controls_section();
1549
1550 $this->start_controls_section(
1551 'premium_countdown_exp_message',
1552 array(
1553 'label' => __( 'Expiration Message', 'premium-addons-for-elementor' ),
1554 'tab' => Controls_Manager::TAB_STYLE,
1555 'condition' => array(
1556 'expiration_type' => 'text',
1557 ),
1558 )
1559 );
1560
1561 $this->add_control(
1562 'premium_countdown_message_color',
1563 array(
1564 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1565 'type' => Controls_Manager::COLOR,
1566 'global' => array(
1567 'default' => Global_Colors::COLOR_SECONDARY,
1568 ),
1569 'selectors' => array(
1570 '{{WRAPPER}} .premium-countdown-exp-message' => 'color: {{VALUE}}',
1571 ),
1572 )
1573 );
1574
1575 $this->add_control(
1576 'premium_countdown_message_bg_color',
1577 array(
1578 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
1579 'type' => Controls_Manager::COLOR,
1580 'selectors' => array(
1581 '{{WRAPPER}} .premium-countdown-exp-message' => 'background-color: {{VALUE}};',
1582 ),
1583 )
1584 );
1585
1586 $this->add_group_control(
1587 Group_Control_Typography::get_type(),
1588 array(
1589 'name' => 'premium_countdown_message_typo',
1590 'global' => array(
1591 'default' => Global_Typography::TYPOGRAPHY_TEXT,
1592 ),
1593 'selector' => '{{WRAPPER}} .premium-countdown-exp-message',
1594 )
1595 );
1596
1597 $this->add_group_control(
1598 Group_Control_Border::get_type(),
1599 array(
1600 'name' => 'premium_countdown_message_border',
1601 'selector' => '{{WRAPPER}} .premium-countdown-exp-message',
1602 )
1603 );
1604
1605 $this->add_control(
1606 'premium_countdown_message_border_radius',
1607 array(
1608 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1609 'type' => Controls_Manager::DIMENSIONS,
1610 'size_units' => array( 'px', '%', 'em' ),
1611 'selectors' => array(
1612 '{{WRAPPER}} .premium-countdown-exp-message' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1613 ),
1614 )
1615 );
1616
1617 $this->add_group_control(
1618 Group_Control_Box_Shadow::get_type(),
1619 array(
1620 'name' => 'premium_countdown_message_shadow',
1621 'selector' => '{{WRAPPER}} .premium-countdown-exp-message',
1622 )
1623 );
1624
1625 $this->add_responsive_control(
1626 'premium_countdown_message_padding',
1627 array(
1628 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1629 'type' => Controls_Manager::DIMENSIONS,
1630 'size_units' => array( 'px', 'em' ),
1631 'selectors' => array(
1632 '{{WRAPPER}} .premium-countdown-exp-message' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1633 ),
1634 )
1635 );
1636
1637 $this->add_responsive_control(
1638 'premium_countdown_message_margin',
1639 array(
1640 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1641 'type' => Controls_Manager::DIMENSIONS,
1642 'size_units' => array( 'px', 'em' ),
1643 'selectors' => array(
1644 '{{WRAPPER}} .premium-countdown-exp-message' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1645 ),
1646 )
1647 );
1648
1649 $this->end_controls_section();
1650 }
1651
1652 /**
1653 * Handles Evergreen Counter
1654 *
1655 * @since 4.3.9
1656 * @access protected
1657 */
1658 protected function get_evergreen_time() {
1659
1660 $settings = $this->get_settings_for_display();
1661
1662 if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
1663 $http_x_headers = explode( ',', sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) );
1664
1665 $_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
1666 }
1667
1668 $ip_address = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';
1669
1670 $ip_address = ( '::1' === $ip_address ) ? '127.0.0.1' : $ip_address;
1671
1672 $id = $this->get_id();
1673
1674 $eve_days = empty( $settings['premium_countdown_eve_days'] ) ? 0 : $settings['premium_countdown_eve_days'] * 24 * 60 * 60;
1675 $eve_hours = empty( $settings['premium_countdown_eve_hours'] ) ? 0 : $settings['premium_countdown_eve_hours'] * 60 * 60;
1676 $eve_min = empty( $settings['premium_countdown_eve_min'] ) ? 0 : $settings['premium_countdown_eve_min'] * 60;
1677
1678 $eve_interval = $eve_days + $eve_hours + $eve_min;
1679
1680 $counter_key = 'premium_countdown_evergreen_' . $id;
1681
1682 $evergreen_user = 'premium_evergreen_user_' . $ip_address;
1683
1684 add_option( $counter_key, array() );
1685
1686 $local_data = get_option( $counter_key, array() );
1687
1688 $local_due_date = isset( $local_data[ $evergreen_user ]['due_date'] ) ? $local_data[ $evergreen_user ]['due_date'] : 'Null';
1689
1690 $local_interval = isset( $local_data[ $evergreen_user ]['interval'] ) ? $local_data[ $evergreen_user ]['interval'] : 'Null';
1691
1692 if ( 'Null' === $local_due_date && 'Null' === $local_interval ) {
1693 return $this->handle_evergreen_counter( $counter_key, $evergreen_user, $eve_interval );
1694 }
1695
1696 if ( 'Null' !== $local_due_date && intval( $local_interval ) !== $eve_interval ) {
1697 return $this->handle_evergreen_counter( $counter_key, $evergreen_user, $eve_interval );
1698 }
1699
1700 if ( strtotime( $local_due_date->format( 'Y-m-d H:i:s' ) ) > 0 && intval( $local_interval ) === $eve_interval ) {
1701 return $local_due_date;
1702 }
1703 }
1704
1705 /**
1706 * Set/update Evergreen user Local Data.
1707 *
1708 * @param string $counter_key evergreen/widget key.
1709 * @param string $evergreen_user evergreen user Key.
1710 * @param number $eve_interval evergreen interval.
1711 *
1712 * @since 4.3.9
1713 * @access protected
1714 *
1715 * @return object $end_time
1716 */
1717 protected function handle_evergreen_counter( $counter_key, $evergreen_user, $eve_interval ) {
1718
1719 $end_time = new DateTime( 'GMT' );
1720
1721 $end_time->setTime( $end_time->format( 'H' ) + 2, (int) $end_time->format( 'i' ), $end_time->format( 's' ) + $eve_interval );
1722
1723 $local_data = get_option( $counter_key, array() );
1724 if ( ! is_array( $local_data ) ) {
1725 $local_data = array();
1726 }
1727
1728 $local_data[ $evergreen_user ]['due_date'] = $end_time;
1729 $local_data[ $evergreen_user ]['interval'] = $eve_interval;
1730
1731 update_option( $counter_key, $local_data );
1732
1733 return $end_time;
1734 }
1735
1736
1737 /**
1738 * Render Countdown widget output on the frontend.
1739 *
1740 * Written in PHP and used to generate the final HTML.
1741 *
1742 * @since 1.0.0
1743 * @access protected
1744 */
1745 protected function render() {
1746
1747 $settings = $this->get_settings_for_display();
1748
1749 $papro_activated = Helper_Functions::check_papro_version();
1750
1751 if ( ! $papro_activated || version_compare( PREMIUM_PRO_ADDONS_VERSION, '2.9.14', '<' ) ) {
1752
1753 if ( in_array( $settings['style'], array( 'circle', 'flipping', 'rotate' ), true ) ) {
1754
1755 ?>
1756 <div class="premium-error-notice">
1757 <?php
1758 $message = __( 'This option is available in <b>Premium Addons Pro</b>.', 'premium-addons-for-elementor' );
1759 echo wp_kses_post( $message );
1760 ?>
1761 </div>
1762 <?php
1763 return false;
1764
1765 }
1766 }
1767
1768 $id = $this->get_id();
1769
1770 $timer_type = $settings['premium_countdown_type'];
1771
1772 $reset = '';
1773
1774 $is_edit_mode = \Elementor\Plugin::$instance->editor->is_edit_mode();
1775
1776 if ( 'evergreen' === $timer_type && 'yes' === $settings['premium_countdown_eve_reset'] ) {
1777
1778 $transient_name = 'premium_evergreen_reset_' . $id;
1779
1780 if ( false === get_transient( $transient_name ) ) {
1781
1782 delete_option( 'premium_countdown_evergreen_' . $id );
1783
1784 $reset = true;
1785
1786 $reset_hours = empty( $settings['premium_countdown_eve_reset_hours'] ) ? 0 : $settings['premium_countdown_eve_reset_hours'] * HOUR_IN_SECONDS;
1787 $reset_min = empty( $settings['premium_countdown_eve_reset_min'] ) ? 0 : $settings['premium_countdown_eve_reset_min'] * MINUTE_IN_SECONDS;
1788
1789 $expire_time = $reset_hours + $reset_min;
1790
1791 if ( ! $is_edit_mode && 0 !== $expire_time ) {
1792 set_transient( $transient_name, 'DEFAULT', $expire_time );
1793 }
1794 }
1795 }
1796
1797 $target_date = 'evergreen' === $timer_type ? $this->get_evergreen_time() : str_replace( '-', '/', $settings['premium_countdown_date_time'] );
1798
1799 $event = $settings['expiration_type'];
1800 $text = '';
1801 if ( 'url' === $event ) {
1802 $text = esc_url( $settings['expiration_url'] );
1803 } elseif ( 'restart' === $event ) {
1804
1805 if ( $is_edit_mode ) {
1806 $last_target = $target_date;
1807 } else {
1808 $last_target = get_option( 'pa_countdown_target' . $id, false );
1809 }
1810
1811 if ( ! $last_target ) {
1812 $last_target = $target_date;
1813 }
1814
1815 if ( $last_target instanceof DateTime ) {
1816 $last_target = $last_target->format( 'Y-m-d H:i:s' );
1817 }
1818
1819 $is_date_passed = strtotime( $last_target ) < strtotime( current_time( 'mysql' ) );
1820
1821 if ( $is_date_passed ) {
1822
1823 $current_time = new DateTime();
1824
1825 $current_time->modify( '+' . $settings['restart_days'] . ' day' );
1826 $current_time->modify( '+' . $settings['restart_hours'] . ' hours' );
1827 $current_time->modify( '+' . $settings['restart_minutes'] . ' minutes' );
1828
1829 $target_date = str_replace( '-', '/', $current_time->format( 'Y-m-d H:i:s' ) );
1830
1831 } else {
1832 $target_date = $last_target;
1833 }
1834
1835 update_option( 'pa_countdown_target' . $id, $target_date );
1836 }
1837
1838 // Used to sync time with WordPress.
1839 $sent_time = '';
1840 if ( 'wp-time' === $settings['timezone'] ) {
1841 $sent_time = str_replace( '-', '/', current_time( 'mysql' ) );
1842 }
1843
1844 if ( 'flipping' !== $settings['style'] ) {
1845
1846 $formats = $settings['premium_countdown_units'];
1847 $format = implode( '', $formats );
1848
1849 // Singular labels set up.
1850 $y = ! empty( $settings['premium_countdown_year_singular'] ) ? $settings['premium_countdown_year_singular'] : 'Year';
1851 $m = ! empty( $settings['premium_countdown_month_singular'] ) ? $settings['premium_countdown_month_singular'] : 'Month';
1852 $w = 'Week';
1853 $d = ! empty( $settings['premium_countdown_day_singular'] ) ? $settings['premium_countdown_day_singular'] : 'Day';
1854 $h = ! empty( $settings['premium_countdown_hour_singular'] ) ? $settings['premium_countdown_hour_singular'] : 'Hour';
1855 $mi = ! empty( $settings['premium_countdown_minute_singular'] ) ? $settings['premium_countdown_minute_singular'] : 'Minute';
1856 $s = ! empty( $settings['premium_countdown_second_singular'] ) ? $settings['premium_countdown_second_singular'] : 'Second';
1857 $label = $y . ',' . $m . ',' . $w . ',' . $d . ',' . $h . ',' . $mi . ',' . $s;
1858
1859 // Plural labels set up.
1860 $ys = ! empty( $settings['premium_countdown_year_plural'] ) ? $settings['premium_countdown_year_plural'] : 'Years';
1861 $ms = ! empty( $settings['premium_countdown_month_plural'] ) ? $settings['premium_countdown_month_plural'] : 'Months';
1862 $ws = 'Weeks';
1863 $ds = ! empty( $settings['premium_countdown_day_plural'] ) ? $settings['premium_countdown_day_plural'] : 'Days';
1864 $hs = ! empty( $settings['premium_countdown_hour_plural'] ) ? $settings['premium_countdown_hour_plural'] : 'Hours';
1865 $mis = ! empty( $settings['premium_countdown_minute_plural'] ) ? $settings['premium_countdown_minute_plural'] : 'Minutes';
1866 $ss = ! empty( $settings['premium_countdown_second_plural'] ) ? $settings['premium_countdown_second_plural'] : 'Seconds';
1867 $labels1 = $ys . ',' . $ms . ',' . $ws . ',' . $ds . ',' . $hs . ',' . $mis . ',' . $ss;
1868
1869 $countdown_settings = array(
1870 'until' => $target_date,
1871 'serverSync' => $sent_time,
1872 'format' => $format,
1873 'event' => $event,
1874 'changeTo' => $settings['change_digits'],
1875 'text' => $text,
1876 'separator' => 'custom' !== $settings['premium_countdown_separator_text'] ? $settings['premium_countdown_separator_text'] : $settings['custom_separator'],
1877 'timerType' => $timer_type,
1878 'unitsPos' => $settings['unit_position'],
1879 'reset' => $reset,
1880 'style' => $settings['style'],
1881 'lang' => $settings['flip_language'],
1882 );
1883
1884 if ( 'featured' === $settings['style'] ) {
1885 $countdown_settings['featuredUnit'] = $settings['featured_unit'];
1886 } elseif ( 'circle' === $settings['style'] ) {
1887 $this->add_render_attribute( 'inner_counter', 'class', 'premium-addons__v-hidden' );
1888 }
1889 } else {
1890
1891 $countdown_settings = array(
1892 'until' => $target_date,
1893 'serverSync' => $sent_time,
1894 'event' => $event,
1895 'text' => $text,
1896 'timerType' => $timer_type,
1897 'separator' => 'custom' !== $settings['premium_countdown_separator_text'] ? $settings['premium_countdown_separator_text'] : $settings['custom_separator'],
1898 'reset' => $reset,
1899 'style' => $settings['style'],
1900 'lang' => $settings['flip_language'],
1901 );
1902
1903 }
1904
1905 $this->add_render_attribute(
1906 'container',
1907 array(
1908 'class' => array( 'premium-countdown', 'premium-countdown-separator-' . esc_attr( $settings['premium_countdown_separator'] ) ),
1909 'data-settings' => wp_json_encode( $countdown_settings ),
1910 )
1911 );
1912
1913 $this->add_render_attribute(
1914 'inner_counter',
1915 array(
1916 'class' => array(
1917 'countdown',
1918 'premium-countdown-init',
1919 'premium-countdown-' . $settings['style'],
1920 ),
1921 )
1922 );
1923
1924 ?>
1925 <div <?php $this->print_render_attribute_string( 'container' ); ?>>
1926 <div <?php $this->print_render_attribute_string( 'inner_counter' ); ?>></div>
1927
1928 <?php if ( 'text' === $event ) : ?>
1929
1930 <div class="premium-countdown-exp-message premium-addons__v-hidden">
1931 <?php $this->print_text_editor( $settings['expiration_text'] ); ?>
1932 </div>
1933 <?php endif; ?>
1934 </div>
1935 <?php
1936 }
1937 }
1938