PluginProbe
Borderless – Addons and Templates for Elementor / 1.1.0
Borderless – Addons and Templates for Elementor v1.1.0
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 1.1.0, at modules/wpbakery/elements/circular-progress-bar.php

229 lines 7.7 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' => '',
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
35 // Retrieve data from the database.
36 $options = get_option( 'borderless' );
37
38
39 // Set default value.
40 $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color
41 $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color
42 $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color
43 $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color
44
45
46 // Default Extra Class, CSS and CSS animation
47 $css = isset( $atts['css'] ) ? $atts['css'] : '';
48 $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : '';
49 $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
50 if ( '' !== $css_animation ) {
51 wp_enqueue_script( 'waypoints' );
52 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation;
53 }
54 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
55 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
56
57
58 // Set custom values
59 $title_color = $title_color ? 'style=color:'.$title_color.'' : 'style=color:'.$borderless_primary_color.'';
60 $percentage_color = $ip_color;
61 $ip_color = $ip_color ? 'style=color:'.$ip_color.'' : 'style=color:'.$borderless_primary_color.'';
62 $bar_color = $bar_color ? $bar_color : $borderless_primary_color;
63 $track_color = $track_color ? $track_color : '#f9f9f9';
64
65
66 // Output
67 if ($style=="icon") { $icon = '<i '.$ip_color.' class="borderless-wpbakery-circular-progress-bar-icon '.$icon.'""></i>'; } else { $icon = ""; }
68 $output .= '<div '.$el_id.' class="borderless-wpbakery-circular-progress-bar '.$css_class.'">';
69 $output .= '<div class="borderless-wpbakery-circular-progress-bar-inner">';
70 $output .= '<div class="borderless-wpbakery-circular-progress-bar-params '.$corner.' '.$style.'" percentage="'.$percentage.'" bar_color="'.$bar_color.'" track_color="'.$track_color.'" percentage_color="'.$percentage_color.'" bar_thickness="'.$bar_thickness.'" track_thickness="'.$track_thickness.'"></div>';
71 $output .= $icon;
72 $output .= '<span '.$title_color.' class="borderless-wpbakery-circular-progress-bar-title">'.$title.'</span>';
73 $output .= '</div></div>';
74
75 return $output;
76 }
77 }
78
79 return array(
80 'name' => __( 'Circular Progress Bar', 'borderless' ),
81 'base' => 'borderless_wpbakery_circular_progress_bar',
82 'icon' => plugins_url('../images/circular-progress-bar.png', __FILE__),
83 'show_settings_on_create' => true,
84 'category' => __( 'Borderless', 'borderless' ),
85 'description' => __( 'Animated progress bar', 'borderless' ),
86 'params' => array(
87
88 array(
89 'type' => 'textfield',
90 'heading' => __( 'Title', 'borderless' ),
91 'param_name' => 'title',
92 'description' => __( 'Enter the Progress Bar title here.', 'borderless' ),
93 ),
94
95 array(
96 'type' => 'dropdown',
97 'heading' => __( 'Style', 'borderless' ),
98 'param_name' => 'style',
99 'value' => array(
100 __( 'Percentage', 'borderless' ) => 'percentage',
101 __( 'Icon', 'borderless' ) => 'icon',
102 ),
103 'description' => __( 'Choose a style.', 'borderless' ),
104 ),
105
106 array(
107 'type' => 'textfield',
108 'heading' => __( 'Progress in %', 'borderless' ),
109 'param_name' => 'percentage',
110 'description' => __( 'Enter a number between 0 and 100', 'borderless' ),
111 ),
112
113 array(
114 'type' => 'iconmanager',
115 'heading' => __( 'Icon', 'borderless' ),
116 'param_name' => 'icon',
117 'description' => __( 'Select icon from library.', 'borderless' ),
118 'dependency' => array(
119 'element' => 'style',
120 'value' => 'icon'
121 ),
122 ),
123
124 array(
125 'type' => 'textfield',
126 'heading' => __( 'Bar Thickness', 'borderless' ),
127 'param_name' => 'bar_thickness',
128 'description' => __( 'Enter a value for height. Ex: 16px.', 'borderless' ),
129 ),
130
131 array(
132 'type' => 'textfield',
133 'heading' => __( 'Track Thickness', 'borderless' ),
134 'param_name' => 'track_thickness',
135 'description' => __( 'Enter a value for height. Ex: 16px.', 'borderless' ),
136 ),
137
138 array(
139 'type' => 'dropdown',
140 'heading' => __( 'Corner Style', 'borderless' ),
141 'description' => __( 'Select style.', 'borderless' ),
142 'param_name' => 'corner',
143 'value' => array(
144 __( 'Square', 'borderless' ) => 'butt',
145 __( 'Round', 'borderless' ) => 'round',
146 ),
147 ),
148
149 array(
150 'type' => 'dropdown',
151 'heading' => __( 'Colors', 'borderless' ),
152 'param_name' => 'colors',
153 'value' => array(
154 __( 'Preset Color', 'borderless' ) => '',
155 __( 'Custom Color', 'borderless' ) => 'custom',
156 ),
157 'description' => __( 'Choose a color for your progress bar here.', 'borderless' ),
158 ),
159
160 array(
161 'type' => 'colorpicker',
162 'heading' => __( 'Title Color', 'borderless' ),
163 'param_name' => 'title_color',
164 'description' => __( 'Select custom color for the title.', 'borderless' ),
165 'dependency' => array(
166 'element' => 'colors',
167 'value' => array( 'custom' ),
168 ),
169 ),
170
171 array(
172 'type' => 'colorpicker',
173 'heading' => __( 'Percentage and Icon Color', 'borderless' ),
174 'param_name' => 'ip_color',
175 'description' => __( 'Select custom color for the percentage or icon.', 'borderless' ),
176 'dependency' => array(
177 'element' => 'colors',
178 'value' => array( 'custom' ),
179 ),
180 ),
181
182 array(
183 'type' => 'colorpicker',
184 'heading' => __( 'Bar Color', 'borderless' ),
185 'param_name' => 'bar_color',
186 'description' => __( 'Select custom color for the bar.', 'borderless' ),
187 'dependency' => array(
188 'element' => 'colors',
189 'value' => array( 'custom' ),
190 ),
191 ),
192
193 array(
194 'type' => 'colorpicker',
195 'heading' => __( 'Track Color', 'borderless' ),
196 'param_name' => 'track_color',
197 'description' => __( 'Select custom color for the track.', 'borderless' ),
198 'dependency' => array(
199 'element' => 'colors',
200 'value' => array( 'custom' ),
201 ),
202 ),
203
204 // Animation
205 vc_map_add_css_animation(),
206
207 array(
208 'type' => 'el_id',
209 'heading' => __( 'Element ID', 'borderless' ),
210 'param_name' => 'el_id',
211 '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>' ),
212 ),
213
214 array(
215 'type' => 'textfield',
216 'heading' => __( 'Extra class name', 'borderless' ),
217 'param_name' => 'el_class',
218 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
219 ),
220
221 array(
222 'type' => 'css_editor',
223 'heading' => __( 'CSS box', 'borderless' ),
224 'param_name' => 'css',
225 'group' => __( 'Design Options', 'borderless' ),
226 ),
227 ),
228 );
229