Adv_Accordion.php
1 year ago
Adv_Tabs.php
1 year ago
Advanced_Data_Table.php
1 year ago
Better_Payment.php
4 years ago
Betterdocs_Category_Box.php
1 year ago
Betterdocs_Category_Grid.php
1 year ago
Betterdocs_Search_Form.php
1 year ago
Business_Reviews.php
1 year ago
Caldera_Forms.php
1 year ago
Career_Page.php
4 years ago
Contact_Form_7.php
1 year ago
Content_Ticker.php
1 year ago
Countdown.php
1 year ago
Creative_Button.php
1 year ago
Cta_Box.php
1 year ago
Data_Table.php
1 year ago
Dual_Color_Header.php
1 year ago
EmbedPress.php
4 years ago
Event_Calendar.php
1 year ago
Facebook_Feed.php
1 year ago
Fancy_Text.php
1 year ago
Feature_List.php
1 year ago
Filterable_Gallery.php
1 year ago
Flip_Box.php
1 year ago
FluentForm.php
1 year ago
Formstack.php
1 year ago
GravityForms.php
1 year ago
Image_Accordion.php
1 year ago
Info_Box.php
1 year ago
Interactive_Circle.php
1 year ago
Login_Register.php
1 year ago
NFT_Gallery.php
1 year ago
NinjaForms.php
1 year ago
Post_Grid.php
1 year ago
Post_Timeline.php
1 year ago
Pricing_Table.php
1 year ago
Product_Grid.php
1 year ago
Progress_Bar.php
1 year ago
SVG_Draw.php
1 year ago
Simple_Menu.php
1 year ago
Sticky_Video.php
1 year ago
Team_Member.php
1 year ago
Testimonial.php
1 year ago
Tooltip.php
1 year ago
Twitter_Feed.php
1 year ago
TypeForm.php
1 year ago
WeForms.php
2 years ago
Woo_Cart.php
1 year ago
Woo_Checkout.php
1 year ago
Woo_Product_Carousel.php
1 year ago
Woo_Product_Compare.php
2 years ago
Woo_Product_Gallery.php
1 year ago
Woo_Product_List.php
1 year ago
WpForms.php
1 year ago
index.php
3 years ago
Countdown.php
1370 lines
| 1 | <?php |
| 2 | namespace Essential_Addons_Elementor\Elements; |
| 3 | |
| 4 | // If this file is called directly, abort. |
| 5 | if ( !defined( 'ABSPATH' ) ) { |
| 6 | exit; |
| 7 | } |
| 8 | |
| 9 | use \Elementor\Controls_Manager; |
| 10 | use \Elementor\Group_Control_Border; |
| 11 | use \Elementor\Group_Control_Box_Shadow; |
| 12 | use \Elementor\Group_Control_Typography; |
| 13 | use \Elementor\Plugin; |
| 14 | use \Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 15 | use \Elementor\Widget_Base; |
| 16 | |
| 17 | use \Essential_Addons_Elementor\Classes\Helper; |
| 18 | |
| 19 | class Countdown extends Widget_Base { |
| 20 | |
| 21 | |
| 22 | public function get_name() { |
| 23 | return 'eael-countdown'; |
| 24 | } |
| 25 | |
| 26 | public function get_title() { |
| 27 | return esc_html__( 'Countdown', 'essential-addons-for-elementor-lite' ); |
| 28 | } |
| 29 | |
| 30 | public function get_icon() { |
| 31 | return 'eaicon-countdown'; |
| 32 | } |
| 33 | |
| 34 | public function get_categories() { |
| 35 | return ['essential-addons-elementor']; |
| 36 | } |
| 37 | |
| 38 | public function get_keywords() { |
| 39 | return [ |
| 40 | 'countdown', |
| 41 | 'ea countdown', |
| 42 | 'count down', |
| 43 | 'ea count down', |
| 44 | 'timer', |
| 45 | 'ea timer', |
| 46 | 'chronometer', |
| 47 | 'stopwatch', |
| 48 | 'clock', |
| 49 | 'ea', |
| 50 | 'essential addons', |
| 51 | ]; |
| 52 | } |
| 53 | |
| 54 | protected function is_dynamic_content():bool { |
| 55 | if( Plugin::$instance->editor->is_edit_mode() ) { |
| 56 | return false; |
| 57 | } |
| 58 | $expire_type = $this->get_settings('countdown_expire_type'); |
| 59 | $is_dynamic_content = 'template' === $expire_type; |
| 60 | |
| 61 | return $is_dynamic_content; |
| 62 | } |
| 63 | |
| 64 | public function get_custom_help_url() { |
| 65 | return 'https://essential-addons.com/elementor/docs/creative-elements/ea-countdown/'; |
| 66 | } |
| 67 | |
| 68 | protected function register_controls() { |
| 69 | |
| 70 | $this->start_controls_section( |
| 71 | 'eael_section_countdown_settings_general', |
| 72 | [ |
| 73 | 'label' => esc_html__( 'Timer Settings', 'essential-addons-for-elementor-lite' ), |
| 74 | ] |
| 75 | ); |
| 76 | |
| 77 | $this->add_control( |
| 78 | 'eael_countdown_type', |
| 79 | [ |
| 80 | 'label' => esc_html__( 'Type', 'essential-addons-for-elementor-lite' ), |
| 81 | 'type' => Controls_Manager::SELECT, |
| 82 | 'options' => [ |
| 83 | 'due_date' => esc_html__( 'Default', 'essential-addons-for-elementor-lite' ), |
| 84 | 'evergreen' => esc_html__( 'Evergreen Timer', 'essential-addons-for-elementor-lite' ), |
| 85 | ], |
| 86 | 'default' => 'due_date', |
| 87 | ] |
| 88 | ); |
| 89 | |
| 90 | $this->add_control( |
| 91 | 'eael_evergreen_counter_hours', |
| 92 | [ |
| 93 | 'label' => esc_html__( 'Hours', 'essential-addons-for-elementor-lite' ), |
| 94 | 'type' => Controls_Manager::NUMBER, |
| 95 | 'default' => 11, |
| 96 | 'placeholder' => esc_html__( 'Hours', 'essential-addons-for-elementor-lite' ), |
| 97 | 'condition' => [ |
| 98 | 'eael_countdown_type' => 'evergreen', |
| 99 | ], |
| 100 | ] |
| 101 | ); |
| 102 | |
| 103 | $this->add_control( |
| 104 | 'eael_evergreen_counter_minutes', |
| 105 | [ |
| 106 | 'label' => esc_html__( 'Minutes', 'essential-addons-for-elementor-lite' ), |
| 107 | 'type' => Controls_Manager::NUMBER, |
| 108 | 'default' => 59, |
| 109 | 'placeholder' => esc_html__( 'Minutes', 'essential-addons-for-elementor-lite' ), |
| 110 | 'condition' => [ |
| 111 | 'eael_countdown_type' => 'evergreen', |
| 112 | ], |
| 113 | ] |
| 114 | ); |
| 115 | |
| 116 | $this->add_control( |
| 117 | 'eael_evergreen_counter_recurring', |
| 118 | [ |
| 119 | 'label' => esc_html__( 'Recurring Countdown', 'essential-addons-for-elementor-lite' ), |
| 120 | 'type' => Controls_Manager::SWITCHER, |
| 121 | 'return_value' => 'yes', |
| 122 | 'default' => '', |
| 123 | 'condition' => [ |
| 124 | 'eael_countdown_type' => 'evergreen', |
| 125 | ], |
| 126 | ] |
| 127 | ); |
| 128 | |
| 129 | $this->add_control( |
| 130 | 'eael_evergreen_counter_recurring_restart_after', |
| 131 | [ |
| 132 | 'label' => esc_html__( 'Restart After (In Hours)', 'essential-addons-for-elementor-lite' ), |
| 133 | 'type' => Controls_Manager::NUMBER, |
| 134 | 'default' => 0, |
| 135 | 'description' => esc_html__( 'Specify how much time it will take to restart the countdown. If you set 0, the countdown will restart immediately.', 'essential-addons-for-elementor-lite' ), |
| 136 | 'placeholder' => esc_html__( 'Hours', 'essential-addons-for-elementor-lite' ), |
| 137 | 'condition' => [ |
| 138 | 'eael_countdown_type' => 'evergreen', |
| 139 | 'eael_evergreen_counter_recurring' => 'yes', |
| 140 | ], |
| 141 | ] |
| 142 | ); |
| 143 | |
| 144 | $this->add_control( |
| 145 | 'eael_evergreen_counter_recurring_stop_time', |
| 146 | [ |
| 147 | 'label' => esc_html__( 'Recurring Countdown End Date', 'essential-addons-for-elementor-lite' ), |
| 148 | 'type' => Controls_Manager::DATE_TIME, |
| 149 | 'default' => date( "Y-m-d", strtotime( "+ 7 day" ) ), |
| 150 | 'description' => esc_html__( 'Set the countdown end time', 'essential-addons-for-elementor-lite' ), |
| 151 | 'condition' => [ |
| 152 | 'eael_countdown_type' => 'evergreen', |
| 153 | 'eael_evergreen_counter_recurring' => 'yes', |
| 154 | ], |
| 155 | ] |
| 156 | ); |
| 157 | |
| 158 | $this->add_control( |
| 159 | 'eael_countdown_due_time', |
| 160 | [ |
| 161 | 'label' => esc_html__( 'Countdown Due Date', 'essential-addons-for-elementor-lite' ), |
| 162 | 'type' => Controls_Manager::DATE_TIME, |
| 163 | 'default' => date( "Y-m-d", strtotime( "+ 1 day" ) ), |
| 164 | 'description' => esc_html__( 'Set the due date and time', 'essential-addons-for-elementor-lite' ), |
| 165 | 'condition' => [ |
| 166 | 'eael_countdown_type' => 'due_date', |
| 167 | ], |
| 168 | ] |
| 169 | ); |
| 170 | |
| 171 | $this->add_responsive_control( |
| 172 | 'eael_countdown_label_view', |
| 173 | [ |
| 174 | 'label' => esc_html__( 'Label Position', 'essential-addons-for-elementor-lite' ), |
| 175 | 'type' => Controls_Manager::SELECT, |
| 176 | 'default' => 'eael-countdown-label-block', |
| 177 | 'options' => [ |
| 178 | 'eael-countdown-label-block' => esc_html__( 'Block', 'essential-addons-for-elementor-lite' ), |
| 179 | 'eael-countdown-label-inline' => esc_html__( 'Inline', 'essential-addons-for-elementor-lite' ), |
| 180 | ], |
| 181 | ] |
| 182 | ); |
| 183 | |
| 184 | $this->add_responsive_control( |
| 185 | 'eael_countdown_label_padding_left', |
| 186 | [ |
| 187 | 'label' => esc_html__( 'Left spacing for Labels', 'essential-addons-for-elementor-lite' ), |
| 188 | 'type' => Controls_Manager::SLIDER, |
| 189 | 'description' => esc_html__( 'Use when you select inline labels', 'essential-addons-for-elementor-lite' ), |
| 190 | 'range' => [ |
| 191 | 'px' => [ |
| 192 | 'min' => 0, |
| 193 | 'max' => 100, |
| 194 | ], |
| 195 | ], |
| 196 | 'selectors' => [ |
| 197 | '{{WRAPPER}} .eael-countdown-label' => 'padding-left:{{SIZE}}px;', |
| 198 | ], |
| 199 | 'condition' => [ |
| 200 | 'eael_countdown_label_view' => 'eael-countdown-label-inline', |
| 201 | ], |
| 202 | ] |
| 203 | ); |
| 204 | |
| 205 | $this->add_responsive_control( |
| 206 | 'eael_countdown_alignment', |
| 207 | [ |
| 208 | 'label' => __( 'Alignment', 'essential-addons-for-elementor-lite' ), |
| 209 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 210 | 'options' => [ |
| 211 | 'left' => [ |
| 212 | 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ), |
| 213 | 'icon' => 'eicon-text-align-left', |
| 214 | ], |
| 215 | 'center' => [ |
| 216 | 'title' => __( 'Center', 'essential-addons-for-elementor-lite' ), |
| 217 | 'icon' => 'eicon-text-align-center', |
| 218 | ], |
| 219 | 'right' => [ |
| 220 | 'title' => __( 'Right', 'essential-addons-for-elementor-lite' ), |
| 221 | 'icon' => 'eicon-text-align-right', |
| 222 | ], |
| 223 | ], |
| 224 | 'default' => 'center', |
| 225 | 'selectors' => [ |
| 226 | '{{WRAPPER}} .eael-countdown-item > div' => 'text-align: {{VALUE}};', |
| 227 | ], |
| 228 | ] |
| 229 | ); |
| 230 | |
| 231 | $this->end_controls_section(); |
| 232 | |
| 233 | $this->start_controls_section( |
| 234 | 'eael_section_countdown_settings_content', |
| 235 | [ |
| 236 | 'label' => esc_html__( 'Content Settings', 'essential-addons-for-elementor-lite' ), |
| 237 | ] |
| 238 | ); |
| 239 | $this->add_control( |
| 240 | 'eael_section_countdown_layout', |
| 241 | [ |
| 242 | 'label' => __( 'Layout', 'essential-addons-for-elementor-lite' ), |
| 243 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 244 | 'options' => [ |
| 245 | 'grid' => [ |
| 246 | 'title' => __( 'List view', 'essential-addons-for-elementor-lite' ), |
| 247 | 'icon' => 'fa fa-th-list', |
| 248 | ], |
| 249 | 'table-cell' => [ |
| 250 | 'title' => __( 'Grid View', 'essential-addons-for-elementor-lite' ), |
| 251 | 'icon' => 'fa fa-th-large', |
| 252 | ], |
| 253 | ], |
| 254 | 'default' => 'table-cell', |
| 255 | 'selectors' => [ |
| 256 | '{{WRAPPER}} .eael-countdown-items>li' => 'display: {{VALUE}};', |
| 257 | ], |
| 258 | ] |
| 259 | ); |
| 260 | |
| 261 | $this->add_control( |
| 262 | 'eael_countdown_days', |
| 263 | [ |
| 264 | 'label' => esc_html__( 'Display Days', 'essential-addons-for-elementor-lite' ), |
| 265 | 'type' => Controls_Manager::SWITCHER, |
| 266 | 'return_value' => 'yes', |
| 267 | 'default' => 'yes', |
| 268 | ] |
| 269 | ); |
| 270 | |
| 271 | $this->add_control( |
| 272 | 'eael_countdown_days_label', |
| 273 | [ |
| 274 | 'label' => esc_html__( 'Custom Label for Days', 'essential-addons-for-elementor-lite' ), |
| 275 | 'type' => Controls_Manager::TEXT, |
| 276 | 'dynamic' => [ |
| 277 | 'active' => true, |
| 278 | ], |
| 279 | 'default' => esc_html__( 'Days', 'essential-addons-for-elementor-lite' ), |
| 280 | 'description' => esc_html__( 'Leave blank to hide', 'essential-addons-for-elementor-lite' ), |
| 281 | 'condition' => [ |
| 282 | 'eael_countdown_days' => 'yes', |
| 283 | ], |
| 284 | 'ai' => [ |
| 285 | 'active' => false, |
| 286 | ], |
| 287 | ] |
| 288 | ); |
| 289 | |
| 290 | $this->add_control( |
| 291 | 'eael_countdown_hours', |
| 292 | [ |
| 293 | 'label' => esc_html__( 'Display Hours', 'essential-addons-for-elementor-lite' ), |
| 294 | 'type' => Controls_Manager::SWITCHER, |
| 295 | 'return_value' => 'yes', |
| 296 | 'default' => 'yes', |
| 297 | ] |
| 298 | ); |
| 299 | |
| 300 | $this->add_control( |
| 301 | 'eael_countdown_hours_label', |
| 302 | [ |
| 303 | 'label' => esc_html__( 'Custom Label for Hours', 'essential-addons-for-elementor-lite' ), |
| 304 | 'type' => Controls_Manager::TEXT, |
| 305 | 'dynamic' => [ |
| 306 | 'active' => true, |
| 307 | ], |
| 308 | 'default' => esc_html__( 'Hours', 'essential-addons-for-elementor-lite' ), |
| 309 | 'description' => esc_html__( 'Leave blank to hide', 'essential-addons-for-elementor-lite' ), |
| 310 | 'condition' => [ |
| 311 | 'eael_countdown_hours' => 'yes', |
| 312 | ], |
| 313 | 'ai' => [ |
| 314 | 'active' => false, |
| 315 | ], |
| 316 | ] |
| 317 | ); |
| 318 | |
| 319 | $this->add_control( |
| 320 | 'eael_countdown_minutes', |
| 321 | [ |
| 322 | 'label' => esc_html__( 'Display Minutes', 'essential-addons-for-elementor-lite' ), |
| 323 | 'type' => Controls_Manager::SWITCHER, |
| 324 | 'return_value' => 'yes', |
| 325 | 'default' => 'yes', |
| 326 | ] |
| 327 | ); |
| 328 | |
| 329 | $this->add_control( |
| 330 | 'eael_countdown_minutes_label', |
| 331 | [ |
| 332 | 'label' => esc_html__( 'Custom Label for Minutes', 'essential-addons-for-elementor-lite' ), |
| 333 | 'type' => Controls_Manager::TEXT, |
| 334 | 'dynamic' => [ |
| 335 | 'active' => true, |
| 336 | ], |
| 337 | 'default' => esc_html__( 'Minutes', 'essential-addons-for-elementor-lite' ), |
| 338 | 'description' => esc_html__( 'Leave blank to hide', 'essential-addons-for-elementor-lite' ), |
| 339 | 'condition' => [ |
| 340 | 'eael_countdown_minutes' => 'yes', |
| 341 | ], |
| 342 | 'ai' => [ |
| 343 | 'active' => false, |
| 344 | ], |
| 345 | ] |
| 346 | ); |
| 347 | |
| 348 | $this->add_control( |
| 349 | 'eael_countdown_seconds', |
| 350 | [ |
| 351 | 'label' => esc_html__( 'Display Seconds', 'essential-addons-for-elementor-lite' ), |
| 352 | 'type' => Controls_Manager::SWITCHER, |
| 353 | 'return_value' => 'yes', |
| 354 | 'default' => 'yes', |
| 355 | ] |
| 356 | ); |
| 357 | |
| 358 | $this->add_control( |
| 359 | 'eael_countdown_seconds_label', |
| 360 | [ |
| 361 | 'label' => esc_html__( 'Custom Label for Seconds', 'essential-addons-for-elementor-lite' ), |
| 362 | 'type' => Controls_Manager::TEXT, |
| 363 | 'dynamic' => [ |
| 364 | 'active' => true, |
| 365 | ], |
| 366 | 'default' => esc_html__( 'Seconds', 'essential-addons-for-elementor-lite' ), |
| 367 | 'description' => esc_html__( 'Leave blank to hide', 'essential-addons-for-elementor-lite' ), |
| 368 | 'condition' => [ |
| 369 | 'eael_countdown_seconds' => 'yes', |
| 370 | ], |
| 371 | 'ai' => [ |
| 372 | 'active' => false, |
| 373 | ], |
| 374 | ] |
| 375 | ); |
| 376 | |
| 377 | $this->add_control( |
| 378 | 'eael_countdown_separator_heading', |
| 379 | [ |
| 380 | 'label' => __( 'Countdown Separator', 'essential-addons-for-elementor-lite' ), |
| 381 | 'type' => Controls_Manager::HEADING, |
| 382 | ] |
| 383 | ); |
| 384 | |
| 385 | $this->add_control( |
| 386 | 'eael_countdown_separator', |
| 387 | [ |
| 388 | 'label' => esc_html__( 'Display Separator', 'essential-addons-for-elementor-lite' ), |
| 389 | 'type' => Controls_Manager::SWITCHER, |
| 390 | 'return_value' => 'eael-countdown-show-separator', |
| 391 | 'default' => '', |
| 392 | ] |
| 393 | ); |
| 394 | |
| 395 | $this->add_control( |
| 396 | 'eael_countdown_separator_style', |
| 397 | [ |
| 398 | 'label' => __( 'Separator Style', 'essential-addons-for-elementor-lite' ), |
| 399 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 400 | 'default' => 'dotted', |
| 401 | 'options' => [ |
| 402 | 'solid' => __( 'Solid', 'essential-addons-for-elementor-lite' ), |
| 403 | 'dotted' => __( 'Dotted', 'essential-addons-for-elementor-lite' ), |
| 404 | ], |
| 405 | 'condition' => [ |
| 406 | 'eael_countdown_separator' => 'eael-countdown-show-separator', |
| 407 | ], |
| 408 | ] |
| 409 | ); |
| 410 | |
| 411 | $this->add_control( |
| 412 | 'eael_countdown_separator_position_top', |
| 413 | [ |
| 414 | 'label' => __( 'Position Top', 'essential-addons-for-elementor-lite' ), |
| 415 | 'type' => Controls_Manager::SLIDER, |
| 416 | 'size_units' => ['px', '%'], |
| 417 | 'range' => [ |
| 418 | 'px' => [ |
| 419 | 'min' => 0, |
| 420 | 'max' => 1000, |
| 421 | 'step' => 5, |
| 422 | ], |
| 423 | '%' => [ |
| 424 | 'min' => 0, |
| 425 | 'max' => 100, |
| 426 | ], |
| 427 | ], |
| 428 | 'default' => [ |
| 429 | 'unit' => '%', |
| 430 | ], |
| 431 | 'selectors' => [ |
| 432 | '{{WRAPPER}} .eael-countdown-digits::after' => 'top: {{SIZE}}{{UNIT}};', |
| 433 | ], |
| 434 | ] |
| 435 | ); |
| 436 | |
| 437 | $this->add_control( |
| 438 | 'eael_countdown_separator_position_left', |
| 439 | [ |
| 440 | 'label' => __( 'Position Left', 'essential-addons-for-elementor-lite' ), |
| 441 | 'type' => Controls_Manager::SLIDER, |
| 442 | 'size_units' => ['px', '%'], |
| 443 | 'range' => [ |
| 444 | 'px' => [ |
| 445 | 'min' => 0, |
| 446 | 'max' => 1000, |
| 447 | 'step' => 5, |
| 448 | ], |
| 449 | '%' => [ |
| 450 | 'min' => 0, |
| 451 | 'max' => 100, |
| 452 | ], |
| 453 | ], |
| 454 | 'default' => [ |
| 455 | 'unit' => '%', |
| 456 | 'size' => 98, |
| 457 | ], |
| 458 | 'selectors' => [ |
| 459 | '{{WRAPPER}} .eael-countdown-digits::after' => 'left: {{SIZE}}{{UNIT}};', |
| 460 | ], |
| 461 | ] |
| 462 | ); |
| 463 | |
| 464 | $this->add_control( |
| 465 | 'eael_countdown_separator_color', |
| 466 | [ |
| 467 | 'label' => esc_html__( 'Separator Color', 'essential-addons-for-elementor-lite' ), |
| 468 | 'type' => Controls_Manager::COLOR, |
| 469 | 'default' => '', |
| 470 | 'condition' => [ |
| 471 | 'eael_countdown_separator' => 'eael-countdown-show-separator', |
| 472 | ], |
| 473 | 'selectors' => [ |
| 474 | '{{WRAPPER}} .eael-countdown-digits::after' => 'color: {{VALUE}};', |
| 475 | ], |
| 476 | ] |
| 477 | ); |
| 478 | |
| 479 | $this->add_group_control( |
| 480 | Group_Control_Typography::get_type(), |
| 481 | [ |
| 482 | 'name' => 'eael_countdown_separator_typography', |
| 483 | 'global' => [ |
| 484 | 'default' => Global_Typography::TYPOGRAPHY_SECONDARY |
| 485 | ], |
| 486 | 'selector' => '{{WRAPPER}} .eael-countdown-digits::after', |
| 487 | 'condition' => [ |
| 488 | 'eael_countdown_separator' => 'eael-countdown-show-separator', |
| 489 | ], |
| 490 | ] |
| 491 | ); |
| 492 | |
| 493 | $this->end_controls_section(); |
| 494 | |
| 495 | $this->start_controls_section( |
| 496 | 'countdown_on_expire_settings', |
| 497 | [ |
| 498 | 'label' => esc_html__( 'Expire Action', 'essential-addons-for-elementor-lite' ), |
| 499 | ] |
| 500 | ); |
| 501 | |
| 502 | $this->add_control( |
| 503 | 'countdown_expire_type', |
| 504 | [ |
| 505 | 'label' => esc_html__( 'Expire Type', 'essential-addons-for-elementor-lite' ), |
| 506 | 'label_block' => false, |
| 507 | 'type' => Controls_Manager::SELECT, |
| 508 | 'description' => esc_html__( 'Choose whether if you want to set a message or a redirect link', 'essential-addons-for-elementor-lite' ), |
| 509 | 'options' => [ |
| 510 | 'none' => esc_html__( 'None', 'essential-addons-for-elementor-lite' ), |
| 511 | 'text' => esc_html__( 'Message', 'essential-addons-for-elementor-lite' ), |
| 512 | 'url' => esc_html__( 'Redirection Link', 'essential-addons-for-elementor-lite' ), |
| 513 | 'template' => esc_html__( 'Saved Templates', 'essential-addons-for-elementor-lite' ), |
| 514 | ], |
| 515 | 'default' => 'none', |
| 516 | ] |
| 517 | ); |
| 518 | |
| 519 | $this->add_control( |
| 520 | 'countdown_expiry_text_title', |
| 521 | [ |
| 522 | 'label' => esc_html__( 'On Expiry Title', 'essential-addons-for-elementor-lite' ), |
| 523 | 'type' => Controls_Manager::TEXTAREA, |
| 524 | 'dynamic' => ['active' => true], |
| 525 | 'default' => esc_html__( 'Countdown is finished!', 'essential-addons-for-elementor-lite' ), |
| 526 | 'condition' => [ |
| 527 | 'countdown_expire_type' => 'text', |
| 528 | ], |
| 529 | ] |
| 530 | ); |
| 531 | |
| 532 | $this->add_control( |
| 533 | 'countdown_expiry_text', |
| 534 | [ |
| 535 | 'label' => esc_html__( 'On Expiry Content', 'essential-addons-for-elementor-lite' ), |
| 536 | 'type' => Controls_Manager::WYSIWYG, |
| 537 | 'default' => esc_html__( 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s', 'essential-addons-for-elementor-lite' ), |
| 538 | 'condition' => [ |
| 539 | 'countdown_expire_type' => 'text', |
| 540 | ], |
| 541 | ] |
| 542 | ); |
| 543 | |
| 544 | $this->add_control( |
| 545 | 'countdown_expiry_redirection', |
| 546 | [ |
| 547 | 'label' => esc_html__( 'Redirect To (URL)', 'essential-addons-for-elementor-lite' ), |
| 548 | 'type' => Controls_Manager::TEXT, |
| 549 | 'dynamic' => ['active' => true], |
| 550 | 'condition' => [ |
| 551 | 'countdown_expire_type' => 'url', |
| 552 | ], |
| 553 | 'default' => '#', |
| 554 | 'ai' => [ |
| 555 | 'active' => false, |
| 556 | ], |
| 557 | ] |
| 558 | ); |
| 559 | |
| 560 | $this->add_control( |
| 561 | 'countdown_expiry_templates', |
| 562 | [ |
| 563 | 'label' => __( 'Choose Template', 'essential-addons-for-elementor-lite' ), |
| 564 | 'type' => Controls_Manager::SELECT, |
| 565 | 'options' => Helper::get_elementor_templates(), |
| 566 | 'condition' => [ |
| 567 | 'countdown_expire_type' => 'template', |
| 568 | ], |
| 569 | ] |
| 570 | ); |
| 571 | |
| 572 | $this->end_controls_section(); |
| 573 | |
| 574 | if ( !apply_filters( 'eael/pro_enabled', false ) ) { |
| 575 | $this->start_controls_section( |
| 576 | 'eael_section_pro', |
| 577 | [ |
| 578 | 'label' => __( 'Go Premium for More Features', 'essential-addons-for-elementor-lite' ), |
| 579 | ] |
| 580 | ); |
| 581 | |
| 582 | $this->add_control( |
| 583 | 'eael_control_get_pro', |
| 584 | [ |
| 585 | 'label' => __( 'Unlock more possibilities', 'essential-addons-for-elementor-lite' ), |
| 586 | 'type' => Controls_Manager::CHOOSE, |
| 587 | 'options' => [ |
| 588 | '1' => [ |
| 589 | 'title' => '', |
| 590 | 'icon' => 'fa fa-unlock-alt', |
| 591 | ], |
| 592 | ], |
| 593 | 'default' => '1', |
| 594 | 'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">Pro version</a> for more stunning elements and customization options.</span>', |
| 595 | ] |
| 596 | ); |
| 597 | |
| 598 | $this->end_controls_section(); |
| 599 | } |
| 600 | |
| 601 | $this->start_controls_section( |
| 602 | 'eael_section_countdown_styles_general', |
| 603 | [ |
| 604 | 'label' => esc_html__( 'Countdown Styles', 'essential-addons-for-elementor-lite' ), |
| 605 | 'tab' => Controls_Manager::TAB_STYLE, |
| 606 | ] |
| 607 | ); |
| 608 | |
| 609 | $this->add_control( |
| 610 | 'eael_countdown_is_gradient', |
| 611 | [ |
| 612 | 'label' => __( 'Use Gradient Background?', 'essential-addons-for-elementor-lite' ), |
| 613 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 614 | 'label_on' => __( 'Show', 'essential-addons-for-elementor-lite' ), |
| 615 | 'label_off' => __( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 616 | 'return_value' => 'yes', |
| 617 | ] |
| 618 | ); |
| 619 | |
| 620 | $this->add_group_control( |
| 621 | \Elementor\Group_Control_Background::get_type(), |
| 622 | [ |
| 623 | 'name' => 'eael_countdown_background', |
| 624 | 'label' => __( 'Box Background Color', 'essential-addons-for-elementor-lite' ), |
| 625 | 'types' => ['classic', 'gradient'], |
| 626 | 'selector' => '{{WRAPPER}} .eael-countdown-item > div', |
| 627 | 'condition' => [ |
| 628 | 'eael_countdown_is_gradient' => 'yes', |
| 629 | ], |
| 630 | ] |
| 631 | ); |
| 632 | |
| 633 | $this->add_control( |
| 634 | 'eael_countdown_background', |
| 635 | [ |
| 636 | 'label' => esc_html__( 'Box Background Color', 'essential-addons-for-elementor-lite' ), |
| 637 | 'type' => Controls_Manager::COLOR, |
| 638 | 'default' => '', |
| 639 | 'selectors' => [ |
| 640 | '{{WRAPPER}} .eael-countdown-item > div' => 'background: {{VALUE}};', |
| 641 | ], |
| 642 | 'condition' => [ |
| 643 | 'eael_countdown_is_gradient' => '', |
| 644 | ], |
| 645 | ] |
| 646 | ); |
| 647 | $this->add_responsive_control( |
| 648 | 'eael_countdown_item_bottom_margin', |
| 649 | [ |
| 650 | 'label' => esc_html__( 'Space Between Boxes', 'essential-addons-for-elementor-lite' ), |
| 651 | 'type' => Controls_Manager::SLIDER, |
| 652 | 'default' => [ |
| 653 | 'size' => 15, |
| 654 | ], |
| 655 | 'range' => [ |
| 656 | 'px' => [ |
| 657 | 'min' => 0, |
| 658 | 'max' => 100, |
| 659 | ], |
| 660 | ], |
| 661 | 'selectors' => [ |
| 662 | '{{WRAPPER}} .eael-countdown-items>li' => 'margin-bottom:{{SIZE}}px;', |
| 663 | ], |
| 664 | 'condition' => [ |
| 665 | 'eael_section_countdown_layout' => 'grid', |
| 666 | ], |
| 667 | ] |
| 668 | ); |
| 669 | |
| 670 | $this->add_responsive_control( |
| 671 | 'eael_countdown_spacing', |
| 672 | [ |
| 673 | 'label' => esc_html__( 'Space Between Boxes', 'essential-addons-for-elementor-lite' ), |
| 674 | 'type' => Controls_Manager::SLIDER, |
| 675 | 'default' => [ |
| 676 | 'size' => 15, |
| 677 | ], |
| 678 | 'range' => [ |
| 679 | 'px' => [ |
| 680 | 'min' => 0, |
| 681 | 'max' => 100, |
| 682 | ], |
| 683 | ], |
| 684 | 'selectors' => [ |
| 685 | '{{WRAPPER}} .eael-countdown-item > div' => 'margin-right:{{SIZE}}px; margin-left:{{SIZE}}px;', |
| 686 | '{{WRAPPER}} .eael-countdown-container' => 'margin-right: -{{SIZE}}px; margin-left: -{{SIZE}}px;', |
| 687 | ], |
| 688 | 'condition' => [ |
| 689 | 'eael_section_countdown_layout' => 'table-cell', |
| 690 | ], |
| 691 | ] |
| 692 | ); |
| 693 | |
| 694 | $this->add_responsive_control( |
| 695 | 'eael_countdown_container_margin_bottom', |
| 696 | [ |
| 697 | 'label' => esc_html__( 'Space Below Container', 'essential-addons-for-elementor-lite' ), |
| 698 | 'type' => Controls_Manager::SLIDER, |
| 699 | 'default' => [ |
| 700 | 'size' => 0, |
| 701 | ], |
| 702 | 'range' => [ |
| 703 | 'px' => [ |
| 704 | 'min' => 0, |
| 705 | 'max' => 100, |
| 706 | ], |
| 707 | ], |
| 708 | 'selectors' => [ |
| 709 | '{{WRAPPER}} .eael-countdown-container' => 'margin-bottom:{{SIZE}}px;', |
| 710 | ], |
| 711 | ] |
| 712 | ); |
| 713 | |
| 714 | $this->add_responsive_control( |
| 715 | 'eael_countdown_box_padding', |
| 716 | [ |
| 717 | 'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 718 | 'type' => Controls_Manager::DIMENSIONS, |
| 719 | 'size_units' => ['px', '%', 'em'], |
| 720 | 'selectors' => [ |
| 721 | '{{WRAPPER}} .eael-countdown-item > div' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 722 | ], |
| 723 | ] |
| 724 | ); |
| 725 | |
| 726 | $this->add_group_control( |
| 727 | Group_Control_Border::get_type(), |
| 728 | [ |
| 729 | 'name' => 'eael_countdown_box_border', |
| 730 | 'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite' ), |
| 731 | 'selector' => '{{WRAPPER}} .eael-countdown-item > div', |
| 732 | ] |
| 733 | ); |
| 734 | |
| 735 | $this->add_control( |
| 736 | 'eael_countdown_box_border_radius', |
| 737 | [ |
| 738 | 'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 739 | 'type' => Controls_Manager::DIMENSIONS, |
| 740 | 'selectors' => [ |
| 741 | '{{WRAPPER}} .eael-countdown-item > div' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', |
| 742 | ], |
| 743 | ] |
| 744 | ); |
| 745 | |
| 746 | $this->add_group_control( |
| 747 | Group_Control_Box_Shadow::get_type(), |
| 748 | [ |
| 749 | 'name' => 'eael_countdown_box_shadow', |
| 750 | 'selector' => '{{WRAPPER}} .eael-countdown-item > div', |
| 751 | ] |
| 752 | ); |
| 753 | |
| 754 | $this->end_controls_section(); |
| 755 | |
| 756 | $this->start_controls_section( |
| 757 | 'eael_section_countdown_styles_content', |
| 758 | [ |
| 759 | 'label' => esc_html__( 'Color & Typography', 'essential-addons-for-elementor-lite' ), |
| 760 | 'tab' => Controls_Manager::TAB_STYLE, |
| 761 | ] |
| 762 | ); |
| 763 | |
| 764 | $this->add_control( |
| 765 | 'eael_countdown_digits_heading', |
| 766 | [ |
| 767 | 'label' => __( 'Countdown Digits', 'essential-addons-for-elementor-lite' ), |
| 768 | 'type' => Controls_Manager::HEADING, |
| 769 | ] |
| 770 | ); |
| 771 | |
| 772 | $this->add_control( |
| 773 | 'eael_countdown_digits_color', |
| 774 | [ |
| 775 | 'label' => esc_html__( 'Digits Color', 'essential-addons-for-elementor-lite' ), |
| 776 | 'type' => Controls_Manager::COLOR, |
| 777 | 'default' => '#fec503', |
| 778 | 'selectors' => [ |
| 779 | '{{WRAPPER}} .eael-countdown-digits' => 'color: {{VALUE}};', |
| 780 | ], |
| 781 | ] |
| 782 | ); |
| 783 | |
| 784 | $this->add_group_control( |
| 785 | Group_Control_Typography::get_type(), |
| 786 | [ |
| 787 | 'name' => 'eael_countdown_digit_typography', |
| 788 | 'global' => [ |
| 789 | 'default' => Global_Typography::TYPOGRAPHY_SECONDARY |
| 790 | ], |
| 791 | 'selector' => '{{WRAPPER}} .eael-countdown-digits', |
| 792 | ] |
| 793 | ); |
| 794 | |
| 795 | $this->add_control( |
| 796 | 'eael_countdown_label_heading', |
| 797 | [ |
| 798 | 'label' => __( 'Countdown Labels', 'essential-addons-for-elementor-lite' ), |
| 799 | 'type' => Controls_Manager::HEADING, |
| 800 | ] |
| 801 | ); |
| 802 | |
| 803 | $this->add_control( |
| 804 | 'eael_countdown_label_color', |
| 805 | [ |
| 806 | 'label' => esc_html__( 'Label Color', 'essential-addons-for-elementor-lite' ), |
| 807 | 'type' => Controls_Manager::COLOR, |
| 808 | 'default' => '', |
| 809 | 'selectors' => [ |
| 810 | '{{WRAPPER}} .eael-countdown-label' => 'color: {{VALUE}};', |
| 811 | ], |
| 812 | ] |
| 813 | ); |
| 814 | |
| 815 | $this->add_group_control( |
| 816 | Group_Control_Typography::get_type(), |
| 817 | [ |
| 818 | 'name' => 'eael_countdown_label_typography', |
| 819 | 'global' => [ |
| 820 | 'default' => Global_Typography::TYPOGRAPHY_SECONDARY |
| 821 | ], |
| 822 | 'selector' => '{{WRAPPER}} .eael-countdown-label', |
| 823 | ] |
| 824 | ); |
| 825 | |
| 826 | $this->end_controls_section(); |
| 827 | |
| 828 | $this->start_controls_section( |
| 829 | 'eael_section_countdown_styles_individual', |
| 830 | [ |
| 831 | 'label' => esc_html__( 'Individual Box Styling', 'essential-addons-for-elementor-lite' ), |
| 832 | 'tab' => Controls_Manager::TAB_STYLE, |
| 833 | ] |
| 834 | ); |
| 835 | |
| 836 | $this->add_control( |
| 837 | 'eael_countdown_days_label_heading', |
| 838 | [ |
| 839 | 'label' => __( 'Days', 'essential-addons-for-elementor-lite' ), |
| 840 | 'type' => Controls_Manager::HEADING, |
| 841 | ] |
| 842 | ); |
| 843 | |
| 844 | $this->add_group_control( |
| 845 | \Elementor\Group_Control_Background::get_type(), |
| 846 | [ |
| 847 | 'name' => 'eael_countdown_days_background_color', |
| 848 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 849 | 'types' => ['classic', 'gradient'], |
| 850 | 'selector' => '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-days', |
| 851 | 'condition' => [ |
| 852 | 'eael_countdown_is_gradient' => 'yes', |
| 853 | ], |
| 854 | ] |
| 855 | ); |
| 856 | |
| 857 | $this->add_control( |
| 858 | 'eael_countdown_days_background_color', |
| 859 | [ |
| 860 | 'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 861 | 'type' => Controls_Manager::COLOR, |
| 862 | 'default' => '', |
| 863 | 'selectors' => [ |
| 864 | '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-days' => 'background-color: {{VALUE}};', |
| 865 | ], |
| 866 | 'condition' => [ |
| 867 | 'eael_countdown_is_gradient' => '', |
| 868 | ], |
| 869 | ] |
| 870 | ); |
| 871 | |
| 872 | $this->add_control( |
| 873 | 'eael_countdown_days_digit_color', |
| 874 | [ |
| 875 | 'label' => esc_html__( 'Digit Color', 'essential-addons-for-elementor-lite' ), |
| 876 | 'type' => Controls_Manager::COLOR, |
| 877 | 'default' => '', |
| 878 | 'selectors' => [ |
| 879 | '{{WRAPPER}} .eael-countdown-days .eael-countdown-digits' => 'color: {{VALUE}};', |
| 880 | ], |
| 881 | ] |
| 882 | ); |
| 883 | |
| 884 | $this->add_control( |
| 885 | 'eael_countdown_days_label_color', |
| 886 | [ |
| 887 | 'label' => esc_html__( 'Label Color', 'essential-addons-for-elementor-lite' ), |
| 888 | 'type' => Controls_Manager::COLOR, |
| 889 | 'default' => '', |
| 890 | 'selectors' => [ |
| 891 | '{{WRAPPER}} .eael-countdown-days .eael-countdown-label' => 'color: {{VALUE}};', |
| 892 | ], |
| 893 | ] |
| 894 | ); |
| 895 | |
| 896 | $this->add_control( |
| 897 | 'eael_countdown_days_border_color', |
| 898 | [ |
| 899 | 'label' => esc_html__( 'Border Color', 'essential-addons-for-elementor-lite' ), |
| 900 | 'type' => Controls_Manager::COLOR, |
| 901 | 'default' => '', |
| 902 | 'selectors' => [ |
| 903 | '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-days' => 'border-color: {{VALUE}};', |
| 904 | ], |
| 905 | ] |
| 906 | ); |
| 907 | |
| 908 | $this->add_control( |
| 909 | 'eael_countdown_hours_label_heading', |
| 910 | [ |
| 911 | 'label' => __( 'Hours', 'essential-addons-for-elementor-lite' ), |
| 912 | 'type' => Controls_Manager::HEADING, |
| 913 | ] |
| 914 | ); |
| 915 | |
| 916 | $this->add_group_control( |
| 917 | \Elementor\Group_Control_Background::get_type(), |
| 918 | [ |
| 919 | 'name' => 'eael_countdown_hours_background_color', |
| 920 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 921 | 'types' => ['classic', 'gradient'], |
| 922 | 'selector' => '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-hours', |
| 923 | 'condition' => [ |
| 924 | 'eael_countdown_is_gradient' => 'yes', |
| 925 | ], |
| 926 | ] |
| 927 | ); |
| 928 | |
| 929 | $this->add_control( |
| 930 | 'eael_countdown_hours_background_color', |
| 931 | [ |
| 932 | 'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 933 | 'type' => Controls_Manager::COLOR, |
| 934 | 'default' => '', |
| 935 | 'selectors' => [ |
| 936 | '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-hours' => 'background-color: {{VALUE}};', |
| 937 | ], |
| 938 | 'condition' => [ |
| 939 | 'eael_countdown_is_gradient' => '', |
| 940 | ], |
| 941 | ] |
| 942 | ); |
| 943 | |
| 944 | $this->add_control( |
| 945 | 'eael_countdown_hours_digit_color', |
| 946 | [ |
| 947 | 'label' => esc_html__( 'Digit Color', 'essential-addons-for-elementor-lite' ), |
| 948 | 'type' => Controls_Manager::COLOR, |
| 949 | 'default' => '', |
| 950 | 'selectors' => [ |
| 951 | '{{WRAPPER}} .eael-countdown-hours .eael-countdown-digits' => 'color: {{VALUE}};', |
| 952 | ], |
| 953 | ] |
| 954 | ); |
| 955 | |
| 956 | $this->add_control( |
| 957 | 'eael_countdown_hours_label_color', |
| 958 | [ |
| 959 | 'label' => esc_html__( 'Label Color', 'essential-addons-for-elementor-lite' ), |
| 960 | 'type' => Controls_Manager::COLOR, |
| 961 | 'default' => '', |
| 962 | 'selectors' => [ |
| 963 | '{{WRAPPER}} .eael-countdown-hours .eael-countdown-label' => 'color: {{VALUE}};', |
| 964 | ], |
| 965 | ] |
| 966 | ); |
| 967 | |
| 968 | $this->add_control( |
| 969 | 'eael_countdown_hours_border_color', |
| 970 | [ |
| 971 | 'label' => esc_html__( 'Border Color', 'essential-addons-for-elementor-lite' ), |
| 972 | 'type' => Controls_Manager::COLOR, |
| 973 | 'default' => '', |
| 974 | 'selectors' => [ |
| 975 | '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-hours' => 'border-color: {{VALUE}};', |
| 976 | ], |
| 977 | ] |
| 978 | ); |
| 979 | |
| 980 | $this->add_control( |
| 981 | 'eael_countdown_minutes_label_heading', |
| 982 | [ |
| 983 | 'label' => __( 'Minutes', 'essential-addons-for-elementor-lite' ), |
| 984 | 'type' => Controls_Manager::HEADING, |
| 985 | ] |
| 986 | ); |
| 987 | |
| 988 | $this->add_group_control( |
| 989 | \Elementor\Group_Control_Background::get_type(), |
| 990 | [ |
| 991 | 'name' => 'eael_countdown_minutes_background_color', |
| 992 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 993 | 'types' => ['classic', 'gradient'], |
| 994 | 'selector' => '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-minutes', |
| 995 | 'condition' => [ |
| 996 | 'eael_countdown_is_gradient' => 'yes', |
| 997 | ], |
| 998 | ] |
| 999 | ); |
| 1000 | |
| 1001 | $this->add_control( |
| 1002 | 'eael_countdown_minutes_background_color', |
| 1003 | [ |
| 1004 | 'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 1005 | 'type' => Controls_Manager::COLOR, |
| 1006 | 'default' => '', |
| 1007 | 'selectors' => [ |
| 1008 | '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-minutes' => 'background-color: {{VALUE}};', |
| 1009 | ], |
| 1010 | 'condition' => [ |
| 1011 | 'eael_countdown_is_gradient' => '', |
| 1012 | ], |
| 1013 | ] |
| 1014 | ); |
| 1015 | |
| 1016 | $this->add_control( |
| 1017 | 'eael_countdown_minutes_digit_color', |
| 1018 | [ |
| 1019 | 'label' => esc_html__( 'Digit Color', 'essential-addons-for-elementor-lite' ), |
| 1020 | 'type' => Controls_Manager::COLOR, |
| 1021 | 'default' => '', |
| 1022 | 'selectors' => [ |
| 1023 | '{{WRAPPER}} .eael-countdown-minutes .eael-countdown-digits' => 'color: {{VALUE}};', |
| 1024 | ], |
| 1025 | ] |
| 1026 | ); |
| 1027 | |
| 1028 | $this->add_control( |
| 1029 | 'eael_countdown_minutes_label_color', |
| 1030 | [ |
| 1031 | 'label' => esc_html__( 'Label Color', 'essential-addons-for-elementor-lite' ), |
| 1032 | 'type' => Controls_Manager::COLOR, |
| 1033 | 'default' => '', |
| 1034 | 'selectors' => [ |
| 1035 | '{{WRAPPER}} .eael-countdown-minutes .eael-countdown-label' => 'color: {{VALUE}};', |
| 1036 | ], |
| 1037 | ] |
| 1038 | ); |
| 1039 | |
| 1040 | $this->add_control( |
| 1041 | 'eael_countdown_minutes_border_color', |
| 1042 | [ |
| 1043 | 'label' => esc_html__( 'Border Color', 'essential-addons-for-elementor-lite' ), |
| 1044 | 'type' => Controls_Manager::COLOR, |
| 1045 | 'default' => '', |
| 1046 | 'selectors' => [ |
| 1047 | '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-minutes' => 'border-color: {{VALUE}};', |
| 1048 | ], |
| 1049 | ] |
| 1050 | ); |
| 1051 | |
| 1052 | $this->add_control( |
| 1053 | 'eael_countdown_seconds_label_heading', |
| 1054 | [ |
| 1055 | 'label' => __( 'Seconds', 'essential-addons-for-elementor-lite' ), |
| 1056 | 'type' => Controls_Manager::HEADING, |
| 1057 | ] |
| 1058 | ); |
| 1059 | |
| 1060 | $this->add_group_control( |
| 1061 | \Elementor\Group_Control_Background::get_type(), |
| 1062 | [ |
| 1063 | 'name' => 'eael_countdown_seconds_background_color', |
| 1064 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 1065 | 'types' => ['classic', 'gradient'], |
| 1066 | 'selector' => '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-seconds', |
| 1067 | 'condition' => [ |
| 1068 | 'eael_countdown_is_gradient' => 'yes', |
| 1069 | ], |
| 1070 | ] |
| 1071 | ); |
| 1072 | |
| 1073 | $this->add_control( |
| 1074 | 'eael_countdown_seconds_background_color', |
| 1075 | [ |
| 1076 | 'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 1077 | 'type' => Controls_Manager::COLOR, |
| 1078 | 'default' => '', |
| 1079 | 'selectors' => [ |
| 1080 | '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-seconds' => 'background-color: {{VALUE}};', |
| 1081 | ], |
| 1082 | 'condition' => [ |
| 1083 | 'eael_countdown_is_gradient' => '', |
| 1084 | ], |
| 1085 | ] |
| 1086 | ); |
| 1087 | |
| 1088 | $this->add_control( |
| 1089 | 'eael_countdown_seconds_digit_color', |
| 1090 | [ |
| 1091 | 'label' => esc_html__( 'Digit Color', 'essential-addons-for-elementor-lite' ), |
| 1092 | 'type' => Controls_Manager::COLOR, |
| 1093 | 'default' => '', |
| 1094 | 'selectors' => [ |
| 1095 | '{{WRAPPER}} .eael-countdown-seconds .eael-countdown-digits' => 'color: {{VALUE}};', |
| 1096 | ], |
| 1097 | ] |
| 1098 | ); |
| 1099 | |
| 1100 | $this->add_control( |
| 1101 | 'eael_countdown_seconds_label_color', |
| 1102 | [ |
| 1103 | 'label' => esc_html__( 'Label Color', 'essential-addons-for-elementor-lite' ), |
| 1104 | 'type' => Controls_Manager::COLOR, |
| 1105 | 'default' => '', |
| 1106 | 'selectors' => [ |
| 1107 | '{{WRAPPER}} .eael-countdown-seconds .eael-countdown-label' => 'color: {{VALUE}};', |
| 1108 | ], |
| 1109 | ] |
| 1110 | ); |
| 1111 | |
| 1112 | $this->add_control( |
| 1113 | 'eael_countdown_seconds_border_color', |
| 1114 | [ |
| 1115 | 'label' => esc_html__( 'Border Color', 'essential-addons-for-elementor-lite' ), |
| 1116 | 'type' => Controls_Manager::COLOR, |
| 1117 | 'default' => '', |
| 1118 | 'selectors' => [ |
| 1119 | '{{WRAPPER}} .eael-countdown-item > div.eael-countdown-seconds' => 'border-color: {{VALUE}};', |
| 1120 | ], |
| 1121 | ] |
| 1122 | ); |
| 1123 | |
| 1124 | $this->end_controls_section(); |
| 1125 | |
| 1126 | $this->start_controls_section( |
| 1127 | 'eael_section_countdown_expire_style', |
| 1128 | [ |
| 1129 | 'label' => esc_html__( 'Expire Message', 'essential-addons-for-elementor-lite' ), |
| 1130 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1131 | 'condition' => [ |
| 1132 | 'countdown_expire_type' => 'text', |
| 1133 | ], |
| 1134 | ] |
| 1135 | ); |
| 1136 | |
| 1137 | $this->add_responsive_control( |
| 1138 | 'eael_countdown_expire_message_alignment', |
| 1139 | [ |
| 1140 | 'label' => esc_html__( 'Text Alignment', 'essential-addons-for-elementor-lite' ), |
| 1141 | 'type' => Controls_Manager::CHOOSE, |
| 1142 | 'label_block' => true, |
| 1143 | 'options' => [ |
| 1144 | 'left' => [ |
| 1145 | 'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite' ), |
| 1146 | 'icon' => 'eicon-text-align-left', |
| 1147 | ], |
| 1148 | 'center' => [ |
| 1149 | 'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite' ), |
| 1150 | 'icon' => 'eicon-text-align-center', |
| 1151 | ], |
| 1152 | 'right' => [ |
| 1153 | 'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite' ), |
| 1154 | 'icon' => 'eicon-text-align-right', |
| 1155 | ], |
| 1156 | ], |
| 1157 | 'default' => 'left', |
| 1158 | 'selectors' => [ |
| 1159 | '{{WRAPPER}} .eael-countdown-finish-message' => 'text-align: {{VALUE}};', |
| 1160 | ], |
| 1161 | ] |
| 1162 | ); |
| 1163 | |
| 1164 | $this->add_control( |
| 1165 | 'heading_eael_countdown_expire_title', |
| 1166 | [ |
| 1167 | 'label' => __( 'Title Style', 'essential-addons-for-elementor-lite' ), |
| 1168 | 'type' => Controls_Manager::HEADING, |
| 1169 | 'separator' => 'before', |
| 1170 | ] |
| 1171 | ); |
| 1172 | |
| 1173 | $this->add_control( |
| 1174 | 'eael_countdown_expire_title_color', |
| 1175 | [ |
| 1176 | 'label' => esc_html__( 'Title Color', 'essential-addons-for-elementor-lite' ), |
| 1177 | 'type' => Controls_Manager::COLOR, |
| 1178 | 'default' => '', |
| 1179 | 'selectors' => [ |
| 1180 | '{{WRAPPER}} .eael-countdown-finish-message .expiry-title' => 'color: {{VALUE}};', |
| 1181 | ], |
| 1182 | 'condition' => [ |
| 1183 | 'countdown_expire_type' => 'text', |
| 1184 | ], |
| 1185 | ] |
| 1186 | ); |
| 1187 | |
| 1188 | $this->add_group_control( |
| 1189 | Group_Control_Typography::get_type(), |
| 1190 | [ |
| 1191 | 'name' => 'eael_countdown_expire_title_typography', |
| 1192 | 'global' => [ |
| 1193 | 'default' => Global_Typography::TYPOGRAPHY_SECONDARY |
| 1194 | ], |
| 1195 | 'selector' => '{{WRAPPER}} .eael-countdown-finish-message .expiry-title', |
| 1196 | 'condition' => [ |
| 1197 | 'countdown_expire_type' => 'text', |
| 1198 | ], |
| 1199 | ] |
| 1200 | ); |
| 1201 | |
| 1202 | $this->add_responsive_control( |
| 1203 | 'eael_expire_title_margin', |
| 1204 | [ |
| 1205 | 'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 1206 | 'type' => Controls_Manager::DIMENSIONS, |
| 1207 | 'size_units' => ['px', 'em'], |
| 1208 | 'selectors' => [ |
| 1209 | '{{WRAPPER}} .eael-countdown-finish-message .expiry-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1210 | ], |
| 1211 | ] |
| 1212 | ); |
| 1213 | |
| 1214 | $this->add_control( |
| 1215 | 'heading_eael_countdown_expire_message', |
| 1216 | [ |
| 1217 | 'label' => __( 'Content Style', 'essential-addons-for-elementor-lite' ), |
| 1218 | 'type' => Controls_Manager::HEADING, |
| 1219 | 'separator' => 'before', |
| 1220 | ] |
| 1221 | ); |
| 1222 | |
| 1223 | $this->add_control( |
| 1224 | 'eael_countdown_expire_message_color', |
| 1225 | [ |
| 1226 | 'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite' ), |
| 1227 | 'type' => Controls_Manager::COLOR, |
| 1228 | 'default' => '', |
| 1229 | 'selectors' => [ |
| 1230 | '{{WRAPPER}} .eael-countdown-finish-text' => 'color: {{VALUE}};', |
| 1231 | ], |
| 1232 | 'condition' => [ |
| 1233 | 'countdown_expire_type' => 'text', |
| 1234 | ], |
| 1235 | ] |
| 1236 | ); |
| 1237 | |
| 1238 | $this->add_group_control( |
| 1239 | Group_Control_Typography::get_type(), |
| 1240 | [ |
| 1241 | 'name' => 'eael_countdown_expire_message_typography', |
| 1242 | 'global' => [ |
| 1243 | 'default' => Global_Typography::TYPOGRAPHY_SECONDARY |
| 1244 | ], |
| 1245 | 'selector' => '.eael-countdown-finish-text', |
| 1246 | 'condition' => [ |
| 1247 | 'countdown_expire_type' => 'text', |
| 1248 | ], |
| 1249 | ] |
| 1250 | ); |
| 1251 | |
| 1252 | $this->add_responsive_control( |
| 1253 | 'eael_countdown_expire_message_padding', |
| 1254 | [ |
| 1255 | 'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 1256 | 'type' => Controls_Manager::DIMENSIONS, |
| 1257 | 'size_units' => ['px', '%', 'em'], |
| 1258 | 'separator' => 'before', |
| 1259 | 'selectors' => [ |
| 1260 | '{{WRAPPER}} .eael-countdown-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1261 | ], |
| 1262 | 'condition' => [ |
| 1263 | 'countdown_expire_type' => 'text', |
| 1264 | ], |
| 1265 | ] |
| 1266 | ); |
| 1267 | |
| 1268 | $this->end_controls_section(); |
| 1269 | |
| 1270 | } |
| 1271 | |
| 1272 | protected function render() { |
| 1273 | |
| 1274 | $settings = $this->get_settings_for_display(); |
| 1275 | |
| 1276 | $get_due_date = esc_attr( $settings['eael_countdown_due_time'] ); |
| 1277 | $due_date = date( "M d Y G:i:s", strtotime( $get_due_date ) ); |
| 1278 | $gmt_offset = str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), ( get_option( 'gmt_offset' ) < 0 ? '' : '+' ) . get_option( 'gmt_offset' ) ); |
| 1279 | |
| 1280 | $this->add_render_attribute( 'eael-countdown', 'class', 'eael-countdown-wrapper' ); |
| 1281 | $this->add_render_attribute( 'eael-countdown', 'data-countdown-id', esc_attr( $this->get_id() ) ); |
| 1282 | $this->add_render_attribute( 'eael-countdown', 'data-expire-type', $settings['countdown_expire_type'] ); |
| 1283 | $this->add_render_attribute( 'eael-countdown', 'data-countdown-type', $settings['eael_countdown_type'] ); |
| 1284 | |
| 1285 | if ( $settings['eael_countdown_type'] === 'evergreen' ) { |
| 1286 | $hour = absint( $settings['eael_evergreen_counter_hours'] ) * HOUR_IN_SECONDS; |
| 1287 | $minute = absint( $settings['eael_evergreen_counter_minutes'] ) * MINUTE_IN_SECONDS; |
| 1288 | $this->add_render_attribute( 'eael-countdown', 'data-evergreen-time', absint( $hour + $minute ) ); |
| 1289 | |
| 1290 | if ( $settings['eael_evergreen_counter_recurring'] === 'yes' ) { |
| 1291 | $this->add_render_attribute( 'eael-countdown', 'data-evergreen-recurring', $settings['eael_evergreen_counter_recurring_restart_after'] ? $settings['eael_evergreen_counter_recurring_restart_after'] : 0 ); |
| 1292 | $this->add_render_attribute( 'eael-countdown', 'data-evergreen-recurring-stop', date( "M d Y G:i:s", strtotime( $settings['eael_evergreen_counter_recurring_stop_time'] ) ) . " {$gmt_offset}" ); |
| 1293 | } |
| 1294 | } |
| 1295 | |
| 1296 | if ( $settings['countdown_expire_type'] == 'text' ) { |
| 1297 | if ( !empty( $settings['countdown_expiry_text'] ) ) { |
| 1298 | $this->add_render_attribute( 'eael-countdown', 'data-expiry-text', wp_kses_post( $settings['countdown_expiry_text'] ) ); |
| 1299 | } |
| 1300 | |
| 1301 | if ( !empty( $settings['countdown_expiry_text_title'] ) ) { |
| 1302 | $this->add_render_attribute( 'eael-countdown', 'data-expiry-title', wp_kses_post( $settings['countdown_expiry_text_title'] ) ); |
| 1303 | } |
| 1304 | } elseif ( $settings['countdown_expire_type'] == 'url' ) { |
| 1305 | $this->add_render_attribute( 'eael-countdown', 'data-redirect-url', $settings['countdown_expiry_redirection'] ); |
| 1306 | } elseif ( $settings['countdown_expire_type'] == 'template' ) { |
| 1307 | //$this->add_render_attribute( 'eael-countdown', 'data-template', esc_attr( $template ) ); |
| 1308 | } else { |
| 1309 | //do nothing |
| 1310 | } |
| 1311 | // separator |
| 1312 | $separator = ''; |
| 1313 | if ( $settings['eael_countdown_separator'] === 'eael-countdown-show-separator' ) { |
| 1314 | $separator = 'eael-countdown-show-separator eael-countdown-separator-' . $settings['eael_countdown_separator_style']; |
| 1315 | } |
| 1316 | |
| 1317 | // label view |
| 1318 | $this->add_render_attribute( 'eael-countdown-container', [ |
| 1319 | 'class' => [ |
| 1320 | 'eael-countdown-container', |
| 1321 | $settings['eael_countdown_label_view'], |
| 1322 | empty( $settings['eael_countdown_label_view_tablet'] ) ? '' : $settings['eael_countdown_label_view_tablet'] . '-tablet', |
| 1323 | empty( $settings['eael_countdown_label_view_mobile'] ) ? '' : $settings['eael_countdown_label_view_mobile'] . '-mobile', |
| 1324 | $separator, |
| 1325 | ], |
| 1326 | ] ); |
| 1327 | ?> |
| 1328 | |
| 1329 | <div <?php $this->print_render_attribute_string( 'eael-countdown' ); ?>> |
| 1330 | <div <?php $this->print_render_attribute_string( 'eael-countdown-container' ); ?>> |
| 1331 | <?php if( 'due_date' === $settings['eael_countdown_type'] && current_time( 'timestamp' ) > strtotime( $get_due_date ) && 'template' == $settings['countdown_expire_type'] ) : |
| 1332 | if ( ! empty( $settings['countdown_expiry_templates'] ) ) { |
| 1333 | // WPML Compatibility |
| 1334 | if ( ! is_array( $settings['countdown_expiry_templates'] ) ) { |
| 1335 | $settings['countdown_expiry_templates'] = apply_filters( 'wpml_object_id', $settings['countdown_expiry_templates'], 'wp_template', true ); |
| 1336 | } |
| 1337 | echo Plugin::$instance->frontend->get_builder_content( $settings['countdown_expiry_templates'], true ); |
| 1338 | } ?> |
| 1339 | <?php else: ?> |
| 1340 | <ul id="eael-countdown-<?php echo esc_attr( $this->get_id() ); ?>" class="eael-countdown-items" data-date="<?php echo esc_attr( "{$due_date} {$gmt_offset}" ); ?>"> |
| 1341 | <?php if ( !empty( $settings['eael_countdown_days'] ) ): ?><li class="eael-countdown-item"><div class="eael-countdown-days"><span data-days class="eael-countdown-digits">00</span><?php if ( !empty( $settings['eael_countdown_days_label'] ) ): ?><span class="eael-countdown-label"><?php echo esc_attr( $settings['eael_countdown_days_label'] ); ?></span><?php endif;?></div></li><?php endif;?> |
| 1342 | <?php if ( !empty( $settings['eael_countdown_hours'] ) ): ?><li class="eael-countdown-item"><div class="eael-countdown-hours"><span data-hours class="eael-countdown-digits">00</span><?php if ( !empty( $settings['eael_countdown_hours_label'] ) ): ?><span class="eael-countdown-label"><?php echo esc_attr( $settings['eael_countdown_hours_label'] ); ?></span><?php endif;?></div></li><?php endif;?> |
| 1343 | <?php if ( !empty( $settings['eael_countdown_minutes'] ) ): ?><li class="eael-countdown-item"><div class="eael-countdown-minutes"><span data-minutes class="eael-countdown-digits">00</span><?php if ( !empty( $settings['eael_countdown_minutes_label'] ) ): ?><span class="eael-countdown-label"><?php echo esc_attr( $settings['eael_countdown_minutes_label'] ); ?></span><?php endif;?></div></li><?php endif;?> |
| 1344 | <?php if ( !empty( $settings['eael_countdown_seconds'] ) ): ?><li class="eael-countdown-item"><div class="eael-countdown-seconds"><span data-seconds class="eael-countdown-digits">00</span><?php if ( !empty( $settings['eael_countdown_seconds_label'] ) ): ?><span class="eael-countdown-label"><?php echo esc_attr( $settings['eael_countdown_seconds_label'] ); ?></span><?php endif;?></div></li><?php endif;?> |
| 1345 | </ul> |
| 1346 | <div class="eael-countdown-expiry-template" style="display: none;"> |
| 1347 | <?php |
| 1348 | if ( 'template' == $settings['countdown_expire_type'] ) { |
| 1349 | if ( ! empty( $settings['countdown_expiry_templates'] ) ) { |
| 1350 | // WPML Compatibility |
| 1351 | if ( ! is_array( $settings['countdown_expiry_templates'] ) ) { |
| 1352 | $settings['countdown_expiry_templates'] = apply_filters( 'wpml_object_id', $settings['countdown_expiry_templates'], 'wp_template', true ); |
| 1353 | } |
| 1354 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1355 | echo Plugin::$instance->frontend->get_builder_content( $settings['countdown_expiry_templates'], true ); |
| 1356 | } |
| 1357 | } |
| 1358 | ?> |
| 1359 | </div> |
| 1360 | <?php endif; ?> |
| 1361 | |
| 1362 | <div class="clearfix"></div> |
| 1363 | </div> |
| 1364 | </div> |
| 1365 | |
| 1366 | <?php |
| 1367 | |
| 1368 | } |
| 1369 | } |
| 1370 |