dep
2 years ago
premium-banner.php
2 years ago
premium-blog.php
2 years ago
premium-button.php
2 years ago
premium-carousel.php
2 years ago
premium-contactform.php
2 years ago
premium-countdown.php
2 years ago
premium-counter.php
2 years ago
premium-dual-header.php
2 years ago
premium-fancytext.php
2 years ago
premium-grid.php
2 years ago
premium-icon-list.php
2 years ago
premium-image-button.php
2 years ago
premium-image-scroll.php
2 years ago
premium-image-separator.php
2 years ago
premium-lottie.php
2 years ago
premium-maps.php
2 years ago
premium-media-wheel.php
2 years ago
premium-modalbox.php
2 years ago
premium-nav-menu.php
2 years ago
premium-notifications.php
2 years ago
premium-person.php
2 years ago
premium-pinterest-feed.php
2 years ago
premium-post-ticker.php
2 years ago
premium-pricing-table.php
2 years ago
premium-progressbar.php
2 years ago
premium-search-form.php
2 years ago
premium-svg-drawer.php
2 years ago
premium-tcloud.php
2 years ago
premium-testimonials.php
2 years ago
premium-textual-showcase.php
2 years ago
premium-tiktok-feed.php
2 years ago
premium-title.php
2 years ago
premium-videobox.php
2 years ago
premium-vscroll.php
2 years ago
premium-weather.php
2 years ago
premium-world-clock.php
2 years ago
premium-progressbar.php
1942 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Premium Progress Bar. |
| 4 | */ |
| 5 | |
| 6 | namespace PremiumAddons\Widgets; |
| 7 | |
| 8 | // Elementor Classes. |
| 9 | use Elementor\Widget_Base; |
| 10 | use Elementor\Utils; |
| 11 | use Elementor\Controls_Manager; |
| 12 | use Elementor\Icons_Manager; |
| 13 | use Elementor\Repeater; |
| 14 | use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 15 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 16 | use Elementor\Group_Control_Typography; |
| 17 | use Elementor\Group_Control_Background; |
| 18 | use Elementor\Group_Control_Border; |
| 19 | |
| 20 | // PremiumAddons Classes. |
| 21 | use PremiumAddons\Admin\Includes\Admin_Helper; |
| 22 | use PremiumAddons\Includes\Helper_Functions; |
| 23 | |
| 24 | if ( ! defined( 'ABSPATH' ) ) { |
| 25 | exit; // If this file is called directly, abort. |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Class Premium_Progressbar |
| 30 | */ |
| 31 | class Premium_Progressbar extends Widget_Base { |
| 32 | |
| 33 | /** |
| 34 | * Check Icon Draw Option. |
| 35 | * |
| 36 | * @since 4.9.26 |
| 37 | * @access public |
| 38 | */ |
| 39 | public function check_icon_draw() { |
| 40 | $is_enabled = Admin_Helper::check_svg_draw( 'premium-progressbar' ); |
| 41 | return $is_enabled; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Retrieve Widget Name. |
| 46 | * |
| 47 | * @since 1.0.0 |
| 48 | * @access public |
| 49 | */ |
| 50 | public function get_name() { |
| 51 | return 'premium-addon-progressbar'; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Retrieve Widget Title. |
| 56 | * |
| 57 | * @since 1.0.0 |
| 58 | * @access public |
| 59 | */ |
| 60 | public function get_title() { |
| 61 | return __( 'Progress Bar', 'premium-addons-for-elementor' ); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Retrieve Widget Icon. |
| 66 | * |
| 67 | * @since 1.0.0 |
| 68 | * @access public |
| 69 | * |
| 70 | * @return string widget icon. |
| 71 | */ |
| 72 | public function get_icon() { |
| 73 | return 'pa-progress-bar'; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Retrieve Widget Categories. |
| 78 | * |
| 79 | * @since 1.5.1 |
| 80 | * @access public |
| 81 | * |
| 82 | * @return array Widget categories. |
| 83 | */ |
| 84 | public function get_categories() { |
| 85 | return array( 'premium-elements' ); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Retrieve Widget Dependent CSS. |
| 90 | * |
| 91 | * @since 1.0.0 |
| 92 | * @access public |
| 93 | * |
| 94 | * @return array CSS style handles. |
| 95 | */ |
| 96 | public function get_style_depends() { |
| 97 | return array( |
| 98 | 'premium-addons', |
| 99 | ); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Retrieve Widget Dependent JS. |
| 104 | * |
| 105 | * @since 1.0.0 |
| 106 | * @access public |
| 107 | * |
| 108 | * @return array JS script handles. |
| 109 | */ |
| 110 | public function get_script_depends() { |
| 111 | |
| 112 | $draw_scripts = $this->check_icon_draw() ? array( |
| 113 | 'pa-fontawesome-all', |
| 114 | 'pa-tweenmax', |
| 115 | 'pa-motionpath', |
| 116 | ) : array(); |
| 117 | |
| 118 | return array_merge( |
| 119 | $draw_scripts, |
| 120 | array( |
| 121 | 'elementor-waypoints', |
| 122 | 'lottie-js', |
| 123 | 'premium-addons', |
| 124 | ) |
| 125 | ); |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Retrieve Widget Keywords. |
| 130 | * |
| 131 | * @since 1.0.0 |
| 132 | * @access public |
| 133 | * |
| 134 | * @return string Widget keywords. |
| 135 | */ |
| 136 | public function get_keywords() { |
| 137 | return array( 'pa', 'premium', 'circle', 'chart', 'line', 'graph', 'percent' ); |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Retrieve Widget Support URL. |
| 142 | * |
| 143 | * @access public |
| 144 | * |
| 145 | * @return string support URL. |
| 146 | */ |
| 147 | public function get_custom_help_url() { |
| 148 | return 'https://premiumaddons.com/support/'; |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Register Progress Bar controls. |
| 153 | * |
| 154 | * @since 1.0.0 |
| 155 | * @access protected |
| 156 | */ |
| 157 | protected function register_controls() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
| 158 | |
| 159 | $draw_icon = $this->check_icon_draw(); |
| 160 | |
| 161 | $this->start_controls_section( |
| 162 | 'premium_progressbar_labels', |
| 163 | array( |
| 164 | 'label' => __( 'Progress Bar Settings', 'premium-addons-for-elementor' ), |
| 165 | ) |
| 166 | ); |
| 167 | |
| 168 | $this->add_control( |
| 169 | 'layout_type', |
| 170 | array( |
| 171 | 'label' => __( 'Type', 'premium-addons-for-elementor' ), |
| 172 | 'type' => Controls_Manager::SELECT, |
| 173 | 'options' => array( |
| 174 | 'line' => __( 'Line', 'premium-addons-for-elementor' ), |
| 175 | 'half-circle' => __( 'Half Circle', 'premium-addons-for-elementor' ), |
| 176 | 'circle' => __( 'Circle', 'premium-addons-for-elementor' ), |
| 177 | 'dots' => __( 'Dots', 'premium-addons-for-elementor' ), |
| 178 | ), |
| 179 | 'default' => 'line', |
| 180 | 'label_block' => true, |
| 181 | ) |
| 182 | ); |
| 183 | |
| 184 | $this->add_responsive_control( |
| 185 | 'dot_size', |
| 186 | array( |
| 187 | 'label' => __( 'Dot Size', 'premium-addons-for-elementor' ), |
| 188 | 'type' => Controls_Manager::SLIDER, |
| 189 | 'range' => array( |
| 190 | 'px' => array( |
| 191 | 'min' => 1, |
| 192 | 'max' => 60, |
| 193 | ), |
| 194 | ), |
| 195 | 'default' => array( |
| 196 | 'size' => 25, |
| 197 | 'unit' => 'px', |
| 198 | ), |
| 199 | 'condition' => array( |
| 200 | 'layout_type' => 'dots', |
| 201 | ), |
| 202 | 'render_type' => 'template', |
| 203 | 'selectors' => array( |
| 204 | '{{WRAPPER}} .progress-segment' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}', |
| 205 | ), |
| 206 | ) |
| 207 | ); |
| 208 | |
| 209 | $this->add_responsive_control( |
| 210 | 'dot_spacing', |
| 211 | array( |
| 212 | 'label' => __( 'Spacing', 'premium-addons-for-elementor' ), |
| 213 | 'type' => Controls_Manager::SLIDER, |
| 214 | 'range' => array( |
| 215 | 'px' => array( |
| 216 | 'min' => 1, |
| 217 | 'max' => 10, |
| 218 | ), |
| 219 | ), |
| 220 | 'default' => array( |
| 221 | 'size' => 8, |
| 222 | 'unit' => 'px', |
| 223 | ), |
| 224 | 'condition' => array( |
| 225 | 'layout_type' => 'dots', |
| 226 | ), |
| 227 | 'render_type' => 'template', |
| 228 | 'selectors' => array( |
| 229 | '{{WRAPPER}} .progress-segment:not(:first-child):not(:last-child)' => 'margin-right: calc( {{SIZE}}{{UNIT}}/2 ); margin-left: calc( {{SIZE}}{{UNIT}}/2 )', |
| 230 | '{{WRAPPER}} .progress-segment:first-child' => 'margin-right: calc( {{SIZE}}{{UNIT}}/2 )', |
| 231 | '{{WRAPPER}} .progress-segment:last-child' => 'margin-left: calc( {{SIZE}}{{UNIT}}/2 )', |
| 232 | ), |
| 233 | ) |
| 234 | ); |
| 235 | |
| 236 | $this->add_responsive_control( |
| 237 | 'circle_size', |
| 238 | array( |
| 239 | 'label' => __( 'Size', 'premium-addons-for-elementor' ), |
| 240 | 'type' => Controls_Manager::SLIDER, |
| 241 | 'range' => array( |
| 242 | 'px' => array( |
| 243 | 'min' => 50, |
| 244 | 'max' => 500, |
| 245 | 'step' => 1, |
| 246 | ), |
| 247 | ), |
| 248 | 'default' => array( |
| 249 | 'size' => 200, |
| 250 | ), |
| 251 | 'selectors' => array( |
| 252 | '{{WRAPPER}} .premium-progressbar-circle-wrap, {{WRAPPER}} .premium-progressbar-hf-container' => 'width: {{SIZE}}px; height: {{SIZE}}px', |
| 253 | '{{WRAPPER}} .premium-progressbar-hf-circle-wrap' => 'width: {{SIZE}}{{UNIT}}; height: calc({{SIZE}} / 2 * 1{{UNIT}});', |
| 254 | '{{WRAPPER}} .premium-progressbar-hf-labels' => 'width: {{SIZE}}{{UNIT}};', |
| 255 | ), |
| 256 | 'condition' => array( |
| 257 | 'layout_type' => array( 'half-circle', 'circle' ), |
| 258 | ), |
| 259 | ) |
| 260 | ); |
| 261 | |
| 262 | $this->add_control( |
| 263 | 'premium_progressbar_select_label', |
| 264 | array( |
| 265 | 'label' => __( 'Labels', 'premium-addons-for-elementor' ), |
| 266 | 'type' => Controls_Manager::SELECT, |
| 267 | 'default' => 'left_right_labels', |
| 268 | 'options' => array( |
| 269 | 'left_right_labels' => __( 'Left & Right Labels', 'premium-addons-for-elementor' ), |
| 270 | 'more_labels' => __( 'Multiple Labels', 'premium-addons-for-elementor' ), |
| 271 | ), |
| 272 | 'label_block' => true, |
| 273 | 'condition' => array( |
| 274 | 'layout_type!' => array( 'half-circle', 'circle' ), |
| 275 | ), |
| 276 | ) |
| 277 | ); |
| 278 | |
| 279 | $this->add_control( |
| 280 | 'premium_progressbar_left_label', |
| 281 | array( |
| 282 | 'label' => __( 'Left Label', 'premium-addons-for-elementor' ), |
| 283 | 'type' => Controls_Manager::TEXT, |
| 284 | 'dynamic' => array( 'active' => true ), |
| 285 | 'default' => __( 'My Skill', 'premium-addons-for-elementor' ), |
| 286 | 'label_block' => true, |
| 287 | 'condition' => array( |
| 288 | 'premium_progressbar_select_label' => 'left_right_labels', |
| 289 | ), |
| 290 | ) |
| 291 | ); |
| 292 | |
| 293 | $this->add_responsive_control( |
| 294 | 'title_width', |
| 295 | array( |
| 296 | 'label' => __( 'Title Max Width', 'premium-addons-for-elementor' ), |
| 297 | 'type' => Controls_Manager::SLIDER, |
| 298 | 'size_units' => array( 'px', '%', 'em' ), |
| 299 | 'selectors' => array( |
| 300 | '{{WRAPPER}} .premium-progressbar-left-label' => 'max-width: {{SIZE}}{{UNIT}}', |
| 301 | ), |
| 302 | 'condition' => array( |
| 303 | 'layout_type' => array( 'half-circle', 'circle' ), |
| 304 | ), |
| 305 | ) |
| 306 | ); |
| 307 | |
| 308 | $this->add_control( |
| 309 | 'premium_progressbar_right_label', |
| 310 | array( |
| 311 | 'label' => __( 'Right Label', 'premium-addons-for-elementor' ), |
| 312 | 'type' => Controls_Manager::TEXT, |
| 313 | 'dynamic' => array( 'active' => true ), |
| 314 | 'default' => __( '50%', 'premium-addons-for-elementor' ), |
| 315 | 'label_block' => true, |
| 316 | 'condition' => array( |
| 317 | 'premium_progressbar_select_label' => 'left_right_labels', |
| 318 | 'layout_type!' => array( 'half-circle', 'circle' ), |
| 319 | ), |
| 320 | ) |
| 321 | ); |
| 322 | |
| 323 | $common_conditions = array( |
| 324 | 'layout_type' => array( 'half-circle', 'circle' ), |
| 325 | ); |
| 326 | |
| 327 | $this->add_control( |
| 328 | 'icon_type', |
| 329 | array( |
| 330 | 'label' => __( 'Icon Type', 'premium-addons-for-elementor' ), |
| 331 | 'type' => Controls_Manager::SELECT, |
| 332 | 'options' => array( |
| 333 | 'icon' => __( 'Icon', 'premium-addons-for-elementor' ), |
| 334 | 'image' => __( 'Custom Image', 'premium-addons-for-elementor' ), |
| 335 | 'animation' => __( 'Lottie Animation', 'premium-addons-for-elementor' ), |
| 336 | 'svg' => __( 'SVG Code', 'premium-addons-for-elementor' ), |
| 337 | ), |
| 338 | 'default' => 'icon', |
| 339 | 'separator' => 'before', |
| 340 | 'condition' => $common_conditions, |
| 341 | ) |
| 342 | ); |
| 343 | |
| 344 | $this->add_control( |
| 345 | 'icon_select', |
| 346 | array( |
| 347 | 'label' => __( 'Select an Icon', 'premium-addons-for-elementor' ), |
| 348 | 'type' => Controls_Manager::ICONS, |
| 349 | 'condition' => array_merge( |
| 350 | $common_conditions, |
| 351 | array( |
| 352 | 'icon_type' => 'icon', |
| 353 | ) |
| 354 | ), |
| 355 | ) |
| 356 | ); |
| 357 | |
| 358 | $this->add_control( |
| 359 | 'image_upload', |
| 360 | array( |
| 361 | 'label' => __( 'Upload Image', 'premium-addons-for-elementor' ), |
| 362 | 'type' => Controls_Manager::MEDIA, |
| 363 | 'default' => array( |
| 364 | 'url' => Utils::get_placeholder_image_src(), |
| 365 | ), |
| 366 | 'condition' => array_merge( |
| 367 | $common_conditions, |
| 368 | array( |
| 369 | 'icon_type' => 'image', |
| 370 | ) |
| 371 | ), |
| 372 | ) |
| 373 | ); |
| 374 | |
| 375 | $this->add_control( |
| 376 | 'custom_svg', |
| 377 | array( |
| 378 | 'label' => __( 'SVG Code', 'premium-addons-for-elementor' ), |
| 379 | 'type' => Controls_Manager::TEXTAREA, |
| 380 | 'description' => 'You can use these sites to create SVGs: <a href="https://danmarshall.github.io/google-font-to-svg-path/" target="_blank">Google Fonts</a> and <a href="https://boxy-svg.com/" target="_blank">Boxy SVG</a>', |
| 381 | 'condition' => array_merge( |
| 382 | $common_conditions, |
| 383 | array( |
| 384 | 'icon_type' => 'svg', |
| 385 | ) |
| 386 | ), |
| 387 | ) |
| 388 | ); |
| 389 | |
| 390 | $this->add_control( |
| 391 | 'lottie_url', |
| 392 | array( |
| 393 | 'label' => __( 'Animation JSON URL', 'premium-addons-for-elementor' ), |
| 394 | 'type' => Controls_Manager::TEXT, |
| 395 | 'dynamic' => array( 'active' => true ), |
| 396 | 'description' => 'Get JSON code URL from <a href="https://lottiefiles.com/" target="_blank">here</a>', |
| 397 | 'label_block' => true, |
| 398 | 'condition' => array_merge( |
| 399 | $common_conditions, |
| 400 | array( |
| 401 | 'icon_type' => 'animation', |
| 402 | ) |
| 403 | ), |
| 404 | ) |
| 405 | ); |
| 406 | |
| 407 | $this->add_control( |
| 408 | 'draw_svg', |
| 409 | array( |
| 410 | 'label' => __( 'Draw Icon', 'premium-addons-for-elementor' ), |
| 411 | 'type' => Controls_Manager::SWITCHER, |
| 412 | 'classes' => $draw_icon ? '' : 'editor-pa-control-disabled', |
| 413 | 'condition' => array_merge( |
| 414 | $common_conditions, |
| 415 | array( |
| 416 | 'icon_type' => array( 'icon', 'svg' ), |
| 417 | 'icon_select[library]!' => 'svg', |
| 418 | ) |
| 419 | ), |
| 420 | ) |
| 421 | ); |
| 422 | |
| 423 | $animation_conds = array( |
| 424 | 'terms' => array( |
| 425 | array( |
| 426 | 'relation' => 'or', |
| 427 | 'terms' => array( |
| 428 | array( |
| 429 | 'name' => 'layout_type', |
| 430 | 'value' => 'half-circle', |
| 431 | ), |
| 432 | array( |
| 433 | 'name' => 'layout_type', |
| 434 | 'value' => 'circle', |
| 435 | ), |
| 436 | ), |
| 437 | ), |
| 438 | array( |
| 439 | 'relation' => 'or', |
| 440 | 'terms' => array( |
| 441 | array( |
| 442 | 'name' => 'icon_type', |
| 443 | 'value' => 'animation', |
| 444 | ), |
| 445 | array( |
| 446 | 'terms' => array( |
| 447 | array( |
| 448 | 'relation' => 'or', |
| 449 | 'terms' => array( |
| 450 | array( |
| 451 | 'name' => 'icon_type', |
| 452 | 'value' => 'icon', |
| 453 | ), |
| 454 | array( |
| 455 | 'name' => 'icon_type', |
| 456 | 'value' => 'svg', |
| 457 | ), |
| 458 | ), |
| 459 | ), |
| 460 | array( |
| 461 | 'name' => 'draw_svg', |
| 462 | 'value' => 'yes', |
| 463 | ), |
| 464 | ), |
| 465 | ), |
| 466 | ), |
| 467 | ), |
| 468 | ), |
| 469 | ); |
| 470 | |
| 471 | if ( $draw_icon ) { |
| 472 | $this->add_control( |
| 473 | 'path_width', |
| 474 | array( |
| 475 | 'label' => __( 'Path Thickness', 'premium-addons-for-elementor' ), |
| 476 | 'type' => Controls_Manager::SLIDER, |
| 477 | 'range' => array( |
| 478 | 'px' => array( |
| 479 | 'min' => 0, |
| 480 | 'max' => 50, |
| 481 | 'step' => 0.1, |
| 482 | ), |
| 483 | ), |
| 484 | 'condition' => array_merge( |
| 485 | $common_conditions, |
| 486 | array( |
| 487 | 'icon_type' => array( 'icon', 'svg' ), |
| 488 | ) |
| 489 | ), |
| 490 | 'selectors' => array( |
| 491 | '{{WRAPPER}} .premium-progressbar-circle-content svg *' => 'stroke-width: {{SIZE}}', |
| 492 | ), |
| 493 | ) |
| 494 | ); |
| 495 | |
| 496 | $this->add_control( |
| 497 | 'svg_sync', |
| 498 | array( |
| 499 | 'label' => __( 'Draw All Paths Together', 'premium-addons-for-elementor' ), |
| 500 | 'type' => Controls_Manager::SWITCHER, |
| 501 | 'condition' => array_merge( |
| 502 | $common_conditions, |
| 503 | array( |
| 504 | 'icon_type' => array( 'icon', 'svg' ), |
| 505 | 'draw_svg' => 'yes', |
| 506 | ) |
| 507 | ), |
| 508 | ) |
| 509 | ); |
| 510 | |
| 511 | $this->add_control( |
| 512 | 'frames', |
| 513 | array( |
| 514 | 'label' => __( 'Speed', 'premium-addons-for-elementor' ), |
| 515 | 'type' => Controls_Manager::NUMBER, |
| 516 | 'description' => __( 'Larger value means longer animation duration.', 'premium-addons-for-elementor' ), |
| 517 | 'default' => 5, |
| 518 | 'min' => 1, |
| 519 | 'max' => 100, |
| 520 | 'condition' => array_merge( |
| 521 | $common_conditions, |
| 522 | array( |
| 523 | 'icon_type' => array( 'icon', 'svg' ), |
| 524 | 'draw_svg' => 'yes', |
| 525 | ) |
| 526 | ), |
| 527 | ) |
| 528 | ); |
| 529 | } else { |
| 530 | |
| 531 | Helper_Functions::get_draw_svg_notice( |
| 532 | $this, |
| 533 | 'bar', |
| 534 | array_merge( |
| 535 | $common_conditions, |
| 536 | array( |
| 537 | 'icon_type' => array( 'icon', 'svg' ), |
| 538 | 'icon_select[library]!' => 'svg', |
| 539 | ) |
| 540 | ) |
| 541 | ); |
| 542 | |
| 543 | } |
| 544 | |
| 545 | $this->add_control( |
| 546 | 'lottie_loop', |
| 547 | array( |
| 548 | 'label' => __( 'Loop', 'premium-addons-for-elementor' ), |
| 549 | 'type' => Controls_Manager::SWITCHER, |
| 550 | 'return_value' => 'true', |
| 551 | 'default' => 'true', |
| 552 | 'conditions' => $animation_conds, |
| 553 | ) |
| 554 | ); |
| 555 | |
| 556 | $this->add_control( |
| 557 | 'lottie_reverse', |
| 558 | array( |
| 559 | 'label' => __( 'Reverse', 'premium-addons-for-elementor' ), |
| 560 | 'type' => Controls_Manager::SWITCHER, |
| 561 | 'return_value' => 'true', |
| 562 | 'conditions' => $animation_conds, |
| 563 | ) |
| 564 | ); |
| 565 | |
| 566 | if ( $draw_icon ) { |
| 567 | $this->add_control( |
| 568 | 'start_point', |
| 569 | array( |
| 570 | 'label' => __( 'Start Point (%)', 'premium-addons-for-elementor' ), |
| 571 | 'type' => Controls_Manager::SLIDER, |
| 572 | 'description' => __( 'Set the point that the SVG should start from.', 'premium-addons-for-elementor' ), |
| 573 | 'default' => array( |
| 574 | 'unit' => '%', |
| 575 | 'size' => 0, |
| 576 | ), |
| 577 | 'condition' => array_merge( |
| 578 | $common_conditions, |
| 579 | array( |
| 580 | 'icon_type' => array( 'icon', 'svg' ), |
| 581 | 'draw_svg' => 'yes', |
| 582 | 'lottie_reverse!' => 'true', |
| 583 | ) |
| 584 | ), |
| 585 | ) |
| 586 | ); |
| 587 | |
| 588 | $this->add_control( |
| 589 | 'end_point', |
| 590 | array( |
| 591 | 'label' => __( 'End Point (%)', 'premium-addons-for-elementor' ), |
| 592 | 'type' => Controls_Manager::SLIDER, |
| 593 | 'description' => __( 'Set the point that the SVG should end at.', 'premium-addons-for-elementor' ), |
| 594 | 'default' => array( |
| 595 | 'unit' => '%', |
| 596 | 'size' => 0, |
| 597 | ), |
| 598 | 'condition' => array_merge( |
| 599 | $common_conditions, |
| 600 | array( |
| 601 | 'icon_type' => array( 'icon', 'svg' ), |
| 602 | 'draw_svg' => 'yes', |
| 603 | 'lottie_reverse' => 'true', |
| 604 | ) |
| 605 | ), |
| 606 | |
| 607 | ) |
| 608 | ); |
| 609 | |
| 610 | $this->add_control( |
| 611 | 'svg_hover', |
| 612 | array( |
| 613 | 'label' => __( 'Only Play on Hover', 'premium-addons-for-elementor' ), |
| 614 | 'type' => Controls_Manager::SWITCHER, |
| 615 | 'return_value' => 'true', |
| 616 | 'condition' => array_merge( |
| 617 | $common_conditions, |
| 618 | array( |
| 619 | 'icon_type' => array( 'icon', 'svg' ), |
| 620 | 'draw_svg' => 'yes', |
| 621 | ) |
| 622 | ), |
| 623 | ) |
| 624 | ); |
| 625 | |
| 626 | $this->add_control( |
| 627 | 'svg_yoyo', |
| 628 | array( |
| 629 | 'label' => __( 'Yoyo Effect', 'premium-addons-for-elementor' ), |
| 630 | 'type' => Controls_Manager::SWITCHER, |
| 631 | 'condition' => array_merge( |
| 632 | $common_conditions, |
| 633 | array( |
| 634 | 'icon_type' => array( 'icon', 'svg' ), |
| 635 | 'draw_svg' => 'yes', |
| 636 | 'lottie_loop' => 'true', |
| 637 | ) |
| 638 | ), |
| 639 | ) |
| 640 | ); |
| 641 | } |
| 642 | |
| 643 | $this->add_responsive_control( |
| 644 | 'icon_size', |
| 645 | array( |
| 646 | 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ), |
| 647 | 'type' => Controls_Manager::SLIDER, |
| 648 | 'condition' => array_merge( |
| 649 | $common_conditions, |
| 650 | array( |
| 651 | 'icon_type!' => 'svg', |
| 652 | ) |
| 653 | ), |
| 654 | 'default' => array( |
| 655 | 'unit' => 'px', |
| 656 | 'size' => 30, |
| 657 | ), |
| 658 | 'selectors' => array( |
| 659 | '{{WRAPPER}} .premium-progressbar-circle-content i' => 'font-size: {{SIZE}}px', |
| 660 | '{{WRAPPER}} .premium-progressbar-circle-content svg, {{WRAPPER}} .premium-progressbar-circle-content img' => 'width: {{SIZE}}px !important; height: {{SIZE}}px !important', |
| 661 | ), |
| 662 | ) |
| 663 | ); |
| 664 | |
| 665 | $this->add_responsive_control( |
| 666 | 'svg_icon_width', |
| 667 | array( |
| 668 | 'label' => __( 'Width', 'premium-addons-for-elementor' ), |
| 669 | 'type' => Controls_Manager::SLIDER, |
| 670 | 'size_units' => array( 'px', 'em', '%' ), |
| 671 | 'range' => array( |
| 672 | 'px' => array( |
| 673 | 'min' => 1, |
| 674 | 'max' => 600, |
| 675 | ), |
| 676 | 'em' => array( |
| 677 | 'min' => 1, |
| 678 | 'max' => 30, |
| 679 | ), |
| 680 | ), |
| 681 | 'default' => array( |
| 682 | 'size' => 100, |
| 683 | 'unit' => 'px', |
| 684 | ), |
| 685 | 'condition' => array_merge( |
| 686 | $common_conditions, |
| 687 | array( |
| 688 | 'icon_type' => 'svg', |
| 689 | ) |
| 690 | ), |
| 691 | 'selectors' => array( |
| 692 | '{{WRAPPER}} .premium-progressbar-circle-content svg' => 'width: {{SIZE}}{{UNIT}};', |
| 693 | ), |
| 694 | ) |
| 695 | ); |
| 696 | |
| 697 | $this->add_responsive_control( |
| 698 | 'svg_icon_height', |
| 699 | array( |
| 700 | 'label' => __( 'Height', 'premium-addons-for-elementor' ), |
| 701 | 'type' => Controls_Manager::SLIDER, |
| 702 | 'size_units' => array( 'px', 'em' ), |
| 703 | 'range' => array( |
| 704 | 'px' => array( |
| 705 | 'min' => 1, |
| 706 | 'max' => 300, |
| 707 | ), |
| 708 | 'em' => array( |
| 709 | 'min' => 1, |
| 710 | 'max' => 30, |
| 711 | ), |
| 712 | ), |
| 713 | 'condition' => array_merge( |
| 714 | $common_conditions, |
| 715 | array( |
| 716 | 'icon_type' => 'svg', |
| 717 | ) |
| 718 | ), |
| 719 | 'selectors' => array( |
| 720 | '{{WRAPPER}} .premium-progressbar-circle-content svg' => 'height: {{SIZE}}{{UNIT}}', |
| 721 | ), |
| 722 | ) |
| 723 | ); |
| 724 | |
| 725 | $this->add_control( |
| 726 | 'show_percentage_value', |
| 727 | array( |
| 728 | 'label' => __( 'Show Percentage Value', 'premium-addons-for-elementor' ), |
| 729 | 'type' => Controls_Manager::SWITCHER, |
| 730 | 'default' => 'yes', |
| 731 | 'separator' => 'before', |
| 732 | 'condition' => array( |
| 733 | 'layout_type' => array( 'half-circle', 'circle' ), |
| 734 | ), |
| 735 | ) |
| 736 | ); |
| 737 | |
| 738 | $repeater = new REPEATER(); |
| 739 | |
| 740 | $repeater->add_control( |
| 741 | 'text', |
| 742 | array( |
| 743 | 'label' => __( 'Label', 'premium-addons-for-elementor' ), |
| 744 | 'type' => Controls_Manager::TEXT, |
| 745 | 'dynamic' => array( 'active' => true ), |
| 746 | 'label_block' => true, |
| 747 | 'placeholder' => __( 'label', 'premium-addons-for-elementor' ), |
| 748 | 'default' => __( 'label', 'premium-addons-for-elementor' ), |
| 749 | ) |
| 750 | ); |
| 751 | |
| 752 | $repeater->add_control( |
| 753 | 'number', |
| 754 | array( |
| 755 | 'label' => __( 'Percentage', 'premium-addons-for-elementor' ), |
| 756 | 'dynamic' => array( 'active' => true ), |
| 757 | 'type' => Controls_Manager::TEXT, |
| 758 | 'default' => 50, |
| 759 | ) |
| 760 | ); |
| 761 | |
| 762 | $this->add_control( |
| 763 | 'premium_progressbar_multiple_label', |
| 764 | array( |
| 765 | 'label' => __( 'Label', 'premium-addons-for-elementor' ), |
| 766 | 'type' => Controls_Manager::REPEATER, |
| 767 | 'default' => array( |
| 768 | array( |
| 769 | 'text' => __( 'Label', 'premium-addons-for-elementor' ), |
| 770 | 'number' => 50, |
| 771 | ), |
| 772 | ), |
| 773 | 'fields' => $repeater->get_controls(), |
| 774 | 'condition' => array( |
| 775 | 'premium_progressbar_select_label' => 'more_labels', |
| 776 | 'layout_type!' => 'circle', |
| 777 | ), |
| 778 | ) |
| 779 | ); |
| 780 | |
| 781 | $this->add_control( |
| 782 | 'premium_progress_bar_space_percentage_switcher', |
| 783 | array( |
| 784 | 'label' => __( 'Enable Percentage', 'premium-addons-for-elementor' ), |
| 785 | 'type' => Controls_Manager::SWITCHER, |
| 786 | 'default' => 'yes', |
| 787 | 'description' => __( 'Enable percentage for labels', 'premium-addons-for-elementor' ), |
| 788 | 'condition' => array( |
| 789 | 'premium_progressbar_select_label' => 'more_labels', |
| 790 | 'layout_type!' => 'circle', |
| 791 | ), |
| 792 | ) |
| 793 | ); |
| 794 | |
| 795 | $this->add_control( |
| 796 | 'premium_progressbar_select_label_icon', |
| 797 | array( |
| 798 | 'label' => __( 'Labels Indicator', 'premium-addons-for-elementor' ), |
| 799 | 'type' => Controls_Manager::SELECT, |
| 800 | 'default' => 'line_pin', |
| 801 | 'options' => array( |
| 802 | '' => __( 'None', 'premium-addons-for-elementor' ), |
| 803 | 'line_pin' => __( 'Pin', 'premium-addons-for-elementor' ), |
| 804 | 'arrow' => __( 'Arrow', 'premium-addons-for-elementor' ), |
| 805 | ), |
| 806 | 'condition' => array( |
| 807 | 'premium_progressbar_select_label' => 'more_labels', |
| 808 | 'layout_type!' => 'circle', |
| 809 | ), |
| 810 | ) |
| 811 | ); |
| 812 | |
| 813 | $this->add_control( |
| 814 | 'premium_progressbar_more_labels_align', |
| 815 | array( |
| 816 | 'label' => __( 'Labels Alignment', 'premuim-addons-for-elementor' ), |
| 817 | 'type' => Controls_Manager::CHOOSE, |
| 818 | 'options' => array( |
| 819 | 'left' => array( |
| 820 | 'title' => __( 'Left', 'premium-addons-for-elementor' ), |
| 821 | 'icon' => 'eicon-text-align-left', |
| 822 | ), |
| 823 | 'center' => array( |
| 824 | 'title' => __( 'Center', 'premium-addons-for-elementor' ), |
| 825 | 'icon' => 'eicon-text-align-center', |
| 826 | ), |
| 827 | 'right' => array( |
| 828 | 'title' => __( 'Right', 'premium-addons-for-elementor' ), |
| 829 | 'icon' => 'eicon-text-align-right', |
| 830 | ), |
| 831 | ), |
| 832 | 'default' => 'center', |
| 833 | 'condition' => array( |
| 834 | 'premium_progressbar_select_label' => 'more_labels', |
| 835 | 'layout_type!' => 'circle', |
| 836 | ), |
| 837 | ) |
| 838 | ); |
| 839 | |
| 840 | $this->add_control( |
| 841 | 'premium_progressbar_progress_percentage', |
| 842 | array( |
| 843 | 'label' => __( 'Value', 'premium-addons-for-elementor' ), |
| 844 | 'type' => Controls_Manager::TEXT, |
| 845 | 'dynamic' => array( 'active' => true ), |
| 846 | 'default' => 50, |
| 847 | ) |
| 848 | ); |
| 849 | |
| 850 | $this->add_control( |
| 851 | 'premium_progressbar_progress_style', |
| 852 | array( |
| 853 | 'label' => __( 'Style', 'premium-addons-for-elementor' ), |
| 854 | 'type' => Controls_Manager::SELECT, |
| 855 | 'default' => 'solid', |
| 856 | 'options' => array( |
| 857 | 'solid' => __( 'Solid', 'premium-addons-for-elementor' ), |
| 858 | 'stripped' => __( 'Striped', 'premium-addons-for-elementor' ), |
| 859 | 'gradient' => __( 'Animated Gradient', 'premium-addons-for-elementor' ), |
| 860 | ), |
| 861 | 'condition' => array( |
| 862 | 'layout_type' => 'line', |
| 863 | ), |
| 864 | ) |
| 865 | ); |
| 866 | |
| 867 | $this->add_control( |
| 868 | 'premium_progressbar_speed', |
| 869 | array( |
| 870 | 'label' => __( 'Speed (milliseconds)', 'premium-addons-for-elementor' ), |
| 871 | 'type' => Controls_Manager::NUMBER, |
| 872 | ) |
| 873 | ); |
| 874 | |
| 875 | $this->add_control( |
| 876 | 'premium_progressbar_progress_animation', |
| 877 | array( |
| 878 | 'label' => __( 'Animated', 'premium-addons-for-elementor' ), |
| 879 | 'type' => Controls_Manager::SWITCHER, |
| 880 | 'condition' => array( |
| 881 | 'premium_progressbar_progress_style' => 'stripped', |
| 882 | 'layout_type' => 'line', |
| 883 | ), |
| 884 | ) |
| 885 | ); |
| 886 | |
| 887 | $this->add_control( |
| 888 | 'gradient_colors', |
| 889 | array( |
| 890 | 'label' => __( 'Gradient Colors', 'premium-addons-for-elementor' ), |
| 891 | 'type' => Controls_Manager::TEXT, |
| 892 | 'description' => __( 'Enter Colors separated with \' , \'.', 'premium-addons-for-elementor' ), |
| 893 | 'default' => '#6EC1E4,#54595F', |
| 894 | 'label_block' => true, |
| 895 | 'condition' => array( |
| 896 | 'layout_type' => 'line', |
| 897 | 'premium_progressbar_progress_style' => 'gradient', |
| 898 | ), |
| 899 | ) |
| 900 | ); |
| 901 | |
| 902 | $this->add_control( |
| 903 | 'half_prefix_label', |
| 904 | array( |
| 905 | 'label' => __( 'Prefix Label', 'premium-addons-for-elementor' ), |
| 906 | 'type' => Controls_Manager::TEXT, |
| 907 | 'dynamic' => array( 'active' => true ), |
| 908 | 'default' => __( '0', 'premium-addons-for-elementor' ), |
| 909 | 'condition' => array( |
| 910 | 'layout_type' => 'half-circle', |
| 911 | ), |
| 912 | 'separator' => 'before', |
| 913 | ) |
| 914 | ); |
| 915 | |
| 916 | $this->add_control( |
| 917 | 'half_suffix_label', |
| 918 | array( |
| 919 | 'label' => __( 'Suffix Label', 'premium-addons-for-elementor' ), |
| 920 | 'type' => Controls_Manager::TEXT, |
| 921 | 'dynamic' => array( 'active' => true ), |
| 922 | 'default' => __( '100%', 'premium-addons-for-elementor' ), |
| 923 | 'condition' => array( |
| 924 | 'layout_type' => 'half-circle', |
| 925 | ), |
| 926 | ) |
| 927 | ); |
| 928 | |
| 929 | $this->add_control( |
| 930 | 'magic_scroll', |
| 931 | array( |
| 932 | 'label' => __( 'Use With Magic Scroll', 'premium-addons-for-elementor' ), |
| 933 | 'type' => Controls_Manager::SWITCHER, |
| 934 | 'description' => __( 'Enable this option if you want to animate the progress bar using ', 'premium-addons-for-elementor' ) . '<a href="https://premiumaddons.com/elementor-magic-scroll-global-addon/" target="_blank">Magic Scroll addon.</a>', |
| 935 | 'condition' => array( |
| 936 | 'layout_type!' => 'dots', |
| 937 | ), |
| 938 | ) |
| 939 | ); |
| 940 | |
| 941 | $this->end_controls_section(); |
| 942 | |
| 943 | $this->start_controls_section( |
| 944 | 'section_pa_docs', |
| 945 | array( |
| 946 | 'label' => __( 'Helpful Documentations', 'premium-addons-for-elementor' ), |
| 947 | ) |
| 948 | ); |
| 949 | |
| 950 | $doc1_url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-progress-bar-widget/', 'editor-page', 'wp-editor', 'get-support' ); |
| 951 | |
| 952 | $this->add_control( |
| 953 | 'doc_1', |
| 954 | array( |
| 955 | 'type' => Controls_Manager::RAW_HTML, |
| 956 | 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc1_url, __( 'Gettings started »', 'premium-addons-for-elementor' ) ), |
| 957 | 'content_classes' => 'editor-pa-doc', |
| 958 | ) |
| 959 | ); |
| 960 | |
| 961 | $this->end_controls_section(); |
| 962 | |
| 963 | $this->start_controls_section( |
| 964 | 'premium_progressbar_progress_bar_settings', |
| 965 | array( |
| 966 | 'label' => __( 'Progress Bar', 'premium-addons-for-elementor' ), |
| 967 | 'tab' => Controls_Manager::TAB_STYLE, |
| 968 | ) |
| 969 | ); |
| 970 | |
| 971 | $this->add_control( |
| 972 | 'premium_progressbar_progress_bar_height', |
| 973 | array( |
| 974 | 'label' => __( 'Height', 'premium-addons-for-elementor' ), |
| 975 | 'type' => Controls_Manager::SLIDER, |
| 976 | 'default' => array( |
| 977 | 'size' => 25, |
| 978 | ), |
| 979 | 'label_block' => true, |
| 980 | 'selectors' => array( |
| 981 | '{{WRAPPER}} .premium-progressbar-bar-wrap, {{WRAPPER}} .premium-progressbar-bar' => 'height: {{SIZE}}px;', |
| 982 | ), |
| 983 | 'condition' => array( |
| 984 | 'layout_type' => 'line', |
| 985 | ), |
| 986 | ) |
| 987 | ); |
| 988 | |
| 989 | $this->add_control( |
| 990 | 'premium_progressbar_progress_bar_radius', |
| 991 | array( |
| 992 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 993 | 'type' => Controls_Manager::SLIDER, |
| 994 | 'size_units' => array( 'px', '%', 'em' ), |
| 995 | 'range' => array( |
| 996 | 'px' => array( |
| 997 | 'min' => 0, |
| 998 | 'max' => 60, |
| 999 | ), |
| 1000 | ), |
| 1001 | 'selectors' => array( |
| 1002 | '{{WRAPPER}} .premium-progressbar-bar-wrap, {{WRAPPER}} .premium-progressbar-bar, {{WRAPPER}} .progress-segment' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 1003 | ), |
| 1004 | 'condition' => array( |
| 1005 | 'layout_type!' => array( 'half-circle', 'circle' ), |
| 1006 | ), |
| 1007 | ) |
| 1008 | ); |
| 1009 | |
| 1010 | $this->add_control( |
| 1011 | 'circle_border_width', |
| 1012 | array( |
| 1013 | 'label' => __( 'Border Width', 'premium-addons-for-elementor' ), |
| 1014 | 'type' => Controls_Manager::SLIDER, |
| 1015 | 'selectors' => array( |
| 1016 | '{{WRAPPER}} .premium-progressbar-circle-base, {{WRAPPER}} .premium-progressbar-circle div, {{WRAPPER}} .premium-progressbar-circle-inner, {{WRAPPER}} .premium-progressbar-hf-circle-progress' => 'border-width: {{SIZE}}{{UNIT}}', |
| 1017 | '{{WRAPPER}} .premium-progressbar-hf-label-left' => 'transform: translateX( calc( {{SIZE}} / 4 * 1{{UNIT}} ) )', |
| 1018 | ), |
| 1019 | 'condition' => array( |
| 1020 | 'layout_type' => array( 'half-circle', 'circle' ), |
| 1021 | ), |
| 1022 | ) |
| 1023 | ); |
| 1024 | |
| 1025 | $this->add_control( |
| 1026 | 'circle_base_border_color', |
| 1027 | array( |
| 1028 | 'label' => __( 'Border Color', 'premium-addons-for-elementor' ), |
| 1029 | 'type' => Controls_Manager::COLOR, |
| 1030 | 'global' => array( |
| 1031 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 1032 | ), |
| 1033 | 'selectors' => array( |
| 1034 | '{{WRAPPER}} .premium-progressbar-circle-base, {{WRAPPER}} .premium-progressbar-circle-inner' => 'border-color: {{VALUE}};', |
| 1035 | ), |
| 1036 | 'condition' => array( |
| 1037 | 'layout_type' => array( 'half-circle', 'circle' ), |
| 1038 | ), |
| 1039 | ) |
| 1040 | ); |
| 1041 | |
| 1042 | $this->add_control( |
| 1043 | 'fill_colors_title', |
| 1044 | array( |
| 1045 | 'label' => __( 'Fill', 'premium-addons-for-elementor' ), |
| 1046 | 'type' => Controls_Manager::HEADING, |
| 1047 | ) |
| 1048 | ); |
| 1049 | |
| 1050 | $this->add_group_control( |
| 1051 | Group_Control_Background::get_type(), |
| 1052 | array( |
| 1053 | 'name' => 'premium_progressbar_progress_color', |
| 1054 | 'types' => array( 'classic', 'gradient' ), |
| 1055 | 'selector' => '{{WRAPPER}} .premium-progressbar-bar, {{WRAPPER}} .segment-inner', |
| 1056 | 'condition' => array( |
| 1057 | 'layout_type!' => array( 'half-circle', 'circle' ), |
| 1058 | ), |
| 1059 | ) |
| 1060 | ); |
| 1061 | |
| 1062 | $this->add_control( |
| 1063 | 'circle_fill_color', |
| 1064 | array( |
| 1065 | 'label' => __( 'Select Color', 'premium-addons-for-elementor' ), |
| 1066 | 'type' => Controls_Manager::COLOR, |
| 1067 | 'global' => array( |
| 1068 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 1069 | ), |
| 1070 | 'condition' => array( |
| 1071 | 'layout_type' => array( 'half-circle', 'circle' ), |
| 1072 | ), |
| 1073 | 'selectors' => array( |
| 1074 | '{{WRAPPER}} .premium-progressbar-circle div, {{WRAPPER}} .premium-progressbar-hf-circle-progress' => 'border-color: {{VALUE}};', |
| 1075 | ), |
| 1076 | ) |
| 1077 | ); |
| 1078 | |
| 1079 | $this->add_control( |
| 1080 | 'base_colors_title', |
| 1081 | array( |
| 1082 | 'label' => __( 'Base', 'premium-addons-for-elementor' ), |
| 1083 | 'type' => Controls_Manager::HEADING, |
| 1084 | ) |
| 1085 | ); |
| 1086 | |
| 1087 | $this->add_group_control( |
| 1088 | Group_Control_Background::get_type(), |
| 1089 | array( |
| 1090 | 'name' => 'premium_progressbar_background', |
| 1091 | 'types' => array( 'classic', 'gradient' ), |
| 1092 | 'selector' => '{{WRAPPER}} .premium-progressbar-bar-wrap:not(.premium-progressbar-dots), {{WRAPPER}} .premium-progressbar-circle-base, {{WRAPPER}} .progress-segment, {{WRAPPER}} .premium-progressbar-circle-inner', |
| 1093 | ) |
| 1094 | ); |
| 1095 | |
| 1096 | $this->add_responsive_control( |
| 1097 | 'premium_progressbar_container_margin', |
| 1098 | array( |
| 1099 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 1100 | 'type' => Controls_Manager::DIMENSIONS, |
| 1101 | 'size_units' => array( 'px', 'em', '%' ), |
| 1102 | 'selectors' => array( |
| 1103 | '{{WRAPPER}} .premium-progressbar-bar-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1104 | ), |
| 1105 | 'condition' => array( |
| 1106 | 'layout_type!' => array( 'half-circle', 'circle' ), |
| 1107 | ), |
| 1108 | ) |
| 1109 | ); |
| 1110 | |
| 1111 | $this->end_controls_section(); |
| 1112 | |
| 1113 | $this->start_controls_section( |
| 1114 | 'premium_progressbar_labels_section', |
| 1115 | array( |
| 1116 | 'label' => __( 'Labels', 'premium-addons-for-elementor' ), |
| 1117 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1118 | 'condition' => array( |
| 1119 | 'premium_progressbar_select_label' => 'left_right_labels', |
| 1120 | ), |
| 1121 | ) |
| 1122 | ); |
| 1123 | |
| 1124 | $this->add_control( |
| 1125 | 'premium_progressbar_left_label_hint', |
| 1126 | array( |
| 1127 | 'label' => __( 'Title', 'premium-addons-for-elementor' ), |
| 1128 | 'type' => Controls_Manager::HEADING, |
| 1129 | ) |
| 1130 | ); |
| 1131 | |
| 1132 | $this->add_control( |
| 1133 | 'premium_progressbar_left_label_color', |
| 1134 | array( |
| 1135 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1136 | 'type' => Controls_Manager::COLOR, |
| 1137 | 'global' => array( |
| 1138 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 1139 | ), |
| 1140 | 'selectors' => array( |
| 1141 | '{{WRAPPER}} .premium-progressbar-left-label' => 'color: {{VALUE}};', |
| 1142 | ), |
| 1143 | ) |
| 1144 | ); |
| 1145 | |
| 1146 | $this->add_group_control( |
| 1147 | Group_Control_Typography::get_type(), |
| 1148 | array( |
| 1149 | 'name' => 'left_label_typography', |
| 1150 | 'global' => array( |
| 1151 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 1152 | ), |
| 1153 | 'selector' => '{{WRAPPER}} .premium-progressbar-left-label', |
| 1154 | ) |
| 1155 | ); |
| 1156 | |
| 1157 | $this->add_responsive_control( |
| 1158 | 'premium_progressbar_left_label_margin', |
| 1159 | array( |
| 1160 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 1161 | 'type' => Controls_Manager::DIMENSIONS, |
| 1162 | 'size_units' => array( 'px', 'em', '%' ), |
| 1163 | 'selectors' => array( |
| 1164 | '{{WRAPPER}} .premium-progressbar-left-label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1165 | ), |
| 1166 | ) |
| 1167 | ); |
| 1168 | |
| 1169 | $this->add_control( |
| 1170 | 'premium_progressbar_right_label_hint', |
| 1171 | array( |
| 1172 | 'label' => __( 'Percentage', 'premium-addons-for-elementor' ), |
| 1173 | 'type' => Controls_Manager::HEADING, |
| 1174 | 'separator' => 'before', |
| 1175 | ) |
| 1176 | ); |
| 1177 | |
| 1178 | $this->add_control( |
| 1179 | 'premium_progressbar_right_label_color', |
| 1180 | array( |
| 1181 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1182 | 'type' => Controls_Manager::COLOR, |
| 1183 | 'global' => array( |
| 1184 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 1185 | ), |
| 1186 | 'selectors' => array( |
| 1187 | '{{WRAPPER}} .premium-progressbar-right-label' => 'color: {{VALUE}};', |
| 1188 | ), |
| 1189 | ) |
| 1190 | ); |
| 1191 | |
| 1192 | $this->add_group_control( |
| 1193 | Group_Control_Typography::get_type(), |
| 1194 | array( |
| 1195 | 'name' => 'right_label_typography', |
| 1196 | 'global' => array( |
| 1197 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 1198 | ), |
| 1199 | 'selector' => '{{WRAPPER}} .premium-progressbar-right-label', |
| 1200 | ) |
| 1201 | ); |
| 1202 | |
| 1203 | $this->add_responsive_control( |
| 1204 | 'premium_progressbar_right_label_margin', |
| 1205 | array( |
| 1206 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 1207 | 'type' => Controls_Manager::DIMENSIONS, |
| 1208 | 'size_units' => array( 'px', 'em', '%' ), |
| 1209 | 'selectors' => array( |
| 1210 | '{{WRAPPER}} .premium-progressbar-right-label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1211 | ), |
| 1212 | ) |
| 1213 | ); |
| 1214 | |
| 1215 | $this->end_controls_section(); |
| 1216 | |
| 1217 | $this->start_controls_section( |
| 1218 | 'icon_style', |
| 1219 | array( |
| 1220 | 'label' => __( 'Icon', 'premium-addons-for-elementor' ), |
| 1221 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1222 | 'condition' => array( |
| 1223 | 'layout_type' => array( 'half-circle', 'circle' ), |
| 1224 | ), |
| 1225 | ) |
| 1226 | ); |
| 1227 | |
| 1228 | $this->add_control( |
| 1229 | 'icon_color', |
| 1230 | array( |
| 1231 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1232 | 'type' => Controls_Manager::COLOR, |
| 1233 | 'global' => array( |
| 1234 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 1235 | ), |
| 1236 | 'selectors' => array( |
| 1237 | '{{WRAPPER}} .premium-progressbar-circle-icon' => 'color: {{VALUE}}', |
| 1238 | '{{WRAPPER}} .premium-drawable-icon *, {{WRAPPER}} svg:not([class*="premium-"])' => 'fill: {{VALUE}};', |
| 1239 | ), |
| 1240 | 'condition' => array( |
| 1241 | 'icon_type' => array( 'icon', 'svg' ), |
| 1242 | ), |
| 1243 | ) |
| 1244 | ); |
| 1245 | |
| 1246 | if ( $draw_icon ) { |
| 1247 | $this->add_control( |
| 1248 | 'stroke_color', |
| 1249 | array( |
| 1250 | 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ), |
| 1251 | 'type' => Controls_Manager::COLOR, |
| 1252 | 'global' => array( |
| 1253 | 'default' => Global_Colors::COLOR_ACCENT, |
| 1254 | ), |
| 1255 | 'condition' => array( |
| 1256 | 'icon_type' => array( 'icon', 'svg' ), |
| 1257 | ), |
| 1258 | 'selectors' => array( |
| 1259 | '{{WRAPPER}} .premium-drawable-icon *, {{WRAPPER}} svg:not([class*="premium-"])' => 'stroke: {{VALUE}};', |
| 1260 | ), |
| 1261 | ) |
| 1262 | ); |
| 1263 | } |
| 1264 | |
| 1265 | $this->add_control( |
| 1266 | 'svg_color', |
| 1267 | array( |
| 1268 | 'label' => __( 'After Draw Fill Color', 'premium-addons-for-elementor' ), |
| 1269 | 'type' => Controls_Manager::COLOR, |
| 1270 | 'global' => false, |
| 1271 | 'separator' => 'after', |
| 1272 | 'condition' => array( |
| 1273 | 'icon_type' => array( 'icon', 'svg' ), |
| 1274 | 'draw_svg' => 'yes', |
| 1275 | ), |
| 1276 | ) |
| 1277 | ); |
| 1278 | |
| 1279 | $this->add_control( |
| 1280 | 'icon_background_color', |
| 1281 | array( |
| 1282 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 1283 | 'type' => Controls_Manager::COLOR, |
| 1284 | 'selectors' => array( |
| 1285 | '{{WRAPPER}} .premium-progressbar-circle-icon, {{WRAPPER}} .premium-progressbar-circle-content svg' => 'background-color: {{VALUE}};', |
| 1286 | ), |
| 1287 | 'condition' => array( |
| 1288 | 'icon_type!' => 'image', |
| 1289 | ), |
| 1290 | ) |
| 1291 | ); |
| 1292 | |
| 1293 | $this->add_group_control( |
| 1294 | Group_Control_Border::get_type(), |
| 1295 | array( |
| 1296 | 'name' => 'icon_border', |
| 1297 | 'selector' => '{{WRAPPER}} .premium-progressbar-circle-icon, {{WRAPPER}} .premium-progressbar-circle-content svg', |
| 1298 | ) |
| 1299 | ); |
| 1300 | |
| 1301 | $this->add_responsive_control( |
| 1302 | 'icon_border_radius', |
| 1303 | array( |
| 1304 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 1305 | 'type' => Controls_Manager::DIMENSIONS, |
| 1306 | 'size_units' => array( 'px', 'em', '%' ), |
| 1307 | 'selectors' => array( |
| 1308 | '{{WRAPPER}} .premium-progressbar-circle-icon, {{WRAPPER}} .premium-progressbar-circle-content svg' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 1309 | ), |
| 1310 | ) |
| 1311 | ); |
| 1312 | |
| 1313 | $this->add_responsive_control( |
| 1314 | 'icon_margin', |
| 1315 | array( |
| 1316 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 1317 | 'type' => Controls_Manager::DIMENSIONS, |
| 1318 | 'size_units' => array( 'px', 'em', '%' ), |
| 1319 | 'selectors' => array( |
| 1320 | '{{WRAPPER}} .premium-progressbar-circle-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1321 | ), |
| 1322 | ) |
| 1323 | ); |
| 1324 | |
| 1325 | $this->add_responsive_control( |
| 1326 | 'icon_padding', |
| 1327 | array( |
| 1328 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 1329 | 'type' => Controls_Manager::DIMENSIONS, |
| 1330 | 'size_units' => array( 'px', 'em', '%' ), |
| 1331 | 'selectors' => array( |
| 1332 | '{{WRAPPER}} .premium-progressbar-circle-icon, {{WRAPPER}} .premium-progressbar-circle-content svg' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1333 | ), |
| 1334 | ) |
| 1335 | ); |
| 1336 | |
| 1337 | $this->end_controls_section(); |
| 1338 | |
| 1339 | $this->start_controls_section( |
| 1340 | 'premium_progressbar_multiple_labels_section', |
| 1341 | array( |
| 1342 | 'label' => __( 'Multiple Labels', 'premium-addons-for-elementor' ), |
| 1343 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1344 | 'condition' => array( |
| 1345 | 'premium_progressbar_select_label' => 'more_labels', |
| 1346 | ), |
| 1347 | ) |
| 1348 | ); |
| 1349 | |
| 1350 | $this->add_control( |
| 1351 | 'premium_progressbar_multiple_label_color', |
| 1352 | array( |
| 1353 | 'label' => __( 'Labels\' Color', 'premium-addons-for-elementor' ), |
| 1354 | 'type' => Controls_Manager::COLOR, |
| 1355 | 'global' => array( |
| 1356 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 1357 | ), |
| 1358 | 'selectors' => array( |
| 1359 | '{{WRAPPER}} .premium-progressbar-center-label' => 'color: {{VALUE}};', |
| 1360 | ), |
| 1361 | ) |
| 1362 | ); |
| 1363 | |
| 1364 | $this->add_group_control( |
| 1365 | Group_Control_Typography::get_type(), |
| 1366 | array( |
| 1367 | 'label' => __( 'Labels\' Typography', 'premium-addons-for-elementor' ), |
| 1368 | 'name' => 'more_label_typography', |
| 1369 | 'global' => array( |
| 1370 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 1371 | ), |
| 1372 | 'selector' => '{{WRAPPER}} .premium-progressbar-center-label', |
| 1373 | ) |
| 1374 | ); |
| 1375 | |
| 1376 | $this->add_control( |
| 1377 | 'premium_progressbar_value_label_color', |
| 1378 | array( |
| 1379 | 'label' => __( 'Percentage Color', 'premium-addons-for-elementor' ), |
| 1380 | 'type' => Controls_Manager::COLOR, |
| 1381 | 'global' => array( |
| 1382 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 1383 | ), |
| 1384 | 'condition' => array( |
| 1385 | 'premium_progress_bar_space_percentage_switcher' => 'yes', |
| 1386 | ), |
| 1387 | 'selectors' => array( |
| 1388 | '{{WRAPPER}} .premium-progressbar-percentage' => 'color: {{VALUE}};', |
| 1389 | ), |
| 1390 | ) |
| 1391 | ); |
| 1392 | |
| 1393 | $this->add_group_control( |
| 1394 | Group_Control_Typography::get_type(), |
| 1395 | array( |
| 1396 | 'label' => __( 'Percentage Typography', 'premium-addons-for-elementor' ), |
| 1397 | 'name' => 'percentage_typography', |
| 1398 | 'condition' => array( |
| 1399 | 'premium_progress_bar_space_percentage_switcher' => 'yes', |
| 1400 | ), |
| 1401 | 'global' => array( |
| 1402 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 1403 | ), |
| 1404 | 'selector' => '{{WRAPPER}} .premium-progressbar-percentage', |
| 1405 | ) |
| 1406 | ); |
| 1407 | |
| 1408 | $this->end_controls_section(); |
| 1409 | |
| 1410 | $this->start_controls_section( |
| 1411 | 'premium_progressbar_multiple_labels_arrow_section', |
| 1412 | array( |
| 1413 | 'label' => __( 'Arrow', 'premium-addons-for-elementor' ), |
| 1414 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1415 | 'condition' => array( |
| 1416 | 'premium_progressbar_select_label' => 'more_labels', |
| 1417 | 'premium_progressbar_select_label_icon' => 'arrow', |
| 1418 | ), |
| 1419 | ) |
| 1420 | ); |
| 1421 | |
| 1422 | $this->add_control( |
| 1423 | 'premium_progressbar_arrow_color', |
| 1424 | array( |
| 1425 | 'label' => __( 'Color', 'premium_elementor' ), |
| 1426 | 'type' => Controls_Manager::COLOR, |
| 1427 | 'global' => array( |
| 1428 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 1429 | ), |
| 1430 | 'condition' => array( |
| 1431 | 'premium_progressbar_select_label_icon' => 'arrow', |
| 1432 | ), |
| 1433 | 'selectors' => array( |
| 1434 | '{{WRAPPER}} .premium-progressbar-arrow' => 'color: {{VALUE}}', |
| 1435 | ), |
| 1436 | ) |
| 1437 | ); |
| 1438 | |
| 1439 | $this->add_responsive_control( |
| 1440 | 'premium_arrow_size', |
| 1441 | array( |
| 1442 | 'label' => __( 'Size', 'premium-addons-for-elementor' ), |
| 1443 | 'type' => Controls_Manager::SLIDER, |
| 1444 | 'size_units' => array( 'px', 'em' ), |
| 1445 | 'condition' => array( |
| 1446 | 'premium_progressbar_select_label_icon' => 'arrow', |
| 1447 | ), |
| 1448 | 'selectors' => array( |
| 1449 | '{{WRAPPER}} .premium-progressbar-arrow' => 'border-width: {{SIZE}}{{UNIT}};', |
| 1450 | ), |
| 1451 | ) |
| 1452 | ); |
| 1453 | |
| 1454 | $this->end_controls_section(); |
| 1455 | |
| 1456 | $this->start_controls_section( |
| 1457 | 'premium_progressbar_multiple_labels_pin_section', |
| 1458 | array( |
| 1459 | 'label' => __( 'Indicator', 'premium-addons-for-elementor' ), |
| 1460 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1461 | 'condition' => array( |
| 1462 | 'premium_progressbar_select_label' => 'more_labels', |
| 1463 | 'premium_progressbar_select_label_icon' => 'line_pin', |
| 1464 | ), |
| 1465 | ) |
| 1466 | ); |
| 1467 | |
| 1468 | $this->add_control( |
| 1469 | 'premium_progressbar_line_pin_color', |
| 1470 | array( |
| 1471 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1472 | 'type' => Controls_Manager::COLOR, |
| 1473 | 'global' => array( |
| 1474 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 1475 | ), |
| 1476 | 'condition' => array( |
| 1477 | 'premium_progressbar_select_label_icon' => 'line_pin', |
| 1478 | ), |
| 1479 | 'selectors' => array( |
| 1480 | '{{WRAPPER}} .premium-progressbar-pin' => 'border-color: {{VALUE}};', |
| 1481 | ), |
| 1482 | ) |
| 1483 | ); |
| 1484 | |
| 1485 | $this->add_responsive_control( |
| 1486 | 'premium_pin_size', |
| 1487 | array( |
| 1488 | 'label' => __( 'Size', 'premium-addons-for-elementor' ), |
| 1489 | 'type' => Controls_Manager::SLIDER, |
| 1490 | 'size_units' => array( 'px', 'em' ), |
| 1491 | 'condition' => array( |
| 1492 | 'premium_progressbar_select_label_icon' => 'line_pin', |
| 1493 | ), |
| 1494 | 'selectors' => array( |
| 1495 | '{{WRAPPER}} .premium-progressbar-pin' => 'border-left-width: {{SIZE}}{{UNIT}};', |
| 1496 | ), |
| 1497 | ) |
| 1498 | ); |
| 1499 | |
| 1500 | $this->add_responsive_control( |
| 1501 | 'premium_pin_height', |
| 1502 | array( |
| 1503 | 'label' => __( 'Height', 'premium-addons-for-elementor' ), |
| 1504 | 'type' => Controls_Manager::SLIDER, |
| 1505 | 'size_units' => array( 'px', 'em' ), |
| 1506 | 'condition' => array( |
| 1507 | 'premium_progressbar_select_label_icon' => 'line_pin', |
| 1508 | ), |
| 1509 | 'selectors' => array( |
| 1510 | '{{WRAPPER}} .premium-progressbar-pin' => 'height: {{SIZE}}{{UNIT}};', |
| 1511 | ), |
| 1512 | ) |
| 1513 | ); |
| 1514 | |
| 1515 | $this->end_controls_section(); |
| 1516 | |
| 1517 | $this->start_controls_section( |
| 1518 | 'prefix_suffix_style', |
| 1519 | array( |
| 1520 | 'label' => __( 'Prefix & Suffix', 'premium-addons-for-elementor' ), |
| 1521 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1522 | 'condition' => array( |
| 1523 | 'layout_type' => 'half-circle', |
| 1524 | ), |
| 1525 | ) |
| 1526 | ); |
| 1527 | |
| 1528 | $this->add_responsive_control( |
| 1529 | 'labels_top_spacing', |
| 1530 | array( |
| 1531 | 'label' => __( 'Top Spacing', 'premium-addons-for-elementor' ), |
| 1532 | 'type' => Controls_Manager::SLIDER, |
| 1533 | 'range' => array( |
| 1534 | 'px' => array( |
| 1535 | 'min' => 1, |
| 1536 | 'max' => 300, |
| 1537 | ), |
| 1538 | ), |
| 1539 | 'selectors' => array( |
| 1540 | '{{WRAPPER}} .premium-progressbar-hf-labels' => 'margin-top: {{SIZE}}px;', |
| 1541 | ), |
| 1542 | ) |
| 1543 | ); |
| 1544 | |
| 1545 | $this->add_control( |
| 1546 | 'prefix_title', |
| 1547 | array( |
| 1548 | 'label' => __( 'Prefix', 'premium-addons-for-elementor' ), |
| 1549 | 'type' => Controls_Manager::HEADING, |
| 1550 | ) |
| 1551 | ); |
| 1552 | |
| 1553 | $this->add_control( |
| 1554 | 'prefix_label_color', |
| 1555 | array( |
| 1556 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1557 | 'type' => Controls_Manager::COLOR, |
| 1558 | 'global' => array( |
| 1559 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 1560 | ), |
| 1561 | 'selectors' => array( |
| 1562 | '{{WRAPPER}} .premium-progressbar-hf-label-left' => 'color: {{VALUE}};', |
| 1563 | ), |
| 1564 | ) |
| 1565 | ); |
| 1566 | |
| 1567 | $this->add_group_control( |
| 1568 | Group_Control_Typography::get_type(), |
| 1569 | array( |
| 1570 | 'name' => 'prefix_label_typo', |
| 1571 | 'global' => array( |
| 1572 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 1573 | ), |
| 1574 | 'selector' => '{{WRAPPER}} .premium-progressbar-hf-label-left', |
| 1575 | ) |
| 1576 | ); |
| 1577 | |
| 1578 | $pfx_direction = is_rtl() ? 'right' : 'left'; |
| 1579 | $sfx_direction = is_rtl() ? 'left' : 'right'; |
| 1580 | |
| 1581 | $this->add_responsive_control( |
| 1582 | 'prefix_spacing', |
| 1583 | array( |
| 1584 | 'label' => __( 'Spacing', 'premium-addons-for-elementor' ), |
| 1585 | 'type' => Controls_Manager::SLIDER, |
| 1586 | 'selectors' => array( |
| 1587 | '{{WRAPPER}} .premium-progressbar-hf-label-left' => 'margin-' . $pfx_direction . ': {{SIZE}}px;', |
| 1588 | ), |
| 1589 | ) |
| 1590 | ); |
| 1591 | |
| 1592 | $this->add_control( |
| 1593 | 'suffix_title', |
| 1594 | array( |
| 1595 | 'label' => __( 'Suffix', 'premium-addons-for-elementor' ), |
| 1596 | 'type' => Controls_Manager::HEADING, |
| 1597 | ) |
| 1598 | ); |
| 1599 | |
| 1600 | $this->add_control( |
| 1601 | 'suffix_label_color', |
| 1602 | array( |
| 1603 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1604 | 'type' => Controls_Manager::COLOR, |
| 1605 | 'separator' => 'before', |
| 1606 | 'global' => array( |
| 1607 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 1608 | ), |
| 1609 | 'selectors' => array( |
| 1610 | '{{WRAPPER}} .premium-progressbar-hf-label-right' => 'color: {{VALUE}};', |
| 1611 | ), |
| 1612 | ) |
| 1613 | ); |
| 1614 | |
| 1615 | $this->add_group_control( |
| 1616 | Group_Control_Typography::get_type(), |
| 1617 | array( |
| 1618 | 'name' => 'suffix_label_typo', |
| 1619 | 'global' => array( |
| 1620 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 1621 | ), |
| 1622 | 'selector' => '{{WRAPPER}} .premium-progressbar-hf-label-right', |
| 1623 | ) |
| 1624 | ); |
| 1625 | |
| 1626 | $this->add_responsive_control( |
| 1627 | 'suffix_spacing', |
| 1628 | array( |
| 1629 | 'label' => __( 'Spacing', 'premium-addons-for-elementor' ), |
| 1630 | 'type' => Controls_Manager::SLIDER, |
| 1631 | 'selectors' => array( |
| 1632 | '{{WRAPPER}} .premium-progressbar-hf-label-right' => 'margin-' . $sfx_direction . ': {{SIZE}}px;', |
| 1633 | ), |
| 1634 | ) |
| 1635 | ); |
| 1636 | |
| 1637 | $this->end_controls_section(); |
| 1638 | } |
| 1639 | |
| 1640 | /** |
| 1641 | * Render Progress Bar widget output on the frontend. |
| 1642 | * |
| 1643 | * Written in PHP and used to generate the final HTML. |
| 1644 | * |
| 1645 | * @since 1.0.0 |
| 1646 | * @access protected |
| 1647 | */ |
| 1648 | protected function render() { |
| 1649 | |
| 1650 | $settings = $this->get_settings_for_display(); |
| 1651 | |
| 1652 | $this->add_inline_editing_attributes( 'premium_progressbar_left_label' ); |
| 1653 | $this->add_render_attribute( 'premium_progressbar_left_label', 'class', 'premium-progressbar-left-label' ); |
| 1654 | |
| 1655 | $this->add_inline_editing_attributes( 'premium_progressbar_right_label' ); |
| 1656 | $this->add_render_attribute( 'premium_progressbar_right_label', 'class', 'premium-progressbar-right-label' ); |
| 1657 | |
| 1658 | $length = isset( $settings['premium_progressbar_progress_percentage']['size'] ) ? $settings['premium_progressbar_progress_percentage']['size'] : $settings['premium_progressbar_progress_percentage']; |
| 1659 | |
| 1660 | $style = $settings['premium_progressbar_progress_style']; |
| 1661 | $type = $settings['layout_type']; |
| 1662 | |
| 1663 | $progressbar_settings = array( |
| 1664 | 'progress_length' => $length, |
| 1665 | 'speed' => ! empty( $settings['premium_progressbar_speed'] ) ? $settings['premium_progressbar_speed'] : 1000, |
| 1666 | 'type' => $type, |
| 1667 | 'mScroll' => $settings['magic_scroll'], |
| 1668 | ); |
| 1669 | |
| 1670 | if ( 'dots' === $type ) { |
| 1671 | $progressbar_settings['dot'] = $settings['dot_size']['size']; |
| 1672 | $progressbar_settings['spacing'] = $settings['dot_spacing']['size']; |
| 1673 | } |
| 1674 | |
| 1675 | $this->add_render_attribute( 'progressbar', 'class', 'premium-progressbar-container' ); |
| 1676 | |
| 1677 | if ( 'stripped' === $style ) { |
| 1678 | $this->add_render_attribute( 'progressbar', 'class', 'premium-progressbar-striped' ); |
| 1679 | } elseif ( 'gradient' === $style ) { |
| 1680 | $this->add_render_attribute( 'progressbar', 'class', 'premium-progressbar-gradient' ); |
| 1681 | $progressbar_settings['gradient'] = $settings['gradient_colors']; |
| 1682 | } |
| 1683 | |
| 1684 | if ( 'yes' === $settings['premium_progressbar_progress_animation'] ) { |
| 1685 | $this->add_render_attribute( 'progressbar', 'class', 'premium-progressbar-active' ); |
| 1686 | } |
| 1687 | |
| 1688 | $this->add_render_attribute( 'progressbar', 'data-settings', wp_json_encode( $progressbar_settings ) ); |
| 1689 | |
| 1690 | if ( 'circle' !== $type && 'half-circle' !== $type ) { |
| 1691 | $this->add_render_attribute( 'wrap', 'class', 'premium-progressbar-bar-wrap' ); |
| 1692 | |
| 1693 | if ( 'dots' === $type ) { |
| 1694 | $this->add_render_attribute( 'wrap', 'class', 'premium-progressbar-dots' ); |
| 1695 | } |
| 1696 | } else { |
| 1697 | |
| 1698 | $class = 'half-circle' === $type ? '-hf' : ''; |
| 1699 | |
| 1700 | $this->add_render_attribute( 'wrap', 'class', 'premium-progressbar' . $class . '-circle-wrap' ); |
| 1701 | |
| 1702 | } |
| 1703 | |
| 1704 | if ( 'yes' === $settings['draw_svg'] ) { |
| 1705 | |
| 1706 | $this->add_render_attribute( |
| 1707 | 'progressbar', |
| 1708 | 'class', |
| 1709 | array( |
| 1710 | 'elementor-invisible', |
| 1711 | 'premium-drawer-hover', |
| 1712 | ) |
| 1713 | ); |
| 1714 | } |
| 1715 | |
| 1716 | ?> |
| 1717 | |
| 1718 | <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'progressbar' ) ); ?>> |
| 1719 | |
| 1720 | <?php if ( 'left_right_labels' === $settings['premium_progressbar_select_label'] ) : ?> |
| 1721 | <p <?php echo wp_kses_post( $this->get_render_attribute_string( 'premium_progressbar_left_label' ) ); ?>> |
| 1722 | <?php echo wp_kses_post( $settings['premium_progressbar_left_label'] ); ?> |
| 1723 | </p> |
| 1724 | <p <?php echo wp_kses_post( $this->get_render_attribute_string( 'premium_progressbar_right_label' ) ); ?>> |
| 1725 | <?php echo wp_kses_post( 'yes' !== $settings['magic_scroll'] ? $settings['premium_progressbar_right_label'] : '0%' ); ?> |
| 1726 | </p> |
| 1727 | <?php endif; ?> |
| 1728 | |
| 1729 | <?php if ( 'more_labels' === $settings['premium_progressbar_select_label'] ) : ?> |
| 1730 | <div class="premium-progressbar-container-label" style="position:relative;"> |
| 1731 | <?php |
| 1732 | $direction = is_rtl() ? 'right' : 'left'; |
| 1733 | |
| 1734 | foreach ( $settings['premium_progressbar_multiple_label'] as $item ) { |
| 1735 | if ( 'center' === $this->get_settings( 'premium_progressbar_more_labels_align' ) ) { |
| 1736 | if ( 'yes' === $settings['premium_progress_bar_space_percentage_switcher'] ) { |
| 1737 | if ( 'arrow' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1738 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-45%);">' . esc_attr( $item['text'] ) . ' <span class="premium-progressbar-percentage">' . esc_attr( $item['number'] ) . '%</span></p><p class="premium-progressbar-arrow" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1739 | } elseif ( 'line_pin' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1740 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-45%);">' . esc_attr( $item['text'] ) . ' <span class="premium-progressbar-percentage">' . esc_attr( $item['number'] ) . '%</span></p><p class="premium-progressbar-pin" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1741 | } else { |
| 1742 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-45%);">' . esc_attr( $item['text'] ) . ' <span class="premium-progressbar-percentage">' . esc_attr( $item['number'] ) . '%</span></p></div>'; |
| 1743 | } |
| 1744 | } elseif ( 'arrow' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1745 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-45%);">' . esc_attr( $item['text'] ) . '</p><p class="premium-progressbar-arrow" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1746 | } elseif ( 'line_pin' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1747 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-45%)">' . esc_attr( $item['text'] ) . '</p><p class="premium-progressbar-pin" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1748 | } else { |
| 1749 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-45%);">' . esc_attr( $item['text'] ) . '</p></div>'; |
| 1750 | } |
| 1751 | } elseif ( 'left' === $this->get_settings( 'premium_progressbar_more_labels_align' ) ) { |
| 1752 | if ( 'yes' === $settings['premium_progress_bar_space_percentage_switcher'] ) { |
| 1753 | if ( 'arrow' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1754 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-10%);">' . esc_attr( $item['text'] ) . ' <span class="premium-progressbar-percentage">' . esc_attr( $item['number'] ) . '%</span></p><p class="premium-progressbar-arrow" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1755 | } elseif ( 'line_pin' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1756 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-2%);">' . esc_attr( $item['text'] ) . ' <span class="premium-progressbar-percentage">' . esc_attr( $item['number'] ) . '%</span></p><p class="premium-progressbar-pin" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1757 | } else { |
| 1758 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-2%);">' . esc_attr( $item['text'] ) . ' <span class="premium-progressbar-percentage">' . esc_attr( $item['number'] ) . '%</span></p></div>'; |
| 1759 | } |
| 1760 | } elseif ( 'arrow' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1761 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-10%);">' . esc_attr( $item['text'] ) . '</p><p class="premium-progressbar-arrow" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1762 | } elseif ( 'line_pin' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1763 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-2%);">' . esc_attr( $item['text'] ) . '</p><p class="premium-progressbar-pin" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1764 | } else { |
| 1765 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-2%);">' . esc_attr( $item['text'] ) . '</p></div>'; |
| 1766 | } |
| 1767 | } elseif ( 'yes' === $settings['premium_progress_bar_space_percentage_switcher'] ) { |
| 1768 | if ( 'arrow' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1769 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-82%);">' . esc_attr( $item['text'] ) . ' <span class="premium-progressbar-percentage">' . esc_attr( $item['number'] ) . '%</span></p><p class="premium-progressbar-arrow" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1770 | } elseif ( 'line_pin' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1771 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-95%);">' . esc_attr( $item['text'] ) . ' <span class="premium-progressbar-percentage">' . esc_attr( $item['number'] ) . '%</span></p><p class="premium-progressbar-pin" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1772 | } else { |
| 1773 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-96%);">' . esc_attr( $item['text'] ) . ' <span class="premium-progressbar-percentage">' . esc_attr( $item['number'] ) . '%</span></p></div>'; |
| 1774 | } |
| 1775 | } elseif ( 'arrow' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1776 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-71%);">' . esc_attr( $item['text'] ) . '</p><p class="premium-progressbar-arrow" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1777 | } elseif ( 'line_pin' === $settings['premium_progressbar_select_label_icon'] ) { |
| 1778 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-97%);">' . esc_attr( $item['text'] ) . '</p><p class="premium-progressbar-pin" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%; transform:translateX(50%);"></p></div>'; |
| 1779 | } else { |
| 1780 | echo '<div class="premium-progressbar-multiple-label" style="' . esc_attr( $direction . ':' . $item['number'] ) . '%;"><p class = "premium-progressbar-center-label" style="transform:translateX(-96%);">' . esc_attr( $item['text'] ) . '</p></div>'; |
| 1781 | } |
| 1782 | } |
| 1783 | ?> |
| 1784 | </div> |
| 1785 | <?php endif; ?> |
| 1786 | |
| 1787 | <?php if ( 'circle' !== $type ) : ?> |
| 1788 | <div class="clearfix"></div> |
| 1789 | <?php endif; ?> |
| 1790 | |
| 1791 | <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'wrap' ) ); ?>> |
| 1792 | <?php if ( 'line' === $type ) : ?> |
| 1793 | <div class="premium-progressbar-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div> |
| 1794 | <?php elseif ( 'circle' === $type ) : ?> |
| 1795 | |
| 1796 | <div class="premium-progressbar-circle-base"></div> |
| 1797 | <div class="premium-progressbar-circle"> |
| 1798 | <div class="premium-progressbar-circle-left"></div> |
| 1799 | <div class="premium-progressbar-circle-right"></div> |
| 1800 | </div> |
| 1801 | |
| 1802 | <?php $this->render_progressbar_content(); ?> |
| 1803 | |
| 1804 | <?php elseif ( 'half-circle' === $type ) : ?> |
| 1805 | |
| 1806 | <div class="premium-progressbar-hf-container"> |
| 1807 | <div class="premium-progressbar-hf-circle"> |
| 1808 | <div class="premium-progressbar-hf-circle-progress"></div> |
| 1809 | </div> |
| 1810 | |
| 1811 | <div class="premium-progressbar-circle-inner"></div> |
| 1812 | </div> |
| 1813 | |
| 1814 | <?php $this->render_progressbar_content(); ?> |
| 1815 | |
| 1816 | <?php endif; ?> |
| 1817 | </div> |
| 1818 | |
| 1819 | <?php if ( 'half-circle' === $type ) : ?> |
| 1820 | <div class="premium-progressbar-hf-labels"> |
| 1821 | <span class="premium-progressbar-hf-label-left"> |
| 1822 | <?php echo wp_kses_post( $settings['half_prefix_label'] ); ?> |
| 1823 | </span> |
| 1824 | <span class="premium-progressbar-hf-label-right"> |
| 1825 | <?php echo wp_kses_post( $settings['half_suffix_label'] ); ?> |
| 1826 | </span> |
| 1827 | </div> |
| 1828 | <?php endif; ?> |
| 1829 | |
| 1830 | </div> |
| 1831 | |
| 1832 | <?php |
| 1833 | } |
| 1834 | |
| 1835 | /** |
| 1836 | * Get Progressbar Content |
| 1837 | * |
| 1838 | * @since 4.9.13 |
| 1839 | * @access private |
| 1840 | */ |
| 1841 | private function render_progressbar_content() { |
| 1842 | |
| 1843 | $settings = $this->get_settings_for_display(); |
| 1844 | |
| 1845 | $icon_type = $settings['icon_type']; |
| 1846 | |
| 1847 | if ( 'icon' === $icon_type || 'svg' === $icon_type ) { |
| 1848 | |
| 1849 | $this->add_render_attribute( 'icon', 'class', 'premium-drawable-icon' ); |
| 1850 | |
| 1851 | if ( ( 'yes' === $settings['draw_svg'] && 'icon' === $icon_type ) || 'svg' === $icon_type ) { |
| 1852 | $this->add_render_attribute( 'icon', 'class', 'premium-progressbar-circle-icon' ); |
| 1853 | } |
| 1854 | |
| 1855 | if ( 'yes' === $settings['draw_svg'] ) { |
| 1856 | |
| 1857 | if ( 'icon' === $icon_type ) { |
| 1858 | |
| 1859 | $this->add_render_attribute( 'icon', 'class', $settings['icon_select']['value'] ); |
| 1860 | |
| 1861 | } |
| 1862 | |
| 1863 | $this->add_render_attribute( |
| 1864 | 'icon', |
| 1865 | array( |
| 1866 | 'class' => 'premium-svg-drawer', |
| 1867 | 'data-svg-reverse' => $settings['lottie_reverse'], |
| 1868 | 'data-svg-loop' => $settings['lottie_loop'], |
| 1869 | 'data-svg-sync' => $settings['svg_sync'], |
| 1870 | 'data-svg-hover' => $settings['svg_hover'], |
| 1871 | 'data-svg-fill' => $settings['svg_color'], |
| 1872 | 'data-svg-frames' => $settings['frames'], |
| 1873 | 'data-svg-yoyo' => $settings['svg_yoyo'], |
| 1874 | 'data-svg-point' => $settings['lottie_reverse'] ? $settings['end_point']['size'] : $settings['start_point']['size'], |
| 1875 | ) |
| 1876 | ); |
| 1877 | |
| 1878 | } else { |
| 1879 | $this->add_render_attribute( 'icon', 'class', 'premium-svg-nodraw' ); |
| 1880 | } |
| 1881 | } elseif ( 'animation' === $icon_type ) { |
| 1882 | $this->add_render_attribute( |
| 1883 | 'progress_lottie', |
| 1884 | array( |
| 1885 | 'class' => array( |
| 1886 | 'premium-progressbar-circle-icon', |
| 1887 | 'premium-lottie-animation', |
| 1888 | ), |
| 1889 | 'data-lottie-url' => $settings['lottie_url'], |
| 1890 | 'data-lottie-loop' => $settings['lottie_loop'], |
| 1891 | 'data-lottie-reverse' => $settings['lottie_reverse'], |
| 1892 | ) |
| 1893 | ); |
| 1894 | } |
| 1895 | |
| 1896 | ?> |
| 1897 | |
| 1898 | <div class="premium-progressbar-circle-content"> |
| 1899 | |
| 1900 | <?php |
| 1901 | if ( 'icon' === $icon_type ) : |
| 1902 | if ( 'yes' !== $settings['draw_svg'] ) : |
| 1903 | Icons_Manager::render_icon( |
| 1904 | $settings['icon_select'], |
| 1905 | array( |
| 1906 | 'class' => array( 'premium-progressbar-circle-icon', 'premium-svg-nodraw', 'premium-drawable-icon' ), |
| 1907 | 'aria-hidden' => 'true', |
| 1908 | ) |
| 1909 | ); |
| 1910 | else : |
| 1911 | ?> |
| 1912 | <i <?php echo wp_kses_post( $this->get_render_attribute_string( 'icon' ) ); ?>></i> |
| 1913 | <?php |
| 1914 | endif; |
| 1915 | |
| 1916 | elseif ( 'svg' === $icon_type ) : |
| 1917 | ?> |
| 1918 | <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'icon' ) ); ?>> |
| 1919 | <?php $this->print_unescaped_setting( 'custom_svg' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 1920 | </div> |
| 1921 | <?php |
| 1922 | elseif ( 'image' === $icon_type ) : |
| 1923 | ?> |
| 1924 | <img class="premium-progressbar-circle-icon" src="<?php echo esc_attr( $settings['image_upload']['url'] ); ?>"> |
| 1925 | <?php else : ?> |
| 1926 | <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'progress_lottie' ) ); ?>></div> |
| 1927 | <?php endif; ?> |
| 1928 | |
| 1929 | <p <?php echo wp_kses_post( $this->get_render_attribute_string( 'premium_progressbar_left_label' ) ); ?>> |
| 1930 | <?php echo wp_kses_post( $settings['premium_progressbar_left_label'] ); ?> |
| 1931 | </p> |
| 1932 | <?php if ( 'yes' === $settings['show_percentage_value'] ) : ?> |
| 1933 | <?php if ( 'yes' === $settings['show_percentage_value'] ) : ?> |
| 1934 | <p <?php echo wp_kses_post( $this->get_render_attribute_string( 'premium_progressbar_right_label' ) ); ?>>0%</p> |
| 1935 | <?php endif; ?> |
| 1936 | <?php endif; ?> |
| 1937 | </div> |
| 1938 | |
| 1939 | <?php |
| 1940 | } |
| 1941 | } |
| 1942 |