Plugin Directory

Changeset 3302155


Ignore:
Timestamp:
05/28/2025 11:12:23 AM (10 months ago)
Author:
visualmodo
Message:

1.7.2 - May 28 2025

  • Fixed - Progress Bar Vulnerability.
  • Fixed - Circular Progress Bar Vulnerability.
  • Fixed - Semicircular Progress Bar Vulnerability.
Location:
borderless
Files:
208 added
5 edited

Legend:

Unmodified
Added
Removed
  • borderless/trunk/borderless.php

    r3267283 r3302155  
    55Plugin URI: https://visualmodo.com/borderless/
    66Description: One service packed with powerful tools to help you reach your purposes.
    7 Version: 1.7.1
     7Version: 1.7.2
    88Author: Visualmodo
    99Author URI: https://visualmodo.com
     
    2121/*-----------------------------------------------------------------------------------*/
    2222
    23 define( 'BORDERLESS__VERSION', '1.7.1' );
     23define( 'BORDERLESS__VERSION', '1.7.2' );
    2424define( 'BORDERLESS__DIR', plugin_dir_path( __FILE__ ) );
    2525define( 'BORDERLESS__URL', plugins_url( '/', __FILE__ ) );
  • borderless/trunk/modules/elementor/widgets/circular-progress-bar.php

    r3132733 r3302155  
    3030    }
    3131
    32     public function get_keywords()
    33     {
     32    public function get_keywords() {
    3433        return [
    3534            'circular progress bar',
     
    4342    }
    4443
    45     public function get_custom_help_url()
    46     {
     44    public function get_custom_help_url() {
    4745        return 'https://wpborderless.com/';
    4846    }
    4947
    5048    public function get_style_depends() {
    51         return
    52             [
    53                 'borderless-elementor-style'
    54             ];
     49        return [ 'borderless-elementor-style' ];
    5550    }
    5651   
    5752    public function get_script_depends() {
    58         return
    59             [
    60                 'borderless-elementor-appear-script',
    61                 'borderless-elementor-progressbar-script'
    62             ];
     53        return [
     54            'borderless-elementor-appear-script',
     55            'borderless-elementor-progressbar-script'
     56        ];
    6357    }
    6458   
    6559    protected function _register_controls() {
    66 
    67 
    6860        /*-----------------------------------------------------------------------------------*/
    6961        /*  *.  Layout
    7062        /*-----------------------------------------------------------------------------------*/
    71 
    7263        $this->start_controls_section(
    7364            'borderless_section_circular_progress_bar_layout',
    7465            [
    7566                'label' => esc_html__( 'Layout', 'borderless' ),
    76                 'tab' => Controls_Manager::TAB_CONTENT,
     67                'tab'   => Controls_Manager::TAB_CONTENT,
    7768            ]
    7869        );
     
    8172            'borderless_circular_progress_bar_title',
    8273            [
    83                 'label' => esc_html__( 'Title', 'borderless'),
    84                 'type' => Controls_Manager::TEXT,
    85                 'dynamic' => [
    86                     'active' => true,
    87                 ],
     74                'label'   => esc_html__( 'Title', 'borderless'),
     75                'type'    => Controls_Manager::TEXT,
     76                'dynamic' => [ 'active' => true ],
    8877            ]
    8978        );
     
    9281            'borderless_circular_progress_bar_counter_value',
    9382            [
    94                 'label' => esc_html__( 'Counter Value', 'borderless'),
    95                 'type' => Controls_Manager::SLIDER,
     83                'label'      => esc_html__( 'Counter Value', 'borderless'),
     84                'type'       => Controls_Manager::SLIDER,
    9685                'size_units' => ['%'],
    97                     'range' => [
    98                         '%' => [
     86                'range'      => [
     87                    '%' => [
    9988                        'min' => 1,
    10089                        'max' => 100,
    10190                    ],
    10291                ],
    103                 'default' => [
     92                'default'    => [
    10493                    'unit' => '%',
    10594                    'size' => 50,
    10695                ],
    107                 'separator' => 'before',
     96                'separator'  => 'before',
    10897            ]
    10998        );
     
    112101            'borderless_circular_progress_bar_animation_duration',
    113102            [
    114                 'label' => __('Animation Duration', 'borderless'),
    115                 'type' => Controls_Manager::SLIDER,
     103                'label'      => __( 'Animation Duration', 'borderless' ),
     104                'type'       => Controls_Manager::SLIDER,
    116105                'size_units' => ['px'],
    117                 'range' => [
     106                'range'      => [
    118107                    'px' => [
    119                         'min' => 1000,
    120                         'max' => 10000,
     108                        'min'  => 1000,
     109                        'max'  => 10000,
    121110                        'step' => 100,
    122111                    ],
    123112                ],
    124                 'default' => [
     113                'default'    => [
    125114                    'unit' => 'px',
    126115                    'size' => 1500,
    127116                ],
    128                 'separator' => 'before',
     117                'separator'  => 'before',
    129118            ]
    130119        );
     
    133122
    134123
    135     /*-----------------------------------------------------------------------------------*/
    136     /*  *.  Layout - Style
    137     /*-----------------------------------------------------------------------------------*/
    138 
    139     $this->start_controls_section(
    140         'borderless_section_circular_progress_bar_styles_general',
    141         [
    142             'label' => esc_html__( 'General', 'borderless'),
    143             'tab' => Controls_Manager::TAB_STYLE
    144         ]
    145     );
    146 
    147     $this->add_control(
    148         'borderless_circular_progress_bar_alignment',
    149         [
    150             'label' => __('Alignment', 'borderless'),
    151             'type' => \Elementor\Controls_Manager::CHOOSE,
    152             'options' => [
    153                 'borderless-circular-progress-bar-alignment-left' => [
    154                     'title' => __('Left', 'borderless'),
    155                     'icon' => 'fa fa-align-left',
    156                 ],
    157                 'borderless-circular-progress-bar-alignment-center' => [
    158                     'title' => __('Center', 'borderless'),
    159                     'icon' => 'fa fa-align-center',
    160                 ],
    161                 'borderless-circular-progress-bar-alignment-right' => [
    162                     'title' => __('Right', 'borderless'),
    163                     'icon' => 'fa fa-align-right',
    164                 ],
    165             ],
    166             'default' => 'borderless-circular-progress-bar-alignment-center',
    167         ]
    168     );
    169 
    170     $this->add_control(
    171         'borderless_circular_progress_bar_size',
    172         [
    173             'label' => __('Size', 'borderless'),
    174             'type' => Controls_Manager::SLIDER,
    175             'size_units' => ['px'],
    176             'range' => [
    177                 'px' => [
    178                     'min' => 50,
    179                     'max' => 500,
    180                     'step' => 1,
    181                 ],
    182             ],
    183             'default' => [
    184                 'unit' => 'px',
    185                 'size' => 200,
    186             ],
    187             'selectors' => [
    188                 '{{WRAPPER}} .borderless-elementor-circular-progress-bar' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
    189             ],
    190             'separator' => 'before',
    191         ]
    192     );
    193 
    194     $this->add_control(
    195         'borderless_circular_progress_bar_stroke_width',
    196         [
    197             'label' => __('Stroke Width', 'borderless'),
    198             'type' => Controls_Manager::SLIDER,
    199             'size_units' => ['px'],
    200             'range' => [
    201                 'px' => [
    202                     'min' => 0,
    203                     'max' => 100,
    204                     'step' => 1,
    205                 ],
    206             ],
    207             'default' => [
    208                 'unit' => 'px',
    209                 'size' => 12,
    210             ],
    211             'separator' => 'before',
    212         ]
    213     );
    214 
    215     $this->add_control(
    216         'borderless_circular_progress_bar_stroke_color_style',
    217         [
    218             'label' => __( 'Stroke Color Style', 'borderless' ),
    219             'type' => \Elementor\Controls_Manager::SELECT,
    220             'default' => 'borderless-elementor-circular-progress-bar-stroke-solid-color',
    221             'options' => [
    222                 'borderless-elementor-circular-progress-bar-stroke-solid-color'  => __( 'Solid', 'borderless' ),
    223                 'borderless-elementor-circular-progress-bar-stroke-gradient-color' => __( 'Gradient', 'borderless' ),
    224             ],
    225         ]
    226     );
    227 
    228     $this->add_control(
    229         'borderless_circular_progress_bar_stroke_color',
    230         [
    231             'label' => __('Stroke Color', 'borderless'),
    232             'type' => Controls_Manager::COLOR,
    233             'default' => '#000',
    234             'condition' => [
    235                 'borderless_circular_progress_bar_stroke_color_style' => 'borderless-elementor-circular-progress-bar-stroke-solid-color',
    236             ],
    237         ]
    238     );
    239 
    240     $this->add_control(
    241         'borderless_circular_progress_bar_stroke_color_from',
    242         [
    243             'label' => __('Stroke Color From', 'borderless'),
    244             'type' => Controls_Manager::COLOR,
    245             'default' => '#000',
    246             'condition' => [
    247                 'borderless_circular_progress_bar_stroke_color_style' => 'borderless-elementor-circular-progress-bar-stroke-gradient-color',
    248             ],
    249         ]
    250     );
    251 
    252     $this->add_control(
    253         'borderless_circular_progress_bar_stroke_color_to',
    254         [
    255             'label' => __('Stroke Color To', 'borderless'),
    256             'type' => Controls_Manager::COLOR,
    257             'default' => '#000',
    258             'condition' => [
    259                 'borderless_circular_progress_bar_stroke_color_style' => 'borderless-elementor-circular-progress-bar-stroke-gradient-color',
    260             ],
    261         ]
    262     );
    263 
    264     $this->add_control(
    265         'borderless_circular_progress_bar_trail_width',
    266         [
    267             'label' => __('Trail Width', 'borderless'),
    268             'type' => Controls_Manager::SLIDER,
    269             'size_units' => ['px'],
    270             'range' => [
    271                 'px' => [
    272                     'min' => 0,
    273                     'max' => 100,
    274                     'step' => 1,
    275                 ],
    276             ],
    277             'default' => [
    278                 'unit' => 'px',
    279                 'size' => 12,
    280             ],
    281             'separator' => 'before',
    282         ]
    283     );
    284 
    285     $this->add_control(
    286         'borderless_circular_progress_bar_trail_color',
    287         [
    288             'label' => __('Trail Color', 'borderless'),
    289             'type' => Controls_Manager::COLOR,
    290             'default' => '#eee',
    291         ]
    292     );
    293 
    294     $this->add_control(
    295         'borderless_circular_progress_bar_shape',
    296         [
    297             'label' => __( 'Shape', 'borderless' ),
    298             'type' => \Elementor\Controls_Manager::SELECT,
    299             'default' => 'borderless-elementor-circular-progress-bar--round',
    300             'options' => [
    301                 'borderless-elementor-circular-progress-bar--square'  => __( 'Square', 'borderless' ),
    302                 'borderless-elementor-circular-progress-bar--round' => __( 'Round', 'borderless' ),
    303             ],
    304             'separator' => 'before',
    305         ]
    306     ); 
    307 
    308     $this->add_control(
    309         'borderless_circular_progress_bar_background_color',
    310         [
    311             'label' => __('Background Color', 'borderless'),
    312             'type' => Controls_Manager::COLOR,
    313             'default' => '#fff',
    314             'selectors' => [
    315                 '{{WRAPPER}} .borderless-elementor-circular-progress-bar' => 'background-color: {{VALUE}}',
    316             ],
    317         ]
    318     );
    319 
    320     $this->add_group_control(
    321         Group_Control_Box_Shadow::get_type(),
    322         [
    323             'name' => 'borderless_circular_progress_bar_box_shadow',
    324             'label' => __('Box Shadow', 'borderless'),
    325             'selector' => '{{WRAPPER}} .borderless-elementor-circular-progress-bar',
    326             'separator' => 'before',
    327         ]
    328     );
    329 
    330     $this->end_controls_section();
    331 
    332     /*-----------------------------------------------------------------------------------*/
    333     /*  *.  Typography - Style
    334     /*-----------------------------------------------------------------------------------*/
    335 
    336     $this->start_controls_section(
    337         'borderless_section_circular_progress_bar_typography',
    338         [
    339             'label' => __('Typography', 'borderless'),
    340             'tab' => Controls_Manager::TAB_STYLE,
    341         ]
    342     );
    343 
    344     $this->add_group_control(
    345         Group_Control_Typography::get_type(),
    346         [
    347             'name' => 'borderless_circular_progress_bar_title_typography',
    348             'label' => __('Title', 'borderless'),
    349             'global'   => [
    350                 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
    351             ],
    352             'selector' => '{{WRAPPER}} .borderless-elementor-circular-progress-bar .progressbar-text .borderless-elementor-circular-progress-bar-title',
    353         ]
    354     );
    355 
    356     $this->add_control(
    357         'borderless_circular_progress_bar_title_color',
    358         [
    359             'label' => __('Title Color', 'borderless'),
    360             'type' => Controls_Manager::COLOR,
    361             'default' => '',
    362             'selectors' => [
    363                 '{{WRAPPER}} .borderless-elementor-circular-progress-bar .progressbar-text .borderless-elementor-circular-progress-bar-title' => 'color: {{VALUE}}',
    364             ],
    365             'separator' => 'after',
    366         ]
    367     );
    368 
    369     $this->add_group_control(
    370         Group_Control_Typography::get_type(),
    371         [
    372             'name' => 'borderless_circular_progress_bar_counter_typography',
    373             'label' => __('Counter', 'borderless'),
    374             'global'   => [
    375                 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
    376             ],
    377             'selector' => '{{WRAPPER}} .borderless-elementor-circular-progress-bar .progressbar-text .borderless-elementor-circular-progress-bar-counter-value',
    378         ]
    379     );
    380 
    381     $this->add_control(
    382         'borderless_circular_progress_bar_counter_color',
    383         [
    384             'label' => __('Counter Color', 'borderless'),
    385             'type' => Controls_Manager::COLOR,
    386             'default' => '',
    387             'separator' => 'after',
    388         ]
    389     );
    390 
    391     $this->add_group_control(
    392         Group_Control_Typography::get_type(),
    393         [
    394             'name' => 'borderless_circular_progress_bar_postfix_typography',
    395             'label' => __('Postfix', 'borderless'),
    396             'global'   => [
    397                 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
    398             ],
    399             'selector' => '{{WRAPPER}} .borderless-elementor-circular-progress-bar-counter-postfix',
    400         ]
    401     );
    402 
    403     $this->add_control(
    404         'borderless_circular_progress_bar_postfix_color',
    405         [
    406             'label' => __('Postfix Color', 'borderless'),
    407             'type' => Controls_Manager::COLOR,
    408             'default' => '',
    409             'selectors' => [
    410                 '{{WRAPPER}} .borderless-elementor-circular-progress-bar-counter-postfix' => 'color: {{VALUE}}',
    411             ],
    412         ]
    413     );
    414 
    415     $this->end_controls_section();
    416 
     124        /*-----------------------------------------------------------------------------------*/
     125        /*  *.  Layout - Style
     126        /*-----------------------------------------------------------------------------------*/
     127        $this->start_controls_section(
     128            'borderless_section_circular_progress_bar_styles_general',
     129            [
     130                'label' => esc_html__( 'General', 'borderless'),
     131                'tab'   => Controls_Manager::TAB_STYLE
     132            ]
     133        );
     134
     135        $this->add_control(
     136            'borderless_circular_progress_bar_alignment',
     137            [
     138                'label'   => __( 'Alignment', 'borderless' ),
     139                'type'    => Controls_Manager::CHOOSE,
     140                'options' => [
     141                    'borderless-circular-progress-bar-alignment-left'   => [
     142                        'title' => __( 'Left', 'borderless' ),
     143                        'icon'  => 'fa fa-align-left',
     144                    ],
     145                    'borderless-circular-progress-bar-alignment-center' => [
     146                        'title' => __( 'Center', 'borderless' ),
     147                        'icon'  => 'fa fa-align-center',
     148                    ],
     149                    'borderless-circular-progress-bar-alignment-right'  => [
     150                        'title' => __( 'Right', 'borderless' ),
     151                        'icon'  => 'fa fa-align-right',
     152                    ],
     153                ],
     154                'default' => 'borderless-circular-progress-bar-alignment-center',
     155            ]
     156        );
     157
     158        $this->add_control(
     159            'borderless_circular_progress_bar_size',
     160            [
     161                'label'      => __( 'Size', 'borderless' ),
     162                'type'       => Controls_Manager::SLIDER,
     163                'size_units' => ['px'],
     164                'range'      => [
     165                    'px' => [
     166                        'min'  => 50,
     167                        'max'  => 500,
     168                        'step' => 1,
     169                    ],
     170                ],
     171                'default'    => [
     172                    'unit' => 'px',
     173                    'size' => 200,
     174                ],
     175                'selectors'  => [
     176                    '{{WRAPPER}} .borderless-elementor-circular-progress-bar' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
     177                ],
     178                'separator'  => 'before',
     179            ]
     180        );
     181
     182        $this->add_control(
     183            'borderless_circular_progress_bar_stroke_width',
     184            [
     185                'label'      => __( 'Stroke Width', 'borderless' ),
     186                'type'       => Controls_Manager::SLIDER,
     187                'size_units' => ['px'],
     188                'range'      => [
     189                    'px' => [
     190                        'min'  => 0,
     191                        'max'  => 100,
     192                        'step' => 1,
     193                    ],
     194                ],
     195                'default'    => [
     196                    'unit' => 'px',
     197                    'size' => 12,
     198                ],
     199                'separator'  => 'before',
     200            ]
     201        );
     202
     203        $this->add_control(
     204            'borderless_circular_progress_bar_stroke_color_style',
     205            [
     206                'label'   => __( 'Stroke Color Style', 'borderless' ),
     207                'type'    => Controls_Manager::SELECT,
     208                'default' => 'borderless-elementor-circular-progress-bar-stroke-solid-color',
     209                'options' => [
     210                    'borderless-elementor-circular-progress-bar-stroke-solid-color'    => __( 'Solid',    'borderless' ),
     211                    'borderless-elementor-circular-progress-bar-stroke-gradient-color' => __( 'Gradient', 'borderless' ),
     212                ],
     213            ]
     214        );
     215
     216        $this->add_control(
     217            'borderless_circular_progress_bar_stroke_color',
     218            [
     219                'label'     => __( 'Stroke Color', 'borderless' ),
     220                'type'      => Controls_Manager::COLOR,
     221                'default'   => '#000',
     222                'condition' => [
     223                    'borderless_circular_progress_bar_stroke_color_style' => 'borderless-elementor-circular-progress-bar-stroke-solid-color',
     224                ],
     225            ]
     226        );
     227
     228        $this->add_control(
     229            'borderless_circular_progress_bar_stroke_color_from',
     230            [
     231                'label'     => __( 'Stroke Color From', 'borderless' ),
     232                'type'      => Controls_Manager::COLOR,
     233                'default'   => '#000',
     234                'condition' => [
     235                    'borderless_circular_progress_bar_stroke_color_style' => 'borderless-elementor-circular-progress-bar-stroke-gradient-color',
     236                ],
     237            ]
     238        );
     239
     240        $this->add_control(
     241            'borderless_circular_progress_bar_stroke_color_to',
     242            [
     243                'label'     => __( 'Stroke Color To', 'borderless' ),
     244                'type'      => Controls_Manager::COLOR,
     245                'default'   => '#000',
     246                'condition' => [
     247                    'borderless_circular_progress_bar_stroke_color_style' => 'borderless-elementor-circular-progress-bar-stroke-gradient-color',
     248                ],
     249            ]
     250        );
     251
     252        $this->add_control(
     253            'borderless_circular_progress_bar_trail_width',
     254            [
     255                'label'      => __( 'Trail Width', 'borderless' ),
     256                'type'       => Controls_Manager::SLIDER,
     257                'size_units' => ['px'],
     258                'range'      => [
     259                    'px' => [
     260                        'min'  => 0,
     261                        'max'  => 100,
     262                        'step' => 1,
     263                    ],
     264                ],
     265                'default'    => [
     266                    'unit' => 'px',
     267                    'size' => 12,
     268                ],
     269                'separator'  => 'before',
     270            ]
     271        );
     272
     273        $this->add_control(
     274            'borderless_circular_progress_bar_trail_color',
     275            [
     276                'label'   => __( 'Trail Color', 'borderless' ),
     277                'type'    => Controls_Manager::COLOR,
     278                'default' => '#eee',
     279            ]
     280        );
     281
     282        $this->add_control(
     283            'borderless_circular_progress_bar_shape',
     284            [
     285                'label'   => __( 'Shape', 'borderless' ),
     286                'type'    => Controls_Manager::SELECT,
     287                'default' => 'borderless-elementor-circular-progress-bar--round',
     288                'options' => [
     289                    'borderless-elementor-circular-progress-bar--square' => __( 'Square', 'borderless' ),
     290                    'borderless-elementor-circular-progress-bar--round'  => __( 'Round',  'borderless' ),
     291                ],
     292                'separator' => 'before',
     293            ]
     294        ); 
     295
     296        $this->add_control(
     297            'borderless_circular_progress_bar_background_color',
     298            [
     299                'label'     => __( 'Background Color', 'borderless' ),
     300                'type'      => Controls_Manager::COLOR,
     301                'default'   => '#fff',
     302                'selectors' => [
     303                    '{{WRAPPER}} .borderless-elementor-circular-progress-bar' => 'background-color: {{VALUE}}',
     304                ],
     305            ]
     306        );
     307
     308        $this->add_group_control(
     309            Group_Control_Box_Shadow::get_type(),
     310            [
     311                'name'     => 'borderless_circular_progress_bar_box_shadow',
     312                'label'    => __( 'Box Shadow', 'borderless' ),
     313                'selector' => '{{WRAPPER}} .borderless-elementor-circular-progress-bar',
     314                'separator'=> 'before',
     315            ]
     316        );
     317
     318        $this->end_controls_section();
     319
     320        /*-----------------------------------------------------------------------------------*/
     321        /*  *.  Typography - Style
     322        /*-----------------------------------------------------------------------------------*/
     323        $this->start_controls_section(
     324            'borderless_section_circular_progress_bar_typography',
     325            [
     326                'label' => __( 'Typography', 'borderless' ),
     327                'tab'   => Controls_Manager::TAB_STYLE,
     328            ]
     329        );
     330
     331        $this->add_group_control(
     332            Group_Control_Typography::get_type(),
     333            [
     334                'name'    => 'borderless_circular_progress_bar_title_typography',
     335                'label'   => __( 'Title', 'borderless' ),
     336                'global'  => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY ],
     337                'selector'=> '{{WRAPPER}} .borderless-elementor-circular-progress-bar .progressbar-text .borderless-elementor-circular-progress-bar-title',
     338            ]
     339        );
     340
     341        $this->add_control(
     342            'borderless_circular_progress_bar_title_color',
     343            [
     344                'label'     => __( 'Title Color', 'borderless' ),
     345                'type'      => Controls_Manager::COLOR,
     346                'default'   => '',
     347                'selectors' => [
     348                    '{{WRAPPER}} .borderless-elementor-circular-progress-bar .progressbar-text .borderless-elementor-circular-progress-bar-title' => 'color: {{VALUE}}',
     349                ],
     350                'separator'=> 'after',
     351            ]
     352        );
     353
     354        $this->add_group_control(
     355            Group_Control_Typography::get_type(),
     356            [
     357                'name'     => 'borderless_circular_progress_bar_counter_typography',
     358                'label'    => __( 'Counter', 'borderless' ),
     359                'global'   => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY ],
     360                'selector' => '{{WRAPPER}} .borderless-elementor-circular-progress-bar .progressbar-text .borderless-elementor-circular-progress-bar-counter-value',
     361            ]
     362        );
     363
     364        $this->add_control(
     365            'borderless_circular_progress_bar_counter_color',
     366            [
     367                'label'     => __( 'Counter Color', 'borderless' ),
     368                'type'      => Controls_Manager::COLOR,
     369                'default'   => '',
     370                'separator'=> 'after',
     371            ]
     372        );
     373
     374        $this->add_group_control(
     375            Group_Control_Typography::get_type(),
     376            [
     377                'name'     => 'borderless_circular_progress_bar_postfix_typography',
     378                'label'    => __( 'Postfix', 'borderless' ),
     379                'global'   => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY ],
     380                'selector' => '{{WRAPPER}} .borderless-elementor-circular-progress-bar-counter-postfix',
     381            ]
     382        );
     383
     384        $this->add_control(
     385            'borderless_circular_progress_bar_postfix_color',
     386            [
     387                'label'     => __( 'Postfix Color', 'borderless' ),
     388                'type'      => Controls_Manager::COLOR,
     389                'default'   => '',
     390                'selectors' => [
     391                    '{{WRAPPER}} .borderless-elementor-circular-progress-bar-counter-postfix' => 'color: {{VALUE}}',
     392                ],
     393            ]
     394        );
     395
     396        $this->end_controls_section();
    417397    }
    418398
     
    424404        $settings = $this->get_settings_for_display();
    425405
    426         if ($settings['borderless_circular_progress_bar_stroke_color_style'] == 'borderless-elementor-circular-progress-bar-stroke-solid-color' ) {
    427             $borderless_circular_progress_bar_stroke_color_style = 'stroke_color_mode="solid" stroke_color="'.esc_attr($settings['borderless_circular_progress_bar_stroke_color']).'"';
    428 
     406        // Sanitize and escape the Title field to prevent stored XSS
     407        $raw_title   = $settings['borderless_circular_progress_bar_title'];
     408        $clean_title = sanitize_text_field( $raw_title );
     409        $safe_title  = esc_js( $clean_title );
     410
     411        if ( 'borderless-elementor-circular-progress-bar-stroke-solid-color' === $settings['borderless_circular_progress_bar_stroke_color_style'] ) {
     412            $borderless_circular_progress_bar_stroke_color_style = 'stroke_color_mode="solid" stroke_color="' . esc_attr( $settings['borderless_circular_progress_bar_stroke_color'] ) . '"';
    429413        } else {
    430             $borderless_circular_progress_bar_stroke_color_style = 'stroke_color_mode="gradient" stroke_color="'.esc_attr($settings['borderless_circular_progress_bar_stroke_color']).'" stroke_color_from="'.esc_attr($settings['borderless_circular_progress_bar_stroke_color_from']).'" stroke_color_to="'.esc_attr($settings['borderless_circular_progress_bar_stroke_color_to']).'"';
     414            $borderless_circular_progress_bar_stroke_color_style = 'stroke_color_mode="gradient" stroke_color="' . esc_attr( $settings['borderless_circular_progress_bar_stroke_color'] ) . '" stroke_color_from="' . esc_attr( $settings['borderless_circular_progress_bar_stroke_color_from'] ) . '" stroke_color_to="' . esc_attr( $settings['borderless_circular_progress_bar_stroke_color_to'] ) . '"';
    431415        }
    432416
    433         echo'<div class="borderless-elementor-circular-progress-bar-widget '.esc_attr($settings['borderless_circular_progress_bar_alignment']).'"><div class="borderless-elementor-circular-progress-bar '.esc_attr($settings['borderless_circular_progress_bar_shape']).'" title="'.esc_attr($settings['borderless_circular_progress_bar_title']).'" counter_value="'.esc_attr($settings['borderless_circular_progress_bar_counter_value']['size']).'" '.$borderless_circular_progress_bar_stroke_color_style.' trail_color="'.esc_attr($settings['borderless_circular_progress_bar_trail_color']).'" counter_color="'.esc_attr($settings['borderless_circular_progress_bar_counter_color']).'" stroke_width="'.esc_attr($settings['borderless_circular_progress_bar_stroke_width']['size']).'" trail_width="'.esc_attr($settings['borderless_circular_progress_bar_trail_width']['size']).'" animation_duration="'.esc_attr($settings['borderless_circular_progress_bar_animation_duration']['size']).'">
    434         </div></div>';
    435 
     417        echo '<div class="borderless-elementor-circular-progress-bar-widget ' . esc_attr( $settings['borderless_circular_progress_bar_alignment'] ) . '">
     418            <div class="borderless-elementor-circular-progress-bar ' . esc_attr( $settings['borderless_circular_progress_bar_shape'] ) . '"
     419                 title="'             . $safe_title                                                                     . '"
     420                 counter_value="'    . esc_attr( $settings['borderless_circular_progress_bar_counter_value']['size'] )           . '"
     421                 '                  . $borderless_circular_progress_bar_stroke_color_style                                  . '
     422                 trail_color="'      . esc_attr( $settings['borderless_circular_progress_bar_trail_color'] )                . '"
     423                 counter_color="'    . esc_attr( $settings['borderless_circular_progress_bar_counter_color'] )              . '"
     424                 stroke_width="'     . esc_attr( $settings['borderless_circular_progress_bar_stroke_width']['size'] )      . '"
     425                 trail_width="'      . esc_attr( $settings['borderless_circular_progress_bar_trail_width']['size'] )       . '"
     426                 animation_duration="' . esc_attr( $settings['borderless_circular_progress_bar_animation_duration']['size'] ) . '">
     427            </div>
     428        </div>';
    436429    }
    437430   
    438     protected function _content_template() {
    439 
    440     }
    441    
    442    
     431    protected function _content_template() {}
    443432}
  • borderless/trunk/modules/elementor/widgets/progress-bar.php

    r3132733 r3302155  
    1919   
    2020    public function get_title() {
    21         return esc_html__( 'Progress Bar', 'borderless');
     21        return esc_html__( 'Progress Bar', 'borderless' );
    2222    }
    2323   
     
    3030    }
    3131
    32     public function get_keywords()
    33     {
     32    public function get_keywords() {
    3433        return [
    3534            'progress bar',
     
    4140    }
    4241
    43     public function get_custom_help_url()
    44     {
     42    public function get_custom_help_url() {
    4543        return 'https://wpborderless.com/';
    4644    }
    4745
    4846    public function get_style_depends() {
    49         return
    50             [
    51                 'borderless-elementor-style'
    52             ];
     47        return [ 'borderless-elementor-style' ];
    5348    }
    5449   
    5550    public function get_script_depends() {
    56         return
    57             [
    58                 'borderless-elementor-appear-script',
    59                 'borderless-elementor-progressbar-script'
    60             ];
     51        return [
     52            'borderless-elementor-appear-script',
     53            'borderless-elementor-progressbar-script',
     54        ];
    6155    }
    6256   
    6357    protected function _register_controls() {
    6458
    65 
    6659        /*-----------------------------------------------------------------------------------*/
    6760        /*  *.  Layout
    6861        /*-----------------------------------------------------------------------------------*/
    69 
    7062        $this->start_controls_section(
    7163            'borderless_elementor_section_progress_bar_layout',
    7264            [
    7365                'label' => esc_html__( 'Layout', 'borderless' ),
    74                 'tab' => Controls_Manager::TAB_CONTENT,
     66                'tab'   => Controls_Manager::TAB_CONTENT,
    7567            ]
    7668        );
     
    7971            'borderless_elementor_progress_bar_title',
    8072            [
    81                 'label' => esc_html__( 'Title', 'borderless'),
    82                 'type' => Controls_Manager::TEXT,
    83                 'dynamic' => [
    84                     'active' => true,
    85                 ],
     73                'label'   => esc_html__( 'Title', 'borderless' ),
     74                'type'    => Controls_Manager::TEXT,
     75                'dynamic' => [ 'active' => true ],
    8676            ]
    8777        );
     
    9080            'borderless_elementor_progress_bar_counter_value',
    9181            [
    92                 'label' => esc_html__( 'Counter Value', 'borderless'),
    93                 'type' => Controls_Manager::SLIDER,
    94                 'size_units' => ['%'],
    95                     'range' => [
    96                         '%' => [
     82                'label'      => esc_html__( 'Counter Value', 'borderless' ),
     83                'type'       => Controls_Manager::SLIDER,
     84                'size_units' => [ '%' ],
     85                'range'      => [
     86                    '%' => [
    9787                        'min' => 1,
    9888                        'max' => 100,
    9989                    ],
    10090                ],
    101                 'default' => [
     91                'default'    => [
    10292                    'unit' => '%',
    10393                    'size' => 50,
    10494                ],
    105                 'separator' => 'before',
     95                'separator'  => 'before',
    10696            ]
    10797        );
     
    110100            'borderless_elementor_progress_bar_animation_duration',
    111101            [
    112                 'label' => __('Animation Duration', 'borderless'),
    113                 'type' => Controls_Manager::SLIDER,
    114                 'size_units' => ['px'],
    115                 'range' => [
     102                'label'      => __( 'Animation Duration', 'borderless' ),
     103                'type'       => Controls_Manager::SLIDER,
     104                'size_units' => [ 'px' ],
     105                'range'      => [
    116106                    'px' => [
    117                         'min' => 1000,
    118                         'max' => 10000,
     107                        'min'  => 1000,
     108                        'max'  => 10000,
    119109                        'step' => 100,
    120110                    ],
    121111                ],
    122                 'default' => [
     112                'default'    => [
    123113                    'unit' => 'px',
    124114                    'size' => 1500,
    125115                ],
    126                 'separator' => 'before',
     116                'separator'  => 'before',
    127117            ]
    128118        );
     
    131121
    132122
    133     /*-----------------------------------------------------------------------------------*/
    134     /*  *.  Layout - Style
    135     /*-----------------------------------------------------------------------------------*/
    136 
    137     $this->start_controls_section(
    138         'borderless_elementor_section_progress_bar_styles_general',
    139         [
    140             'label' => esc_html__( 'General', 'borderless'),
    141             'tab' => Controls_Manager::TAB_STYLE
    142         ]
    143     );
    144 
    145     $this->add_control(
    146         'borderless_elementor_progress_bar_alignment',
    147         [
    148             'label' => __('Alignment', 'borderless'),
    149             'type' => \Elementor\Controls_Manager::CHOOSE,
    150             'options' => [
    151                 'borderless-elementor-progress-bar-alignment-left' => [
    152                     'title' => __('Left', 'borderless'),
    153                     'icon' => 'fa fa-align-left',
    154                 ],
    155                 'borderless-elementor-progress-bar-alignment-center' => [
    156                     'title' => __('Center', 'borderless'),
    157                     'icon' => 'fa fa-align-center',
    158                 ],
    159                 'borderless-elementor-progress-bar-alignment-right' => [
    160                     'title' => __('Right', 'borderless'),
    161                     'icon' => 'fa fa-align-right',
    162                 ],
    163             ],
    164             'default' => 'borderless-elementor-progress-bar-alignment-center',
    165         ]
    166     );
    167 
    168     $this->add_control(
    169         'borderless_elementor_progress_bar_size',
    170         [
    171             'label' => __('Size', 'borderless'),
    172             'type' => Controls_Manager::SLIDER,
    173             'size_units' => ['%'],
    174             'range' => [
    175                 '%' => [
    176                     'min' => 1,
    177                     'max' => 100,
    178                     'step' => 1,
    179                 ],
    180             ],
    181             'default' => [
    182                 'unit' => '%',
    183                 'size' => 100,
    184             ],
    185             'selectors' => [
    186                 '{{WRAPPER}} .borderless-elementor-progress-bar' => 'width: {{SIZE}}{{UNIT}};',
    187             ],
    188             'separator' => 'before',
    189         ]
    190     );
    191 
    192     $this->add_control(
    193         'borderless_elementor_progress_bar_stroke_width',
    194         [
    195             'label' => __('Stroke Width', 'borderless'),
    196             'type' => Controls_Manager::SLIDER,
    197             'size_units' => ['px'],
    198             'range' => [
    199                 'px' => [
    200                     'min' => 0,
    201                     'max' => 100,
    202                     'step' => 1,
    203                 ],
    204             ],
    205             'default' => [
    206                 'unit' => 'px',
    207                 'size' => 2,
    208             ],
    209             'separator' => 'before',
    210         ]
    211     );
    212 
    213     $this->add_control(
    214         'borderless_elementor_progress_bar_stroke_color_style',
    215         [
    216             'label' => __( 'Stroke Color Style', 'borderless' ),
    217             'type' => \Elementor\Controls_Manager::SELECT,
    218             'default' => 'borderless-elementor-progress-bar-stroke-solid-color',
    219             'options' => [
    220                 'borderless-elementor-progress-bar-stroke-solid-color'  => __( 'Solid', 'borderless' ),
    221                 'borderless-elementor-progress-bar-stroke-gradient-color' => __( 'Gradient', 'borderless' ),
    222             ],
    223         ]
    224     );
    225 
    226     $this->add_control(
    227         'borderless_elementor_progress_bar_stroke_color',
    228         [
    229             'label' => __('Stroke Color', 'borderless'),
    230             'type' => Controls_Manager::COLOR,
    231             'default' => '#000',
    232             'condition' => [
    233                 'borderless_elementor_progress_bar_stroke_color_style' => 'borderless-elementor-progress-bar-stroke-solid-color',
    234             ],
    235         ]
    236     );
    237 
    238     $this->add_control(
    239         'borderless_elementor_progress_bar_stroke_color_from',
    240         [
    241             'label' => __('Stroke Color From', 'borderless'),
    242             'type' => Controls_Manager::COLOR,
    243             'default' => '#000',
    244             'condition' => [
    245                 'borderless_elementor_progress_bar_stroke_color_style' => 'borderless-elementor-progress-bar-stroke-gradient-color',
    246             ],
    247         ]
    248     );
    249 
    250     $this->add_control(
    251         'borderless_elementor_progress_bar_stroke_color_to',
    252         [
    253             'label' => __('Stroke Color To', 'borderless'),
    254             'type' => Controls_Manager::COLOR,
    255             'default' => '#000',
    256             'condition' => [
    257                 'borderless_elementor_progress_bar_stroke_color_style' => 'borderless-elementor-progress-bar-stroke-gradient-color',
    258             ],
    259         ]
    260     );
    261 
    262     $this->add_control(
    263         'borderless_elementor_progress_bar_trail_width',
    264         [
    265             'label' => __('Trail Width', 'borderless'),
    266             'type' => Controls_Manager::SLIDER,
    267             'size_units' => ['px'],
    268             'range' => [
    269                 'px' => [
    270                     'min' => 0,
    271                     'max' => 100,
    272                     'step' => 1,
    273                 ],
    274             ],
    275             'default' => [
    276                 'unit' => 'px',
    277                 'size' => 2,
    278             ],
    279             'separator' => 'before',
    280         ]
    281     );
    282 
    283     $this->add_control(
    284         'borderless_elementor_progress_bar_trail_color',
    285         [
    286             'label' => __('Trail Color', 'borderless'),
    287             'type' => Controls_Manager::COLOR,
    288             'default' => '#eee',
    289         ]
    290     );
    291 
    292     $this->add_control(
    293         'borderless_elementor_progress_bar_background_color',
    294         [
    295             'label' => __('Background Color', 'borderless'),
    296             'type' => Controls_Manager::COLOR,
    297             'default' => '#fff',
    298             'selectors' => [
    299                 '{{WRAPPER}} .borderless-elementor-progress-bar' => 'background-color: {{VALUE}}',
    300             ],
    301             'separator' => 'before',
    302         ]
    303     );
    304 
    305     $this->add_group_control(
    306         Group_Control_Box_Shadow::get_type(),
    307         [
    308             'name' => 'borderless_elementor_progress_bar_box_shadow',
    309             'label' => __('Box Shadow', 'borderless'),
    310             'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar',
    311             'separator' => 'before',
    312         ]
    313     );
    314 
    315     $this->end_controls_section();
    316 
    317     /*-----------------------------------------------------------------------------------*/
    318     /*  *.  Typography - Style
    319     /*-----------------------------------------------------------------------------------*/
    320 
    321     $this->start_controls_section(
    322         'borderless_section_circular_progress_bar_typography',
    323         [
    324             'label' => __('Typography', 'borderless'),
    325             'tab' => Controls_Manager::TAB_STYLE,
    326         ]
    327     );
    328 
    329     $this->add_group_control(
    330         Group_Control_Typography::get_type(),
    331         [
    332             'name' => 'borderless_elementor_progress_bar_title_typography',
    333             'label' => __('Title', 'borderless'),
    334             'global' => [
    335                 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
    336             ],
    337             'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-title',
    338         ]
    339     );
    340 
    341     $this->add_control(
    342         'borderless_elementor_progress_bar_title_color',
    343         [
    344             'label' => __('Title Color', 'borderless'),
    345             'type' => Controls_Manager::COLOR,
    346             'default' => '',
    347             'selectors' => [
    348                 '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-title' => 'color: {{VALUE}}',
    349             ],
    350             'separator' => 'after',
    351         ]
    352     );
    353 
    354     $this->add_group_control(
    355         Group_Control_Typography::get_type(),
    356         [
    357             'name' => 'borderless_elementor_progress_bar_counter_typography',
    358             'label' => __('Counter', 'borderless'),
    359             'global' => [
    360                 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
    361             ],
    362             'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-counter-value',
    363         ]
    364     );
    365 
    366     $this->add_control(
    367         'borderless_elementor_progress_bar_counter_color',
    368         [
    369             'label' => __('Counter Color', 'borderless'),
    370             'type' => Controls_Manager::COLOR,
    371             'default' => '',
    372             'separator' => 'after',
    373         ]
    374     );
    375 
    376     $this->add_group_control(
    377         Group_Control_Typography::get_type(),
    378         [
    379             'name' => 'borderless_elementor_progress_bar_postfix_typography',
    380             'label' => __('Postfix', 'borderless'),
    381             'global' => [
    382                 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
    383             ],
    384             'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-counter-postfix',
    385         ]
    386     );
    387 
    388     $this->add_control(
    389         'borderless_elementor_progress_bar_postfix_color',
    390         [
    391             'label' => __('Postfix Color', 'borderless'),
    392             'type' => Controls_Manager::COLOR,
    393             'default' => '',
    394             'selectors' => [
    395                 '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-counter-postfix' => 'color: {{VALUE}}',
    396             ],
    397         ]
    398     );
    399 
    400     $this->end_controls_section();
    401 
     123        /*-----------------------------------------------------------------------------------*/
     124        /*  *.  Layout - Style
     125        /*-----------------------------------------------------------------------------------*/
     126        $this->start_controls_section(
     127            'borderless_elementor_section_progress_bar_styles_general',
     128            [
     129                'label' => esc_html__( 'General', 'borderless' ),
     130                'tab'   => Controls_Manager::TAB_STYLE,
     131            ]
     132        );
     133
     134        $this->add_control(
     135            'borderless_elementor_progress_bar_alignment',
     136            [
     137                'label'   => __( 'Alignment', 'borderless' ),
     138                'type'    => Controls_Manager::CHOOSE,
     139                'options' => [
     140                    'borderless-elementor-progress-bar-alignment-left'   => [
     141                        'title' => __( 'Left', 'borderless' ),
     142                        'icon'  => 'fa fa-align-left',
     143                    ],
     144                    'borderless-elementor-progress-bar-alignment-center' => [
     145                        'title' => __( 'Center', 'borderless' ),
     146                        'icon'  => 'fa fa-align-center',
     147                    ],
     148                    'borderless-elementor-progress-bar-alignment-right'  => [
     149                        'title' => __( 'Right', 'borderless' ),
     150                        'icon'  => 'fa fa-align-right',
     151                    ],
     152                ],
     153                'default' => 'borderless-elementor-progress-bar-alignment-center',
     154            ]
     155        );
     156
     157        $this->add_control(
     158            'borderless_elementor_progress_bar_size',
     159            [
     160                'label'      => __( 'Size', 'borderless' ),
     161                'type'       => Controls_Manager::SLIDER,
     162                'size_units' => [ '%' ],
     163                'range'      => [
     164                    '%' => [
     165                        'min'  => 1,
     166                        'max'  => 100,
     167                        'step' => 1,
     168                    ],
     169                ],
     170                'default'    => [
     171                    'unit' => '%',
     172                    'size' => 100,
     173                ],
     174                'selectors'  => [
     175                    '{{WRAPPER}} .borderless-elementor-progress-bar' => 'width: {{SIZE}}{{UNIT}};',
     176                ],
     177                'separator'  => 'before',
     178            ]
     179        );
     180
     181        $this->add_control(
     182            'borderless_elementor_progress_bar_stroke_width',
     183            [
     184                'label'      => __( 'Stroke Width', 'borderless' ),
     185                'type'       => Controls_Manager::SLIDER,
     186                'size_units' => [ 'px' ],
     187                'range'      => [
     188                    'px' => [
     189                        'min'  => 0,
     190                        'max'  => 100,
     191                        'step' => 1,
     192                    ],
     193                ],
     194                'default'    => [
     195                    'unit' => 'px',
     196                    'size' => 2,
     197                ],
     198                'separator'  => 'before',
     199            ]
     200        );
     201
     202        $this->add_control(
     203            'borderless_elementor_progress_bar_stroke_color_style',
     204            [
     205                'label'   => __( 'Stroke Color Style', 'borderless' ),
     206                'type'    => Controls_Manager::SELECT,
     207                'default' => 'borderless-elementor-progress-bar-stroke-solid-color',
     208                'options' => [
     209                    'borderless-elementor-progress-bar-stroke-solid-color'    => __( 'Solid',    'borderless' ),
     210                    'borderless-elementor-progress-bar-stroke-gradient-color' => __( 'Gradient', 'borderless' ),
     211                ],
     212            ]
     213        );
     214
     215        $this->add_control(
     216            'borderless_elementor_progress_bar_stroke_color',
     217            [
     218                'label'     => __( 'Stroke Color', 'borderless' ),
     219                'type'      => Controls_Manager::COLOR,
     220                'default'   => '#000',
     221                'condition' => [
     222                    'borderless_elementor_progress_bar_stroke_color_style' => 'borderless-elementor-progress-bar-stroke-solid-color',
     223                ],
     224            ]
     225        );
     226
     227        $this->add_control(
     228            'borderless_elementor_progress_bar_stroke_color_from',
     229            [
     230                'label'     => __( 'Stroke Color From', 'borderless' ),
     231                'type'      => Controls_Manager::COLOR,
     232                'default'   => '#000',
     233                'condition' => [
     234                    'borderless_elementor_progress_bar_stroke_color_style' => 'borderless-elementor-progress-bar-stroke-gradient-color',
     235                ],
     236            ]
     237        );
     238
     239        $this->add_control(
     240            'borderless_elementor_progress_bar_stroke_color_to',
     241            [
     242                'label'     => __( 'Stroke Color To', 'borderless' ),
     243                'type'      => Controls_Manager::COLOR,
     244                'default'   => '#000',
     245                'condition' => [
     246                    'borderless_elementor_progress_bar_stroke_color_style' => 'borderless-elementor-progress-bar-stroke-gradient-color',
     247                ],
     248            ]
     249        );
     250
     251        $this->add_control(
     252            'borderless_elementor_progress_bar_trail_width',
     253            [
     254                'label'      => __( 'Trail Width', 'borderless' ),
     255                'type'       => Controls_Manager::SLIDER,
     256                'size_units' => [ 'px' ],
     257                'range'      => [
     258                    'px' => [
     259                        'min'  => 0,
     260                        'max'  => 100,
     261                        'step' => 1,
     262                    ],
     263                ],
     264                'default'    => [
     265                    'unit' => 'px',
     266                    'size' => 2,
     267                ],
     268                'separator'  => 'before',
     269            ]
     270        );
     271
     272        $this->add_control(
     273            'borderless_elementor_progress_bar_trail_color',
     274            [
     275                'label'   => __( 'Trail Color', 'borderless' ),
     276                'type'    => Controls_Manager::COLOR,
     277                'default' => '#eee',
     278            ]
     279        );
     280
     281        $this->add_control(
     282            'borderless_elementor_progress_bar_background_color',
     283            [
     284                'label'     => __( 'Background Color', 'borderless' ),
     285                'type'      => Controls_Manager::COLOR,
     286                'default'   => '#fff',
     287                'selectors' => [
     288                    '{{WRAPPER}} .borderless-elementor-progress-bar' => 'background-color: {{VALUE}}',
     289                ],
     290                'separator' => 'before',
     291            ]
     292        );
     293
     294        $this->add_group_control(
     295            Group_Control_Box_Shadow::get_type(),
     296            [
     297                'name'     => 'borderless_elementor_progress_bar_box_shadow',
     298                'label'    => __( 'Box Shadow', 'borderless' ),
     299                'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar',
     300                'separator'=> 'before',
     301            ]
     302        );
     303
     304        $this->end_controls_section();
     305
     306
     307        /*-----------------------------------------------------------------------------------*/
     308        /*  *.  Typography - Style
     309        /*-----------------------------------------------------------------------------------*/
     310        $this->start_controls_section(
     311            'borderless_section_circular_progress_bar_typography',
     312            [
     313                'label' => __( 'Typography', 'borderless' ),
     314                'tab'   => Controls_Manager::TAB_STYLE,
     315            ]
     316        );
     317
     318        $this->add_group_control(
     319            Group_Control_Typography::get_type(),
     320            [
     321                'name'    => 'borderless_elementor_progress_bar_title_typography',
     322                'label'   => __( 'Title', 'borderless' ),
     323                'global'  => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY ],
     324                'selector'=> '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-title',
     325            ]
     326        );
     327
     328        $this->add_control(
     329            'borderless_elementor_progress_bar_title_color',
     330            [
     331                'label'     => __( 'Title Color', 'borderless' ),
     332                'type'      => Controls_Manager::COLOR,
     333                'default'   => '',
     334                'selectors' => [
     335                    '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-title' => 'color: {{VALUE}}',
     336                ],
     337                'separator'=> 'after',
     338            ]
     339        );
     340
     341        $this->add_group_control(
     342            Group_Control_Typography::get_type(),
     343            [
     344                'name'     => 'borderless_elementor_progress_bar_counter_typography',
     345                'label'    => __( 'Counter', 'borderless' ),
     346                'global'   => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY ],
     347                'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-counter-value',
     348            ]
     349        );
     350
     351        $this->add_control(
     352            'borderless_elementor_progress_bar_counter_color',
     353            [
     354                'label'     => __( 'Counter Color', 'borderless' ),
     355                'type'      => Controls_Manager::COLOR,
     356                'default'   => '',
     357                'separator'=> 'after',
     358            ]
     359        );
     360
     361        $this->add_group_control(
     362            Group_Control_Typography::get_type(),
     363            [
     364                'name'     => 'borderless_elementor_progress_bar_postfix_typography',
     365                'label'    => __( 'Postfix', 'borderless' ),
     366                'global'   => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY ],
     367                'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-counter-postfix',
     368            ]
     369        );
     370
     371        $this->add_control(
     372            'borderless_elementor_progress_bar_postfix_color',
     373            [
     374                'label'     => __( 'Postfix Color', 'borderless' ),
     375                'type'      => Controls_Manager::COLOR,
     376                'default'   => '',
     377                'selectors' => [
     378                    '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-counter-postfix' => 'color: {{VALUE}}',
     379                ],
     380            ]
     381        );
     382
     383        $this->end_controls_section();
    402384    }
    403385
     
    405387    /*  *.  Render
    406388    /*-----------------------------------------------------------------------------------*/
    407 
    408389    protected function render() {
    409390        $settings = $this->get_settings_for_display();
    410    
    411         if ($settings['borderless_elementor_progress_bar_stroke_color_style'] == 'borderless-elementor-progress-bar-stroke-solid-color') {
    412             $borderless_elementor_progress_bar_stroke_color_style = 'stroke_color_mode="solid" stroke_color="' . esc_attr($settings['borderless_elementor_progress_bar_stroke_color']) . '"';
     391
     392        // Sanitize and escape the Title field to prevent stored XSS
     393        $raw_title   = $settings['borderless_elementor_progress_bar_title'];
     394        $clean_title = sanitize_text_field( $raw_title );
     395        $safe_title  = esc_js( $clean_title );
     396
     397        if ( 'borderless-elementor-progress-bar-stroke-solid-color' === $settings['borderless_elementor_progress_bar_stroke_color_style'] ) {
     398            $stroke_color_style = 'stroke_color_mode="solid" stroke_color="' . esc_attr( $settings['borderless_elementor_progress_bar_stroke_color'] ) . '"';
    413399        } else {
    414             $borderless_elementor_progress_bar_stroke_color_style = 'stroke_color_mode="gradient" stroke_color="' . esc_attr($settings['borderless_elementor_progress_bar_stroke_color']) . '" stroke_color_from="' . esc_attr($settings['borderless_elementor_progress_bar_stroke_color_from']) . '" stroke_color_to="' . esc_attr($settings['borderless_elementor_progress_bar_stroke_color_to']) . '"';
     400            $stroke_color_style = 'stroke_color_mode="gradient" '
     401                . 'stroke_color="'      . esc_attr( $settings['borderless_elementor_progress_bar_stroke_color'] )      . '" '
     402                . 'stroke_color_from="' . esc_attr( $settings['borderless_elementor_progress_bar_stroke_color_from'] ) . '" '
     403                . 'stroke_color_to="'   . esc_attr( $settings['borderless_elementor_progress_bar_stroke_color_to'] )   . '"';
    415404        }
    416    
    417         echo '<div class="borderless-elementor-progress-bar-widget ' . esc_attr($settings['borderless_elementor_progress_bar_alignment']) . '"><div class="borderless-elementor-progress-bar ' . esc_attr($settings['borderless_elementor_progress_bar_shape']) . '" title="' . esc_attr($settings['borderless_elementor_progress_bar_title']) . '" counter_value="' . esc_attr($settings['borderless_elementor_progress_bar_counter_value']['size']) . '" ' . $borderless_elementor_progress_bar_stroke_color_style . ' trail_color="' . esc_attr($settings['borderless_elementor_progress_bar_trail_color']) . '" counter_color="' . esc_attr($settings['borderless_elementor_progress_bar_counter_color']) . '" stroke_width="' . esc_attr($settings['borderless_elementor_progress_bar_stroke_width']['size']) . '" trail_width="' . esc_attr($settings['borderless_elementor_progress_bar_trail_width']['size']) . '" animation_duration="' . esc_attr($settings['borderless_elementor_progress_bar_animation_duration']['size']) . '"></div></div>';
    418     }
    419    
    420    
    421     protected function _content_template() {
    422 
    423     }
    424    
    425    
     405
     406        echo '<div class="borderless-elementor-progress-bar-widget ' . esc_attr( $settings['borderless_elementor_progress_bar_alignment'] ) . '">
     407            <div class="borderless-elementor-progress-bar ' . esc_attr( $settings['borderless_elementor_progress_bar_shape'] ) . '"
     408                title="' . $safe_title . '"
     409                counter_value="' . esc_attr( $settings['borderless_elementor_progress_bar_counter_value']['size'] ) . '"
     410                ' . $stroke_color_style . '
     411                trail_color="'      . esc_attr( $settings['borderless_elementor_progress_bar_trail_color'] )                . '"
     412                counter_color="'    . esc_attr( $settings['borderless_elementor_progress_bar_counter_color'] )             . '"
     413                stroke_width="'     . esc_attr( $settings['borderless_elementor_progress_bar_stroke_width']['size'] )      . '"
     414                trail_width="'      . esc_attr( $settings['borderless_elementor_progress_bar_trail_width']['size'] )       . '"
     415                animation_duration="' . esc_attr( $settings['borderless_elementor_progress_bar_animation_duration']['size'] ) . '">
     416            </div>
     417        </div>';
     418    }
     419   
     420    protected function _content_template() {}
    426421}
  • borderless/trunk/modules/elementor/widgets/semi-circular-progress-bar.php

    r3132733 r3302155  
    1919   
    2020    public function get_title() {
    21         return esc_html__( 'Semi Circular Progress Bar', 'borderless');
     21        return esc_html__( 'Semi Circular Progress Bar', 'borderless' );
    2222    }
    2323   
     
    3030    }
    3131
    32     public function get_keywords()
    33     {
     32    public function get_keywords() {
    3433        return [
    3534            'semi circular progress bar',
     
    3938            'borderless semi circular progress bar',
    4039            'borderless progress bar',
    41             'borderless bar'
     40            'borderless bar',
    4241        ];
    4342    }
    4443
    45     public function get_custom_help_url()
    46     {
     44    public function get_custom_help_url() {
    4745        return 'https://wpborderless.com/';
    4846    }
    4947
    5048    public function get_style_depends() {
    51         return
    52             [
    53                 'borderless-elementor-style'
    54             ];
     49        return [ 'borderless-elementor-style' ];
    5550    }
    5651   
    5752    public function get_script_depends() {
    58         return
    59             [
    60                 'borderless-elementor-appear-script',
    61                 'borderless-elementor-progressbar-script'
    62             ];
     53        return [
     54            'borderless-elementor-appear-script',
     55            'borderless-elementor-progressbar-script',
     56        ];
    6357    }
    6458   
    6559    protected function _register_controls() {
    66 
    67 
    68         /*-----------------------------------------------------------------------------------*/
    69         /*  *.  Layout
    70         /*-----------------------------------------------------------------------------------*/
    71 
     60        /* Layout */
    7261        $this->start_controls_section(
    7362            'borderless_elementor_section_semi_circular_progress_bar_layout',
    7463            [
    7564                'label' => esc_html__( 'Layout', 'borderless' ),
    76                 'tab' => Controls_Manager::TAB_CONTENT,
     65                'tab'   => Controls_Manager::TAB_CONTENT,
    7766            ]
    7867        );
     
    8170            'borderless_elementor_semi_circular_progress_bar_title',
    8271            [
    83                 'label' => esc_html__( 'Title', 'borderless'),
    84                 'type' => Controls_Manager::TEXT,
    85                 'dynamic' => [
    86                     'active' => true,
    87                 ],
     72                'label'   => esc_html__( 'Title', 'borderless' ),
     73                'type'    => Controls_Manager::TEXT,
     74                'dynamic' => [ 'active' => true ],
    8875            ]
    8976        );
     
    9279            'borderless_elementor_semi_circular_progress_bar_counter_value',
    9380            [
    94                 'label' => esc_html__( 'Counter Value', 'borderless'),
    95                 'type' => Controls_Manager::SLIDER,
    96                 'size_units' => ['%'],
    97                     'range' => [
    98                         '%' => [
     81                'label'      => esc_html__( 'Counter Value', 'borderless' ),
     82                'type'       => Controls_Manager::SLIDER,
     83                'size_units' => [ '%' ],
     84                'range'      => [
     85                    '%' => [
    9986                        'min' => 1,
    10087                        'max' => 100,
    10188                    ],
    10289                ],
    103                 'default' => [
     90                'default'    => [
    10491                    'unit' => '%',
    10592                    'size' => 50,
    10693                ],
    107                 'separator' => 'before',
     94                'separator'  => 'before',
    10895            ]
    10996        );
     
    11299            'borderless_elementor_semi_circular_progress_bar_animation_duration',
    113100            [
    114                 'label' => __('Animation Duration', 'borderless'),
    115                 'type' => Controls_Manager::SLIDER,
    116                 'size_units' => ['px'],
    117                 'range' => [
     101                'label'      => __( 'Animation Duration', 'borderless' ),
     102                'type'       => Controls_Manager::SLIDER,
     103                'size_units' => [ 'px' ],
     104                'range'      => [
    118105                    'px' => [
    119                         'min' => 1000,
    120                         'max' => 10000,
     106                        'min'  => 1000,
     107                        'max'  => 10000,
    121108                        'step' => 100,
    122109                    ],
    123110                ],
    124                 'default' => [
     111                'default'    => [
    125112                    'unit' => 'px',
    126113                    'size' => 1500,
    127114                ],
    128                 'separator' => 'before',
     115                'separator'  => 'before',
    129116            ]
    130117        );
     
    132119        $this->end_controls_section();
    133120
    134 
    135     /*-----------------------------------------------------------------------------------*/
    136     /*  *.  Layout - Style
    137     /*-----------------------------------------------------------------------------------*/
    138 
    139     $this->start_controls_section(
    140         'borderless_elementor_section_semi_circular_progress_bar_styles_general',
    141         [
    142             'label' => esc_html__( 'General', 'borderless'),
    143             'tab' => Controls_Manager::TAB_STYLE
    144         ]
    145     );
    146 
    147     $this->add_control(
    148         'borderless_elementor_semi_circular_progress_bar_alignment',
    149         [
    150             'label' => __('Alignment', 'borderless'),
    151             'type' => \Elementor\Controls_Manager::CHOOSE,
    152             'options' => [
    153                 'borderless-elementor-semi-circular-progress-bar-alignment-left' => [
    154                     'title' => __('Left', 'borderless'),
    155                     'icon' => 'fa fa-align-left',
    156                 ],
    157                 'borderless-elementor-semi-circular-progress-bar-alignment-center' => [
    158                     'title' => __('Center', 'borderless'),
    159                     'icon' => 'fa fa-align-center',
    160                 ],
    161                 'borderless-elementor-semi-circular-progress-bar-alignment-right' => [
    162                     'title' => __('Right', 'borderless'),
    163                     'icon' => 'fa fa-align-right',
    164                 ],
    165             ],
    166             'default' => 'borderless-elementor-semi-circular-progress-bar-alignment-center',
    167         ]
    168     );
    169 
    170     $this->add_control(
    171         'borderless_elementor_semi_circular_progress_bar_size',
    172         [
    173             'label' => __('Size', 'borderless'),
    174             'type' => Controls_Manager::SLIDER,
    175             'size_units' => ['px'],
    176             'range' => [
    177                 'px' => [
    178                     'min' => 50,
    179                     'max' => 500,
    180                     'step' => 1,
    181                 ],
    182             ],
    183             'default' => [
    184                 'unit' => 'px',
    185                 'size' => 200,
    186             ],
    187             'selectors' => [
    188                 '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar' => 'width: {{SIZE}}{{UNIT}}; height: calc({{SIZE}}{{UNIT}} / 2);',
    189             ],
    190             'separator' => 'before',
    191         ]
    192     );
    193 
    194     $this->add_control(
    195         'borderless_elementor_semi_circular_progress_bar_stroke_width',
    196         [
    197             'label' => __('Stroke Width', 'borderless'),
    198             'type' => Controls_Manager::SLIDER,
    199             'size_units' => ['px'],
    200             'range' => [
    201                 'px' => [
    202                     'min' => 0,
    203                     'max' => 100,
    204                     'step' => 1,
    205                 ],
    206             ],
    207             'default' => [
    208                 'unit' => 'px',
    209                 'size' => 12,
    210             ],
    211             'separator' => 'before',
    212         ]
    213     );
    214 
    215     $this->add_control(
    216         'borderless_elementor_semi_circular_progress_bar_stroke_color_style',
    217         [
    218             'label' => __( 'Stroke Color Style', 'borderless' ),
    219             'type' => \Elementor\Controls_Manager::SELECT,
    220             'default' => 'borderless-elementor-semi-circular-progress-bar-stroke-solid-color',
    221             'options' => [
    222                 'borderless-elementor-semi-circular-progress-bar-stroke-solid-color'  => __( 'Solid', 'borderless' ),
    223                 'borderless-elementor-semi-circular-progress-bar-stroke-gradient-color' => __( 'Gradient', 'borderless' ),
    224             ],
    225         ]
    226     );
    227 
    228     $this->add_control(
    229         'borderless_elementor_semi_circular_progress_bar_stroke_color',
    230         [
    231             'label' => __('Stroke Color', 'borderless'),
    232             'type' => Controls_Manager::COLOR,
    233             'default' => '#000',
    234             'condition' => [
    235                 'borderless_elementor_semi_circular_progress_bar_stroke_color_style' => 'borderless-elementor-semi-circular-progress-bar-stroke-solid-color',
    236             ],
    237         ]
    238     );
    239 
    240     $this->add_control(
    241         'borderless_elementor_semi_circular_progress_bar_stroke_color_from',
    242         [
    243             'label' => __('Stroke Color From', 'borderless'),
    244             'type' => Controls_Manager::COLOR,
    245             'default' => '#000',
    246             'condition' => [
    247                 'borderless_elementor_semi_circular_progress_bar_stroke_color_style' => 'borderless-elementor-semi-circular-progress-bar-stroke-gradient-color',
    248             ],
    249         ]
    250     );
    251 
    252     $this->add_control(
    253         'borderless_elementor_semi_circular_progress_bar_stroke_color_to',
    254         [
    255             'label' => __('Stroke Color To', 'borderless'),
    256             'type' => Controls_Manager::COLOR,
    257             'default' => '#000',
    258             'condition' => [
    259                 'borderless_elementor_semi_circular_progress_bar_stroke_color_style' => 'borderless-elementor-semi-circular-progress-bar-stroke-gradient-color',
    260             ],
    261         ]
    262     );
    263 
    264     $this->add_control(
    265         'borderless_elementor_semi_circular_progress_bar_trail_width',
    266         [
    267             'label' => __('Trail Width', 'borderless'),
    268             'type' => Controls_Manager::SLIDER,
    269             'size_units' => ['px'],
    270             'range' => [
    271                 'px' => [
    272                     'min' => 0,
    273                     'max' => 100,
    274                     'step' => 1,
    275                 ],
    276             ],
    277             'default' => [
    278                 'unit' => 'px',
    279                 'size' => 12,
    280             ],
    281             'separator' => 'before',
    282         ]
    283     );
    284 
    285     $this->add_control(
    286         'borderless_elementor_semi_circular_progress_bar_trail_color',
    287         [
    288             'label' => __('Trail Color', 'borderless'),
    289             'type' => Controls_Manager::COLOR,
    290             'default' => '#eee',
    291         ]
    292     ); 
    293 
    294     $this->add_control(
    295         'borderless_elementor_semi_circular_progress_bar_background_color',
    296         [
    297             'label' => __('Background Color', 'borderless'),
    298             'type' => Controls_Manager::COLOR,
    299             'default' => '#fff',
    300             'selectors' => [
    301                 '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar' => 'background-color: {{VALUE}}',
    302             ],
    303         ]
    304     );
    305 
    306     $this->end_controls_section();
    307 
    308     /*-----------------------------------------------------------------------------------*/
    309     /*  *.  Typography - Style
    310     /*-----------------------------------------------------------------------------------*/
    311 
    312     $this->start_controls_section(
    313         'borderless_section_circular_progress_bar_typography',
    314         [
    315             'label' => __('Typography', 'borderless'),
    316             'tab' => Controls_Manager::TAB_STYLE,
    317         ]
    318     );
    319 
    320     $this->add_group_control(
    321         Group_Control_Typography::get_type(),
    322         [
    323             'name' => 'borderless_elementor_semi_circular_progress_bar_title_typography',
    324             'label' => __('Title', 'borderless'),
    325             'global' => [
    326                 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
    327             ],
    328             'selector' => '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar .progressbar-text .borderless-elementor-semi-circular-progress-bar-title',
    329         ]
    330     );
    331 
    332     $this->add_control(
    333         'borderless_elementor_semi_circular_progress_bar_title_color',
    334         [
    335             'label' => __('Title Color', 'borderless'),
    336             'type' => Controls_Manager::COLOR,
    337             'default' => '',
    338             'selectors' => [
    339                 '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar .progressbar-text .borderless-elementor-semi-circular-progress-bar-title' => 'color: {{VALUE}}',
    340             ],
    341             'separator' => 'after',
    342         ]
    343     );
    344 
    345     $this->add_group_control(
    346         Group_Control_Typography::get_type(),
    347         [
    348             'name' => 'borderless_elementor_semi_circular_progress_bar_counter_typography',
    349             'label' => __('Counter', 'borderless'),
    350             'global' => [
    351                 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
    352             ],
    353             'selector' => '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar .progressbar-text .borderless-elementor-semi-circular-progress-bar-counter-value',
    354         ]
    355     );
    356 
    357     $this->add_control(
    358         'borderless_elementor_semi_circular_progress_bar_counter_color',
    359         [
    360             'label' => __('Counter Color', 'borderless'),
    361             'type' => Controls_Manager::COLOR,
    362             'default' => '',
    363             'separator' => 'after',
    364         ]
    365     );
    366 
    367     $this->add_group_control(
    368         Group_Control_Typography::get_type(),
    369         [
    370             'name' => 'borderless_elementor_semi_circular_progress_bar_postfix_typography',
    371             'label' => __('Postfix', 'borderless'),
    372             'global' => [
    373                 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
    374             ],
    375             'selector' => '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar-counter-postfix',
    376         ]
    377     );
    378 
    379     $this->add_control(
    380         'borderless_elementor_semi_circular_progress_bar_postfix_color',
    381         [
    382             'label' => __('Postfix Color', 'borderless'),
    383             'type' => Controls_Manager::COLOR,
    384             'default' => '',
    385             'selectors' => [
    386                 '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar-counter-postfix' => 'color: {{VALUE}}',
    387             ],
    388         ]
    389     );
    390 
    391     $this->end_controls_section();
    392 
    393     }
    394 
    395     /*-----------------------------------------------------------------------------------*/
    396     /*  *.  Render
    397     /*-----------------------------------------------------------------------------------*/
    398    
     121        /* Layout — Style */
     122        $this->start_controls_section(
     123            'borderless_elementor_section_semi_circular_progress_bar_styles_general',
     124            [
     125                'label' => esc_html__( 'General', 'borderless' ),
     126                'tab'   => Controls_Manager::TAB_STYLE,
     127            ]
     128        );
     129
     130        $this->add_control(
     131            'borderless_elementor_semi_circular_progress_bar_alignment',
     132            [
     133                'label'   => __( 'Alignment', 'borderless' ),
     134                'type'    => Controls_Manager::CHOOSE,
     135                'options' => [
     136                    'borderless-elementor-semi-circular-progress-bar-alignment-left'   => [
     137                        'title' => __( 'Left', 'borderless' ),
     138                        'icon'  => 'fa fa-align-left',
     139                    ],
     140                    'borderless-elementor-semi-circular-progress-bar-alignment-center' => [
     141                        'title' => __( 'Center', 'borderless' ),
     142                        'icon'  => 'fa fa-align-center',
     143                    ],
     144                    'borderless-elementor-semi-circular-progress-bar-alignment-right'  => [
     145                        'title' => __( 'Right', 'borderless' ),
     146                        'icon'  => 'fa fa-align-right',
     147                    ],
     148                ],
     149                'default' => 'borderless-elementor-semi-circular-progress-bar-alignment-center',
     150            ]
     151        );
     152
     153        $this->add_control(
     154            'borderless_elementor_semi_circular_progress_bar_size',
     155            [
     156                'label'      => __( 'Size', 'borderless' ),
     157                'type'       => Controls_Manager::SLIDER,
     158                'size_units' => [ 'px' ],
     159                'range'      => [
     160                    'px' => [
     161                        'min'  => 50,
     162                        'max'  => 500,
     163                        'step' => 1,
     164                    ],
     165                ],
     166                'default'    => [
     167                    'unit' => 'px',
     168                    'size' => 200,
     169                ],
     170                'selectors'  => [
     171                    '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar' => 'width: {{SIZE}}{{UNIT}}; height: calc({{SIZE}}{{UNIT}} / 2);',
     172                ],
     173                'separator'  => 'before',
     174            ]
     175        );
     176
     177        $this->add_control(
     178            'borderless_elementor_semi_circular_progress_bar_stroke_width',
     179            [
     180                'label'      => __( 'Stroke Width', 'borderless' ),
     181                'type'       => Controls_Manager::SLIDER,
     182                'size_units' => [ 'px' ],
     183                'range'      => [
     184                    'px' => [
     185                        'min'  => 0,
     186                        'max'  => 100,
     187                        'step' => 1,
     188                    ],
     189                ],
     190                'default'    => [
     191                    'unit' => 'px',
     192                    'size' => 12,
     193                ],
     194                'separator'  => 'before',
     195            ]
     196        );
     197
     198        $this->add_control(
     199            'borderless_elementor_semi_circular_progress_bar_stroke_color_style',
     200            [
     201                'label'   => __( 'Stroke Color Style', 'borderless' ),
     202                'type'    => Controls_Manager::SELECT,
     203                'default' => 'borderless-elementor-semi-circular-progress-bar-stroke-solid-color',
     204                'options' => [
     205                    'borderless-elementor-semi-circular-progress-bar-stroke-solid-color'    => __( 'Solid',    'borderless' ),
     206                    'borderless-elementor-semi-circular-progress-bar-stroke-gradient-color' => __( 'Gradient', 'borderless' ),
     207                ],
     208            ]
     209        );
     210
     211        $this->add_control(
     212            'borderless_elementor_semi_circular_progress_bar_stroke_color',
     213            [
     214                'label'     => __( 'Stroke Color', 'borderless' ),
     215                'type'      => Controls_Manager::COLOR,
     216                'default'   => '#000',
     217                'condition' => [
     218                    'borderless_elementor_semi_circular_progress_bar_stroke_color_style' => 'borderless-elementor-semi-circular-progress-bar-stroke-solid-color',
     219                ],
     220            ]
     221        );
     222
     223        $this->add_control(
     224            'borderless_elementor_semi_circular_progress_bar_stroke_color_from',
     225            [
     226                'label'     => __( 'Stroke Color From', 'borderless' ),
     227                'type'      => Controls_Manager::COLOR,
     228                'default'   => '#000',
     229                'condition' => [
     230                    'borderless_elementor_semi_circular_progress_bar_stroke_color_style' => 'borderless-elementor-semi-circular-progress-bar-stroke-gradient-color',
     231                ],
     232            ]
     233        );
     234
     235        $this->add_control(
     236            'borderless_elementor_semi_circular_progress_bar_stroke_color_to',
     237            [
     238                'label'     => __( 'Stroke Color To', 'borderless' ),
     239                'type'      => Controls_Manager::COLOR,
     240                'default'   => '#000',
     241                'condition' => [
     242                    'borderless_elementor_semi_circular_progress_bar_stroke_color_style' => 'borderless-elementor-semi-circular-progress-bar-stroke-gradient-color',
     243                ],
     244            ]
     245        );
     246
     247        $this->add_control(
     248            'borderless_elementor_semi_circular_progress_bar_trail_width',
     249            [
     250                'label'      => __( 'Trail Width', 'borderless' ),
     251                'type'       => Controls_Manager::SLIDER,
     252                'size_units' => [ 'px' ],
     253                'range'      => [
     254                    'px' => [
     255                        'min'  => 0,
     256                        'max'  => 100,
     257                        'step' => 1,
     258                    ],
     259                ],
     260                'default'    => [
     261                    'unit' => 'px',
     262                    'size' => 12,
     263                ],
     264                'separator'  => 'before',
     265            ]
     266        );
     267
     268        $this->add_control(
     269            'borderless_elementor_semi_circular_progress_bar_trail_color',
     270            [
     271                'label'   => __( 'Trail Color', 'borderless' ),
     272                'type'    => Controls_Manager::COLOR,
     273                'default' => '#eee',
     274            ]
     275        );
     276
     277        $this->add_control(
     278            'borderless_elementor_semi_circular_progress_bar_background_color',
     279            [
     280                'label'     => __( 'Background Color', 'borderless' ),
     281                'type'      => Controls_Manager::COLOR,
     282                'default'   => '#fff',
     283                'selectors' => [
     284                    '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar' => 'background-color: {{VALUE}}',
     285                ],
     286            ]
     287        );
     288
     289        $this->end_controls_section();
     290
     291        /* Typography — Style */
     292        $this->start_controls_section(
     293            'borderless_section_circular_progress_bar_typography',
     294            [
     295                'label' => __( 'Typography', 'borderless' ),
     296                'tab'   => Controls_Manager::TAB_STYLE,
     297            ]
     298        );
     299
     300        $this->add_group_control(
     301            Group_Control_Typography::get_type(),
     302            [
     303                'name'    => 'borderless_elementor_semi_circular_progress_bar_title_typography',
     304                'label'   => __( 'Title', 'borderless' ),
     305                'global'  => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY ],
     306                'selector'=> '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar .progressbar-text .borderless-elementor-semi-circular-progress-bar-title',
     307            ]
     308        );
     309
     310        $this->add_control(
     311            'borderless_elementor_semi_circular_progress_bar_title_color',
     312            [
     313                'label'     => __( 'Title Color', 'borderless' ),
     314                'type'      => Controls_Manager::COLOR,
     315                'default'   => '',
     316                'selectors' => [
     317                    '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar .progressbar-text .borderless-elementor-semi-circular-progress-bar-title' => 'color: {{VALUE}}',
     318                ],
     319                'separator'=> 'after',
     320            ]
     321        );
     322
     323        $this->add_group_control(
     324            Group_Control_Typography::get_type(),
     325            [
     326                'name'     => 'borderless_elementor_semi_circular_progress_bar_counter_typography',
     327                'label'    => __( 'Counter', 'borderless' ),
     328                'global'   => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY ],
     329                'selector' => '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar .progressbar-text .borderless-elementor-semi-circular-progress-bar-counter-value',
     330            ]
     331        );
     332
     333        $this->add_control(
     334            'borderless_elementor_semi_circular_progress_bar_counter_color',
     335            [
     336                'label'     => __( 'Counter Color', 'borderless' ),
     337                'type'      => Controls_Manager::COLOR,
     338                'default'   => '',
     339                'separator'=> 'after',
     340            ]
     341        );
     342
     343        $this->add_group_control(
     344            Group_Control_Typography::get_type(),
     345            [
     346                'name'     => 'borderless_elementor_semi_circular_progress_bar_postfix_typography',
     347                'label'    => __( 'Postfix', 'borderless' ),
     348                'global'   => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY ],
     349                'selector' => '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar-counter-postfix',
     350            ]
     351        );
     352
     353        $this->add_control(
     354            'borderless_elementor_semi_circular_progress_bar_postfix_color',
     355            [
     356                'label'     => __( 'Postfix Color', 'borderless' ),
     357                'type'      => Controls_Manager::COLOR,
     358                'default'   => '',
     359                'selectors' => [
     360                    '{{WRAPPER}} .borderless-elementor-semi-circular-progress-bar-counter-postfix' => 'color: {{VALUE}}',
     361                ],
     362            ]
     363        );
     364
     365        $this->end_controls_section();
     366    }
     367
     368    /* Render */
    399369    protected function render() {
    400370        $settings = $this->get_settings_for_display();
    401    
    402         // Aplicar escaping aos estilos de cores da barra de progresso
    403         if ($settings['borderless_elementor_semi_circular_progress_bar_stroke_color_style'] == 'borderless-elementor-semi-circular-progress-bar-stroke-solid-color') {
    404             $borderless_elementor_semi_circular_progress_bar_stroke_color_style = 'stroke_color_mode="solid" stroke_color="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_stroke_color']) . '"';
     371
     372        // Sanitize & escape Title to prevent stored XSS
     373        $raw_title   = $settings['borderless_elementor_semi_circular_progress_bar_title'];
     374        $clean_title = sanitize_text_field( $raw_title );
     375        $safe_title  = esc_js( $clean_title );
     376
     377        // Stroke color style
     378        if ( 'borderless-elementor-semi-circular-progress-bar-stroke-solid-color' === $settings['borderless_elementor_semi_circular_progress_bar_stroke_color_style'] ) {
     379            $stroke_color_style = 'stroke_color_mode="solid" stroke_color="' . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_stroke_color'] ) . '"';
    405380        } else {
    406             $borderless_elementor_semi_circular_progress_bar_stroke_color_style = 'stroke_color_mode="gradient" stroke_color="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_stroke_color']) . '" stroke_color_from="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_stroke_color_from']) . '" stroke_color_to="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_stroke_color_to']) . '"';
     381            $stroke_color_style = 'stroke_color_mode="gradient" '
     382                . 'stroke_color="'      . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_stroke_color'] )      . '" '
     383                . 'stroke_color_from="' . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_stroke_color_from'] ) . '" '
     384                . 'stroke_color_to="'   . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_stroke_color_to'] )   . '"';
    407385        }
    408    
    409         // Construção do HTML do widget com valores escapados
    410         echo '<div class="borderless-elementor-semi-circular-progress-bar-widget ' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_alignment']) . '"><div class="borderless-elementor-semi-circular-progress-bar" title="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_title']) . '" counter_value="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_counter_value']['size']) . '" ' . $borderless_elementor_semi_circular_progress_bar_stroke_color_style . ' trail_color="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_trail_color']) . '" counter_color="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_counter_color']) . '" stroke_width="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_stroke_width']['size']) . '" trail_width="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_trail_width']['size']) . '" animation_duration="' . esc_attr($settings['borderless_elementor_semi_circular_progress_bar_animation_duration']['size']) . '"></div></div>';
    411     }
    412    
    413    
    414     protected function _content_template() {
    415 
    416     }
    417    
    418    
     386
     387        echo '<div class="borderless-elementor-semi-circular-progress-bar-widget ' . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_alignment'] ) . '">
     388            <div class="borderless-elementor-semi-circular-progress-bar"
     389                 title="'             . $safe_title                                                                    . '"
     390                 counter_value="'    . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_counter_value']['size'] )         . '"
     391                 '                  . $stroke_color_style                                                                    . '
     392                 trail_color="'      . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_trail_color'] )             . '"
     393                 counter_color="'    . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_counter_color'] )            . '"
     394                 stroke_width="'     . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_stroke_width']['size'] )    . '"
     395                 trail_width="'      . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_trail_width']['size'] )     . '"
     396                 animation_duration="' . esc_attr( $settings['borderless_elementor_semi_circular_progress_bar_animation_duration']['size'] ) . '">
     397            </div>
     398        </div>';
     399    }
     400
     401    protected function _content_template() {}
    419402}
  • borderless/trunk/readme.txt

    r3267283 r3302155  
    55Tested up to: 6.7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.7.1
     7Stable tag: 1.7.2
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    8282== Changelog ==
    8383
     84= 1.7.2 - May 28 2025 =
     85* Fixed - Progress Bar Vulnerability.
     86* Fixed - Circular Progress Bar Vulnerability.
     87* Fixed - Semicircular Progress Bar Vulnerability.
     88
    8489= 1.7.1 - Apr 05 2025 =
    8590* Improvements - Elementor Widget - Info Box.
Note: See TracChangeset for help on using the changeset viewer.