| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -namespace Easyel\EasyElements\Widgets; | |
| 3 | 2 | use Elementor\Controls_Manager; |
| 4 | 3 | use Elementor\Group_Control_Typography; |
| 5 | 4 | |
| 6 | 5 | defined( 'ABSPATH' ) || die(); |
| @@ -6,8 +5,27 @@ | ||
| 6 | 5 | defined( 'ABSPATH' ) || die(); |
| 7 | 6 | |
| 8 | 7 | class Easyel_Count_Down_Widget extends \Elementor\Widget_Base { |
| 9 | 8 | |
| 9 | + public function get_style_depends() { | |
| 10 | + $handle = 'eel-countdown-style'; | |
| 11 | + $css_path = plugin_dir_path( __FILE__ ) . 'css/countdown.css'; | |
| 12 | + | |
| 13 | + if ( ! wp_style_is( $handle, 'registered' ) && file_exists( $css_path ) ) { | |
| 14 | + wp_register_style( $handle, plugins_url( 'css/countdown.css', __FILE__ ), [], defined( 'WP_DEBUG' ) && WP_DEBUG ? filemtime( $css_path ) : EASYELEMENTS_VER ); | |
| 15 | + } | |
| 16 | + return [ $handle ]; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public function get_script_depends() { | |
| 20 | + $handle = 'eel-countdown-script'; | |
| 21 | + $js_path = plugin_dir_path( __FILE__ ) . 'js/countdown.js'; | |
| 22 | + if ( ! wp_script_is( $handle, 'registered' ) && file_exists( $js_path ) ) { | |
| 23 | + wp_register_script( $handle, plugins_url( 'js/countdown.js', __FILE__ ), [ 'jquery' ], filemtime( $js_path ), true ); | |
| 24 | + } | |
| 25 | + return [ $handle ]; | |
| 26 | + } | |
| 27 | + | |
| 10 | 28 | public function get_name() { |
| 11 | 29 | return 'eel-countdown'; |
| 12 | 30 | } |
| 13 | 31 | |
| @@ -15,9 +33,9 @@ | ||
| 15 | 33 | return __( 'Countdown', 'easy-elements' ); |
| 16 | 34 | } |
| 17 | 35 | |
| 18 | 36 | public function get_icon() { |
| 19 | - return 'easyicon easyelIcon-countdown'; | |
| 37 | + return 'easyicon eicon-countdown'; | |
| 20 | 38 | } |
| 21 | 39 | |
| 22 | 40 | public function get_categories() { |
| 23 | 41 | return [ 'easyelements_category' ]; |
| @@ -23,23 +41,11 @@ | ||
| 23 | 41 | return [ 'easyelements_category' ]; |
| 24 | 42 | } |
| 25 | 43 | |
| 26 | 44 | public function get_keywords() { |
| 27 | - return [ 'Countdown', 'timer', 'schedule', 'time', 'day', 'hour', 'minute', 'second' ]; | |
| 45 | + return [ 'counter', 'Countdown' ]; | |
| 28 | 46 | } |
| 29 | 47 | |
| 30 | - public function get_style_depends() { | |
| 31 | - return [ | |
| 32 | - 'eel-countdown', | |
| 33 | - ]; | |
| 34 | - } | |
| 35 | - | |
| 36 | - public function get_script_depends() { | |
| 37 | - return [ | |
| 38 | - 'eel-countdown', | |
| 39 | - ]; | |
| 40 | - } | |
| 41 | - | |
| 42 | 48 | protected function register_controls() { |
| 43 | 49 | |
| 44 | 50 | $this->start_controls_section( |
| 45 | 51 | 'countdown_settings', |
| @@ -244,16 +250,8 @@ | ||
| 244 | 250 | $this->add_group_control( |
| 245 | 251 | \Elementor\Group_Control_Border::get_type(), |
| 246 | 252 | [ |
| 247 | 253 | 'name' => 'item_border', |
| 248 | - 'selector' => '{{WRAPPER}} .eel-cntdwn-item', | |
| 249 | - ] | |
| 250 | - ); | |
| 251 | - | |
| 252 | - $this->add_group_control( | |
| 253 | - \Elementor\Group_Control_Box_Shadow::get_type(), | |
| 254 | - [ | |
| 255 | - 'name' => 'item_box_shadow', | |
| 256 | 254 | 'selector' => '{{WRAPPER}} .eel-cntdwn-item', |
| 257 | 255 | ] |
| 258 | 256 | ); |
| 259 | 257 | |