PluginProbe
Borderless – Addons and Templates for Elementor / 1.3.6
Borderless – Addons and Templates for Elementor v1.3.6
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 / counter.php

counter.php in Borderless – Addons and Templates for Elementor 1.3.6, at modules/wpbakery/elements/counter.php

293 lines 9.1 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 /* Counter
8 /*-----------------------------------------------------------------------------------*/
9
10 class WPBakeryShortCode_borderless_wpbakery_counter extends WPBakeryShortCode {
11 protected function content( $atts, $content = null ) {
12 extract( shortcode_atts( array(
13 'title' => '',
14 'value' => '999',
15 'value_speed' => '2000',
16 'value_interval' => '1',
17 'checkicon' => '',
18 'icon' => '',
19 'title_tag' => 'h3',
20 'title_size' => '1.3rem',
21 'title_line_height' => '1em',
22 'title_color' => '',
23 'counter_size' => '4rem',
24 'counter_line_height' => '1em',
25 'counter_color' => '#818b92',
26 'icon_size' => '4rem',
27 'icon_line_height' => '2em',
28 'icon_color' => '',
29 //Static
30 'el_id' => '',
31 'el_class' => '',
32 'css' => '',
33 'css_animation' => ''
34 ), $atts ) );
35 $output = '';
36
37 // Assets.
38 wp_enqueue_style(
39 'borderless-wpbakery-style',
40 BORDERLESS__STYLES . 'wpbakery.min.css',
41 false,
42 BORDERLESS__VERSION
43 );
44 wp_enqueue_script(
45 'borderless-appear-script',
46 BORDERLESS__LIB . 'appear.js', array('jquery'),
47 '1.0.0',
48 true
49 );
50 wp_enqueue_script(
51 'borderless-countto-script',
52 BORDERLESS__LIB . 'countto.js', array('jquery'),
53 '1.2.0',
54 true
55 );
56 wp_enqueue_script(
57 'borderless-wpbakery-script',
58 BORDERLESS__SCRIPTS . 'borderless-wpbakery.min.js', array('jquery'),
59 BORDERLESS__VERSION,
60 true
61 );
62
63
64 // Retrieve data from the database.
65 $options = get_option( 'borderless' );
66
67
68 // Set default values
69 $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color
70 $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color
71 $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color
72 $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color
73
74
75 // Default Extra Class, CSS and CSS animation
76 $css = isset( $atts['css'] ) ? $atts['css'] : '';
77 $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : '';
78 $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
79 if ( '' !== $css_animation ) {
80 wp_enqueue_script( 'waypoints' );
81 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation;
82 }
83 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
84 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
85
86
87 // Set custom values
88 $title_color = $title_color ?: $borderless_primary_color; //Title Color
89 $icon_color = $icon_color ?: $borderless_primary_color; //Icon Color
90
91
92 // Output
93 $output .= '<div '.$el_id.' class="borderless-wpbakery-counter text-center '.$css_class.'">';
94 if($checkicon == 'icon') {
95 $output .= '<div class="borderless-wpbakery-counter-icon"><i style="font-size:'.$icon_size.'; line-height:'.$icon_line_height.'; color:'.$icon_color.';" class="'.$icon.'"></i></div>';
96 }
97 $output .= '<div class="borderless-wpbakery-counter-paramns" style="font-size:'.$counter_size.'; line-height:'.$counter_line_height.'; color:'.$counter_color.';" value="'.$value.'" value-speed="'.$value_speed.'" value-interval="'.$value_interval.'"></div>';
98 if($title != ''){
99 $output .= '<'.$title_tag.' style="font-size:'.$title_size.'; line-height:'.$title_line_height.'; color:'.$title_color.';" class="borderless-wpbakery-counter-title">'.$title.'</'.$title_tag.'>';
100 }
101 $output .= '</div>';
102
103 return $output;
104 }
105 }
106
107 return array(
108 'name' => __( 'Counter', 'borderless' ),
109 'base' => 'borderless_wpbakery_counter',
110 'icon' => plugins_url('../images/counter.png', __FILE__),
111 'show_settings_on_create' => true,
112 'category' => __( 'Borderless', 'borderless' ),
113 'description' => __( 'Your milestones and achievements', 'borderless' ),
114 'params' => array(
115
116 array(
117 'type' => 'textfield',
118 'heading' => __( 'Title', 'borderless' ),
119 'param_name' => 'title',
120 'description' => __( 'Enter the title here.', 'borderless' ),
121 ),
122
123 array(
124 'type' => 'textfield',
125 'heading' => __( 'Counter Value', 'borderless' ),
126 'param_name' => 'value',
127 'description' => __( 'Enter number for counter without any special character.', 'borderless' ),
128 ),
129
130 array(
131 'type' => 'textfield',
132 'heading' => __( 'Counter Value Speed', 'borderless' ),
133 'param_name' => 'value_speed',
134 'description' => __( 'Enter number for counter without any special character.', 'borderless' ),
135 ),
136
137 array(
138 'type' => 'textfield',
139 'heading' => __( 'Counter Value Interval', 'borderless' ),
140 'param_name' => 'value_interval',
141 'description' => __( 'Enter number for counter without any special character.', 'borderless' ),
142 ),
143
144 array(
145 'type' => 'dropdown',
146 'heading' => __( 'Icon library', 'borderless' ),
147 'param_name' => 'checkicon',
148 'value' => array(
149 __( 'No', 'borderless' ) => '',
150 __( 'Yes', 'borderless' ) => 'icon',
151 ),
152 'description' => __( 'Enable Icon Library.', 'borderless' ),
153 ),
154
155 array(
156 'type' => 'iconmanager',
157 'heading' => __( 'Icon', 'borderless' ),
158 'param_name' => 'icon',
159 'description' => __( 'Select icon from library.', 'borderless' ),
160 'dependency' => array(
161 'element' => 'checkicon',
162 'value' => array( 'icon' ),
163 ),
164 ),
165
166 array(
167 'type' => 'dropdown',
168 'heading' => __( 'Title Tag', 'borderless' ),
169 'param_name' => 'title_tag',
170 'group' => 'Typography',
171 'value' => array(
172 __( 'H1', 'borderless' ) => 'h1',
173 __( 'H2', 'borderless' ) => 'h2',
174 __( 'H3', 'borderless' ) => 'h3',
175 __( 'H4', 'borderless' ) => 'h4',
176 __( 'H5', 'borderless' ) => 'h5',
177 __( 'H6', 'borderless' ) => 'h6',
178 __( 'p', 'borderless' ) => 'p',
179 __( 'div', 'borderless' ) => 'div',
180 ),
181 'description' => __( 'Select title tag.', 'borderless' ),
182 ),
183
184 array(
185 'type' => 'textfield',
186 'heading' => __( 'Title Font Size', 'borderless' ),
187 'param_name' => 'title_size',
188 'description' => __( 'Enter font size.', 'borderless' ),
189 'group' => 'Typography',
190 ),
191
192 array(
193 'type' => 'textfield',
194 'heading' => __( 'Title Line Height', 'borderless' ),
195 'param_name' => 'title_line_height',
196 'description' => __( 'Enter line height.', 'borderless' ),
197 'group' => 'Typography',
198 ),
199
200 array(
201 'type' => 'colorpicker',
202 'heading' => __( 'Title Color', 'borderless' ),
203 'param_name' => 'title_color',
204 'description' => __( 'Select custom color for the title.', 'borderless' ),
205 'group' => 'Typography',
206 ),
207
208 array(
209 'type' => 'textfield',
210 'heading' => __( 'Counter Size', 'borderless' ),
211 'param_name' => 'counter_size',
212 'description' => __( 'Enter font size.', 'borderless' ),
213 'group' => 'Typography',
214 ),
215
216 array(
217 'type' => 'textfield',
218 'heading' => __( 'Counter Line Height', 'borderless' ),
219 'param_name' => 'counter_line_height',
220 'description' => __( 'Enter line height.', 'borderless' ),
221 'group' => 'Typography',
222 ),
223
224 array(
225 'type' => 'colorpicker',
226 'heading' => __( 'Counter Color', 'borderless' ),
227 'param_name' => 'counter_color',
228 'description' => __( 'Select custom color for the number.', 'borderless' ),
229 'group' => 'Typography',
230 ),
231
232 array(
233 'type' => 'textfield',
234 'heading' => __( 'Icon Size', 'borderless' ),
235 'param_name' => 'icon_size',
236 'description' => __( 'Enter font size.', 'borderless' ),
237 'group' => 'Typography',
238 'dependency' => array(
239 'element' => 'checkicon',
240 'value' => array( 'icon' ),
241 ),
242 ),
243
244 array(
245 'type' => 'textfield',
246 'heading' => __( 'Icon Line Height', 'borderless' ),
247 'param_name' => 'icon_line_height',
248 'description' => __( 'Enter line height.', 'borderless' ),
249 'group' => 'Typography',
250 'dependency' => array(
251 'element' => 'checkicon',
252 'value' => array( 'icon' ),
253 ),
254 ),
255
256 array(
257 'type' => 'colorpicker',
258 'heading' => __( 'Icon Color', 'borderless' ),
259 'param_name' => 'icon_color',
260 'description' => __( 'Select custom color for the icon.', 'borderless' ),
261 'group' => 'Typography',
262 'dependency' => array(
263 'element' => 'checkicon',
264 'value' => array( 'icon' ),
265 ),
266 ),
267
268 // Animation
269 vc_map_add_css_animation(),
270
271 array(
272 'type' => 'el_id',
273 'heading' => __( 'Element ID', 'borderless' ),
274 'param_name' => 'el_id',
275 '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>' ),
276 ),
277
278 array(
279 'type' => 'textfield',
280 'heading' => __( 'Extra class name', 'borderless' ),
281 'param_name' => 'el_class',
282 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
283 ),
284
285 array(
286 'type' => 'css_editor',
287 'heading' => __( 'CSS box', 'borderless' ),
288 'param_name' => 'css',
289 'group' => __( 'Design Options', 'borderless' ),
290 ),
291 ),
292 );
293