PluginProbe
Borderless – Addons and Templates for Elementor / 1.2.5
Borderless – Addons and Templates for Elementor v1.2.5
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.2.5, at modules/wpbakery/elements/counter.php

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