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 / semi-circular-progress-bar.php

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

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