PluginProbe
Borderless – Addons and Templates for Elementor / trunk
Borderless – Addons and Templates for Elementor vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 78 releases
borderless / modules / wpbakery / elements / circular-progress-bar.php

circular-progress-bar.php in Borderless – Addons and Templates for Elementor trunk, at modules/wpbakery/elements/circular-progress-bar.php

255 lines 8.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( '-1' );
4 }
5
6 /*-----------------------------------------------------------------------------------*/
7 /* Circular Progress Bar
8 /*-----------------------------------------------------------------------------------*/
9
10 class WPBakeryShortCode_borderless_wpbakery_circular_progress_bar extends WPBakeryShortCode {
11 protected function content( $atts, $content = null ) {
12 extract( shortcode_atts( array(
13 'title' => '',
14 'percentage' => '50',
15 'bar_thickness' => '16',
16 'track_thickness' => '16',
17 'corner' => 'butt',
18 'colors' => '',
19 'title_color' => '',
20 'ip_color' => '',
21 'bar_color' => '',
22 'track_color' => '',
23 'style' => 'percentage',
24 'icon' => '',
25 //Static
26 'el_id' => '',
27 'el_class' => '',
28 'css' => '',
29 'css_animation' => ''
30 ), $atts ) );
31 $output = '';
32 $borderless_global_color = 'borderless-global-color'; //General Color
33
34 // Assets.
35 wp_enqueue_style(
36 'borderless-wpbakery-style',
37 BORDERLESS__STYLES . 'wpbakery.min.css',
38 false,
39 BORDERLESS__VERSION
40 );
41 wp_enqueue_script(
42 'borderless-wpbakery-appear-script',
43 BORDERLESS__LIB . 'appear.js', array('jquery'),
44 '1.0.0',
45 true
46 );
47 wp_enqueue_script(
48 'borderless-wpbakery-progressbar-script',
49 BORDERLESS__LIB . 'progressbar.js', array('jquery'),
50 '1.1.0',
51 true
52 );
53 wp_enqueue_script(
54 'borderless-wpbakery-script',
55 BORDERLESS__SCRIPTS . 'borderless-wpbakery.min.js', array('jquery'),
56 BORDERLESS__VERSION,
57 true
58 );
59
60
61 // Retrieve data from the database.
62 $options = get_option( 'borderless' );
63
64
65 // Set default value.
66 $borderless_primary_color = isset( $options['primary_color'] ) ? esc_attr( $options['primary_color'] ) : '#3379fc'; //Primary Color
67 $borderless_secondary_color = isset( $options['secondary_color'] ) ? esc_attr( $options['secondary_color'] ) : '#3379fc'; //Secondary Color
68 $borderless_text_color = isset( $options['text_color'] ) ? esc_attr( $options['text_color'] ) : ''; //Text Color
69 $borderless_accent_color = isset( $options['accent_color'] ) ? esc_attr( $options['accent_color'] ) : '#3379fc'; //Accent Color
70
71
72 // Default Extra Class, CSS and CSS animation
73 $css = isset( $atts['css'] ) ? esc_attr( $atts['css'] ) : '';
74 $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $atts['el_id'] ) . '"' : '';
75 $el_class = isset( $atts['el_class'] ) ? esc_attr( $atts['el_class'] ) : '';
76 if ( '' !== $css_animation ) {
77 wp_enqueue_script( 'waypoints' );
78 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . esc_attr( $css_animation );
79 }
80 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
81 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
82
83
84 // Set custom values
85 $title_color = $title_color ? 'style=color:' . esc_attr( $title_color ) . '' : 'style=color:' . esc_attr( $borderless_primary_color ) . '';
86 $percentage_color = esc_attr( $ip_color );
87 $ip_color = $ip_color ? 'style=color:' . esc_attr( $ip_color ) . '' : 'style=color:' . esc_attr( $borderless_primary_color ) . '';
88 $bar_color = esc_attr( $bar_color ? $bar_color : $borderless_primary_color );
89 $track_color = esc_attr( $track_color ? $track_color : '#f9f9f9' );
90
91
92 // Output
93 if ($style=="icon") { $icon = '<i '.$ip_color.' class="borderless-wpbakery-circular-progress-bar-icon '.esc_attr( $icon ).'""></i>'; } else { $icon = ""; }
94 $output .= '<div '.$el_id.' class="borderless-wpbakery-circular-progress-bar '.esc_attr( $css_class ).'">';
95 $output .= '<div class="borderless-wpbakery-circular-progress-bar-inner">';
96 $output .= '<div class="borderless-wpbakery-circular-progress-bar-params '.esc_attr( $corner ).' '.esc_attr( $style ).'" percentage="'.esc_attr( $percentage ).'" bar_color="'.esc_attr( $bar_color ).'" track_color="'.esc_attr( $track_color ).'" percentage_color="'.esc_attr( $percentage_color ).'" bar_thickness="'.esc_attr( $bar_thickness ).'" track_thickness="'.esc_attr( $track_thickness ).'"></div>';
97 $output .= $icon;
98 $output .= '<span '.$title_color.' class="borderless-wpbakery-circular-progress-bar-title">'.esc_html( $title ).'</span>';
99 $output .= '</div></div>';
100
101 return $output;
102 }
103 }
104
105 return array(
106 'name' => __( 'Circular Progress Bar', 'borderless' ),
107 'base' => 'borderless_wpbakery_circular_progress_bar',
108 'icon' => plugins_url('../images/circular-progress-bar.png', __FILE__),
109 'show_settings_on_create' => true,
110 'category' => __( 'Borderless', 'borderless' ),
111 'description' => __( 'Animated progress bar', 'borderless' ),
112 'params' => array(
113
114 array(
115 'type' => 'textfield',
116 'heading' => __( 'Title', 'borderless' ),
117 'param_name' => 'title',
118 'description' => __( 'Enter the Progress Bar title here.', 'borderless' ),
119 ),
120
121 array(
122 'type' => 'dropdown',
123 'heading' => __( 'Style', 'borderless' ),
124 'param_name' => 'style',
125 'value' => array(
126 __( 'Percentage', 'borderless' ) => 'percentage',
127 __( 'Icon', 'borderless' ) => 'icon',
128 ),
129 'description' => __( 'Choose a style.', 'borderless' ),
130 ),
131
132 array(
133 'type' => 'textfield',
134 'heading' => __( 'Progress in %', 'borderless' ),
135 'param_name' => 'percentage',
136 'description' => __( 'Enter a number between 0 and 100', 'borderless' ),
137 ),
138
139 array(
140 'type' => 'iconmanager',
141 'heading' => __( 'Icon', 'borderless' ),
142 'param_name' => 'icon',
143 'description' => __( 'Select icon from library.', 'borderless' ),
144 'dependency' => array(
145 'element' => 'style',
146 'value' => 'icon'
147 ),
148 ),
149
150 array(
151 'type' => 'textfield',
152 'heading' => __( 'Bar Thickness', 'borderless' ),
153 'param_name' => 'bar_thickness',
154 'description' => __( 'Enter a value for height. Ex: 16.', 'borderless' ),
155 ),
156
157 array(
158 'type' => 'textfield',
159 'heading' => __( 'Track Thickness', 'borderless' ),
160 'param_name' => 'track_thickness',
161 'description' => __( 'Enter a value for height. Ex: 16.', 'borderless' ),
162 ),
163
164 array(
165 'type' => 'dropdown',
166 'heading' => __( 'Corner Style', 'borderless' ),
167 'description' => __( 'Select style.', 'borderless' ),
168 'param_name' => 'corner',
169 'value' => array(
170 __( 'Square', 'borderless' ) => 'butt',
171 __( 'Round', 'borderless' ) => 'round',
172 ),
173 ),
174
175 array(
176 'type' => 'dropdown',
177 'heading' => __( 'Colors', 'borderless' ),
178 'param_name' => 'colors',
179 'value' => array(
180 __( 'Preset Color', 'borderless' ) => '',
181 __( 'Custom Color', 'borderless' ) => 'custom',
182 ),
183 'description' => __( 'Choose a color for your progress bar here.', 'borderless' ),
184 ),
185
186 array(
187 'type' => 'colorpicker',
188 'heading' => __( 'Title Color', 'borderless' ),
189 'param_name' => 'title_color',
190 'description' => __( 'Select custom color for the title.', 'borderless' ),
191 'dependency' => array(
192 'element' => 'colors',
193 'value' => array( 'custom' ),
194 ),
195 ),
196
197 array(
198 'type' => 'colorpicker',
199 'heading' => __( 'Percentage and Icon Color', 'borderless' ),
200 'param_name' => 'ip_color',
201 'description' => __( 'Select custom color for the percentage or icon.', 'borderless' ),
202 'dependency' => array(
203 'element' => 'colors',
204 'value' => array( 'custom' ),
205 ),
206 ),
207
208 array(
209 'type' => 'colorpicker',
210 'heading' => __( 'Bar Color', 'borderless' ),
211 'param_name' => 'bar_color',
212 'description' => __( 'Select custom color for the bar.', 'borderless' ),
213 'dependency' => array(
214 'element' => 'colors',
215 'value' => array( 'custom' ),
216 ),
217 ),
218
219 array(
220 'type' => 'colorpicker',
221 'heading' => __( 'Track Color', 'borderless' ),
222 'param_name' => 'track_color',
223 'description' => __( 'Select custom color for the track.', 'borderless' ),
224 'dependency' => array(
225 'element' => 'colors',
226 'value' => array( 'custom' ),
227 ),
228 ),
229
230 // Animation
231 vc_map_add_css_animation(),
232
233 array(
234 'type' => 'el_id',
235 'heading' => __( 'Element ID', 'borderless' ),
236 'param_name' => 'el_id',
237 'description' => sprintf( __( 'Enter element ID (Note: make sure it is unique and valid according to %sw3c specification%s).', 'borderless' ), '<a href="https://www.w3schools.com/tags/att_global_id.asp" target="_blank">', '</a>' ),
238 ),
239
240 array(
241 'type' => 'textfield',
242 'heading' => __( 'Extra class name', 'borderless' ),
243 'param_name' => 'el_class',
244 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
245 ),
246
247 array(
248 'type' => 'css_editor',
249 'heading' => __( 'CSS box', 'borderless' ),
250 'param_name' => 'css',
251 'group' => __( 'Design Options', 'borderless' ),
252 ),
253 ),
254 );
255