| @@ -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 | use Elementor\Group_Control_Background; |
| 6 | 5 | |
| @@ -6,36 +5,37 @@ | ||
| 6 | 5 | |
| 7 | 6 | defined( 'ABSPATH' ) || die(); |
| 8 | 7 | |
| 9 | 8 | class Easyel_Progress_Widget extends \Elementor\Widget_Base { |
| 9 | + public function get_style_depends() { | |
| 10 | + $handle = 'eel-progress-style'; | |
| 11 | + $css_path = plugin_dir_path( __FILE__ ) . 'css/progress.css'; | |
| 12 | + | |
| 13 | + if ( ! wp_style_is( $handle, 'registered' ) && file_exists( $css_path ) ) { | |
| 14 | + wp_register_style( $handle, plugins_url( 'css/progress.css', __FILE__ ), [], defined( 'WP_DEBUG' ) && WP_DEBUG ? filemtime( $css_path ) : '1.0.0' ); | |
| 15 | + } | |
| 16 | + return [ $handle ]; | |
| 17 | + } | |
| 10 | 18 | |
| 11 | 19 | public function get_name() { |
| 12 | - return 'easyel-progress-bar'; | |
| 20 | + return 'rt-progress-bar'; | |
| 13 | 21 | } |
| 14 | 22 | |
| 15 | 23 | public function get_title() { |
| 16 | - return esc_html__( 'Progress Bar', 'easy-elements' ); | |
| 24 | + return esc_html__( 'RT Progress Bar', 'easy-elements' ); | |
| 17 | 25 | } |
| 18 | 26 | |
| 19 | 27 | public function get_icon() { |
| 20 | - return 'easyicon easyelIcon-progress-bar'; | |
| 28 | + return 'easyicon rt-e-icon'; | |
| 21 | 29 | } |
| 22 | 30 | |
| 23 | 31 | public function get_categories() { |
| 24 | - return [ 'easyelements_category' ]; | |
| 32 | + return [ 'pielements_category' ]; | |
| 25 | 33 | } |
| 26 | 34 | |
| 27 | 35 | public function get_keywords() { |
| 28 | 36 | return [ 'progress', 'text', 'link', 'circle', 'text' ]; |
| 29 | 37 | } |
| 30 | - | |
| 31 | - public function get_style_depends() { | |
| 32 | - return [ | |
| 33 | - 'easyel-progress-bar', | |
| 34 | - ]; | |
| 35 | - } | |
| 36 | - | |
| 37 | - | |
| 38 | 38 | protected function register_controls() { |
| 39 | 39 | $this->start_controls_section( |
| 40 | 40 | 'section_progress', |
| 41 | 41 | [ |
| @@ -70,9 +70,9 @@ | ||
| 70 | 70 | ] |
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | $this->add_control( |
| 74 | - 'easy_percent', | |
| 74 | + 'percent', | |
| 75 | 75 | [ |
| 76 | 76 | 'label' => __( 'Percent', 'easy-elements' ), |
| 77 | 77 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 78 | 78 | 'min' => 0, |
| @@ -95,9 +95,9 @@ | ||
| 95 | 95 | [ |
| 96 | 96 | 'label' => esc_html__( 'Progress Color', 'easy-elements' ), |
| 97 | 97 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 98 | 98 | 'selectors' => [ |
| 99 | - '{{WRAPPER}} .easyel-progress-bar .progress' => 'background: {{VALUE}}', | |
| 99 | + '{{WRAPPER}} .rt-progress-bar .progress' => 'background: {{VALUE}}', | |
| 100 | 100 | ], |
| 101 | 101 | 'condition' => [ |
| 102 | 102 | 'select_style' => 'style1' |
| 103 | 103 | ] |
| @@ -109,9 +109,9 @@ | ||
| 109 | 109 | [ |
| 110 | 110 | 'label' => esc_html__( 'Progress Bar Color', 'easy-elements' ), |
| 111 | 111 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 112 | 112 | 'selectors' => [ |
| 113 | - '{{WRAPPER}} .easyel-progress-bar .progress-bar' => 'background: {{VALUE}}', | |
| 113 | + '{{WRAPPER}} .rt-progress-bar .progress-bar' => 'background: {{VALUE}}', | |
| 114 | 114 | ], |
| 115 | 115 | 'condition' => [ |
| 116 | 116 | 'select_style' => 'style1' |
| 117 | 117 | ] |
| @@ -123,9 +123,9 @@ | ||
| 123 | 123 | \Elementor\Group_Control_Background::get_type(), |
| 124 | 124 | [ |
| 125 | 125 | 'name' => 'progress_color', |
| 126 | 126 | 'types' => [ 'classic', 'gradient', 'video' ], |
| 127 | - 'selector' => '{{WRAPPER}} .easyel-progress-bar .progress', | |
| 127 | + 'selector' => '{{WRAPPER}} .rt-progress-bar .progress', | |
| 128 | 128 | 'condition' => [ |
| 129 | 129 | 'select_style' => 'style2' |
| 130 | 130 | ] |
| 131 | 131 | ] |
| @@ -137,9 +137,9 @@ | ||
| 137 | 137 | [ |
| 138 | 138 | 'label' => esc_html__( 'Height', 'easy-elements' ), |
| 139 | 139 | 'type' => Controls_Manager::SLIDER, |
| 140 | 140 | 'selectors' => [ |
| 141 | - '{{WRAPPER}} .easyel-progress-bar .progress' => 'height: {{SIZE}}{{UNIT}};', | |
| 141 | + '{{WRAPPER}} .rt-progress-bar .progress' => 'height: {{SIZE}}{{UNIT}};', | |
| 142 | 142 | ], |
| 143 | 143 | ] |
| 144 | 144 | ); |
| 145 | 145 | |
| @@ -147,9 +147,9 @@ | ||
| 147 | 147 | 'progress_radius',[ |
| 148 | 148 | 'label' => esc_html__( 'Border Radius', 'easy-elements' ), |
| 149 | 149 | 'type' => Controls_Manager::SLIDER, |
| 150 | 150 | 'selectors' => [ |
| 151 | - '{{WRAPPER}} .easyel-progress-bar .progress' => 'border-radius: {{SIZE}}{{UNIT}};', | |
| 151 | + '{{WRAPPER}} .rt-progress-bar .progress' => 'border-radius: {{SIZE}}{{UNIT}};', | |
| 152 | 152 | ] |
| 153 | 153 | ] |
| 154 | 154 | ); |
| 155 | 155 | |
| @@ -168,9 +168,9 @@ | ||
| 168 | 168 | [ |
| 169 | 169 | 'label' => esc_html__( 'Color', 'easy-elements' ), |
| 170 | 170 | 'type' => Controls_Manager::COLOR, |
| 171 | 171 | 'selectors' => [ |
| 172 | - '{{WRAPPER}} .easyel-progress-bar .title' => 'color: {{VALUE}};', | |
| 172 | + '{{WRAPPER}} .rt-progress-bar .title' => 'color: {{VALUE}};', | |
| 173 | 173 | ], |
| 174 | 174 | ] |
| 175 | 175 | ); |
| 176 | 176 | |
| @@ -177,15 +177,15 @@ | ||
| 177 | 177 | $this->add_group_control( |
| 178 | 178 | Group_Control_Typography::get_type(), |
| 179 | 179 | [ |
| 180 | 180 | 'name' => 'title_typography', |
| 181 | - 'selector' => '{{WRAPPER}} .easyel-progress-bar .title', | |
| 181 | + 'selector' => '{{WRAPPER}} .rt-progress-bar .title', | |
| 182 | 182 | ] |
| 183 | 183 | ); |
| 184 | 184 | $this->end_controls_section(); |
| 185 | 185 | |
| 186 | 186 | $this->start_controls_section( |
| 187 | - 'easy_percent_styles', | |
| 187 | + 'percent_styles', | |
| 188 | 188 | [ |
| 189 | 189 | 'label' => esc_html__( 'Percent', 'easy-elements' ), |
| 190 | 190 | 'tab' => Controls_Manager::TAB_STYLE, |
| 191 | 191 | ] |
| @@ -190,14 +190,14 @@ | ||
| 190 | 190 | 'tab' => Controls_Manager::TAB_STYLE, |
| 191 | 191 | ] |
| 192 | 192 | ); |
| 193 | 193 | $this->add_control( |
| 194 | - 'easy_percent_color', | |
| 194 | + 'percent_color', | |
| 195 | 195 | [ |
| 196 | 196 | 'label' => esc_html__( 'Color', 'easy-elements' ), |
| 197 | 197 | 'type' => Controls_Manager::COLOR, |
| 198 | 198 | 'selectors' => [ |
| 199 | - '{{WRAPPER}} .easyel-progress-bar .easy_percent' => 'color: {{VALUE}};', | |
| 199 | + '{{WRAPPER}} .rt-progress-bar .percent' => 'color: {{VALUE}};', | |
| 200 | 200 | ], |
| 201 | 201 | ] |
| 202 | 202 | ); |
| 203 | 203 | |
| @@ -203,10 +203,10 @@ | ||
| 203 | 203 | |
| 204 | 204 | $this->add_group_control( |
| 205 | 205 | Group_Control_Typography::get_type(), |
| 206 | 206 | [ |
| 207 | - 'name' => 'easy_percent_typography', | |
| 208 | - 'selector' => '{{WRAPPER}} .easyel-progress-bar .easy_percent', | |
| 207 | + 'name' => 'percent_typography', | |
| 208 | + 'selector' => '{{WRAPPER}} .rt-progress-bar .percent', | |
| 209 | 209 | ] |
| 210 | 210 | ); |
| 211 | 211 | $this->end_controls_section(); |
| 212 | 212 | } |
| @@ -212,12 +212,12 @@ | ||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | protected function render() { |
| 215 | 215 | $settings = $this->get_settings_for_display(); |
| 216 | - $easy_percent = !empty($settings['easy_percent']) ? rtrim($settings['easy_percent']) : 0; | |
| 216 | + $percent = !empty($settings['percent']) ? rtrim($settings['percent']) : 0; | |
| 217 | 217 | $title = !empty($settings['title']) ? $settings['title'] : ''; |
| 218 | 218 | ?> |
| 219 | - <div class="easyel-progress-bar"> | |
| 219 | + <div class="rt-progress-bar"> | |
| 220 | 220 | <?php |
| 221 | 221 | if( $settings['select_style'] == 'style2' ) : ?> |
| 222 | 222 | <div class="progress-style2"> |
| 223 | 223 | <?php if ( $title ) : ?> |
| @@ -223,11 +223,11 @@ | ||
| 223 | 223 | <?php if ( $title ) : ?> |
| 224 | 224 | <p class="title"><?php echo wp_kses_post( $title ); ?></p> |
| 225 | 225 | <?php endif; ?> |
| 226 | 226 | <div class="progress"> |
| 227 | - <div class="progress-bar wow fadeInLeft" data-wow-duration="0.5s" data-wow-delay=".3s" role="progressbar" style="width: <?php echo esc_html( $easy_percent ); ?>%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"> | |
| 227 | + <div class="progress-bar wow fadeInLeft" data-wow-duration="0.5s" data-wow-delay=".3s" role="progressbar" style="width: <?php echo esc_html( $percent ); ?>%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"> | |
| 228 | 228 | </div> |
| 229 | - <span class="easy_percent"><?php echo esc_html( $easy_percent ); ?>%</span> | |
| 229 | + <span class="percent"><?php echo esc_html( $percent ); ?>%</span> | |
| 230 | 230 | </div> |
| 231 | 231 | </div> |
| 232 | 232 | <?php |
| 233 | 233 | else : ?> |
| @@ -234,16 +234,16 @@ | ||
| 234 | 234 | <div class="progress-top"> |
| 235 | 235 | <?php if ( $title ) : ?> |
| 236 | 236 | <p class="title"><?php echo wp_kses_post( $title ); ?></p> |
| 237 | 237 | <?php endif; ?> |
| 238 | - <?php if ( $easy_percent ) : ?> | |
| 239 | - <span class="easy_percent"><?php echo esc_html( $easy_percent ); ?>%</span> | |
| 238 | + <?php if ( $percent ) : ?> | |
| 239 | + <span class="percent"><?php echo esc_html( $percent ); ?>%</span> | |
| 240 | 240 | <?php endif; ?> |
| 241 | 241 | </div> |
| 242 | 242 | <div class="progress"> |
| 243 | 243 | <div class="progress-bar" |
| 244 | - style="width: <?php echo esc_html( $easy_percent ); ?>%;" | |
| 245 | - aria-valuenow="<?php echo esc_attr( $easy_percent ); ?>" | |
| 244 | + style="width: <?php echo esc_html( $percent ); ?>%;" | |
| 245 | + aria-valuenow="<?php echo esc_attr( $percent ); ?>" | |
| 246 | 246 | aria-valuemin="0" |
| 247 | 247 | aria-valuemax="100"> |
| 248 | 248 | </div> |
| 249 | 249 | </div> |