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 / team-member.php

team-member.php in Borderless – Addons and Templates for Elementor trunk, at modules/wpbakery/elements/team-member.php

451 lines 13.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || exit;
4
5 /*-----------------------------------------------------------------------------------*/
6 /* Team Member
7 /*-----------------------------------------------------------------------------------*/
8
9 class WPBakeryShortCode_borderless_wpbakery_team_member extends WPBakeryShortCode {
10 protected function content( $atts, $content = null ) {
11 extract( shortcode_atts( array(
12 'picture' => null,
13 'picture_size' => null,
14 'name' => null,
15 'name_tag' => 'h3',
16 'job_position' => null,
17 'job_position_tag' => 'h4',
18 'description' => null,
19 'behance' => null,
20 'dribbble' => null,
21 'facebook' => null,
22 'github' => null,
23 'instagram' => null,
24 'linkedin' => null,
25 'medium' => null,
26 'pinterest' => null,
27 'reddit' => null,
28 'snapchat' => null,
29 'tiktok' => null,
30 'twitch' => null,
31 'twitter' => null,
32 'vimeo' => null,
33 'wechat' => null,
34 'whatsapp' => null,
35 'youtube' => null,
36 'open_in_new_window' => null,
37 'add_nofollow' => null,
38 'color' => null,
39 'custom_color' => null,
40 // Static
41 'el_id' => null,
42 'el_class' => null,
43 'css' => null,
44 'css_animation' => ''
45 ), $atts ) );
46 $output = '';
47
48 // Assets.
49 wp_enqueue_style(
50 'borderless-wpbakery-style',
51 BORDERLESS__STYLES . 'wpbakery.min.css',
52 false,
53 BORDERLESS__VERSION
54 );
55
56 // Retrieve data from the database.
57 $options = get_option( 'borderless' );
58
59 // Set default values
60 $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; // Primary Color
61 $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; // Secondary Color
62 $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; // Text Color
63 $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; // Accent Color
64
65 // Picture
66 $picture_url = isset( $picture ) ? wp_get_attachment_image_src( $picture, $picture_size ) : '';
67 $picture = isset( $picture_url[0] ) ? esc_url( $picture_url[0] ) : esc_url( vc_asset_url( 'vc/no_image.png' ) );
68
69 // Target and Rel Attributes
70 $open_in_new_window = $open_in_new_window ? 'target="_blank"' : '';
71 $add_nofollow = $add_nofollow ? 'rel="nofollow"' : '';
72
73 // Color
74 if ( $color == 'primary_color' ) {
75 $color_style = 'color:' . esc_attr( $borderless_primary_color ) . ';';
76 } elseif ( $color == 'secondary_color' ) {
77 $color_style = 'color:' . esc_attr( $borderless_secondary_color ) . ';';
78 } else {
79 $color_style = $custom_color ? 'color:' . esc_attr( $custom_color ) . ';' : 'color:' . esc_attr( $borderless_primary_color ) . ';';
80 }
81 $color_attribute = 'style="' . esc_attr( $color_style ) . '"';
82
83 // Default Extra Class, CSS and CSS animation
84 $css = isset( $atts['css'] ) ? $atts['css'] : '';
85 $el_id = isset( $atts['el_id'] ) ? $atts['el_id'] : '';
86 $el_id = ! empty( $el_id ) ? 'id="' . esc_attr( $el_id ) . '"' : '';
87 $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
88 if ( '' !== $css_animation ) {
89 wp_enqueue_script( 'waypoints' );
90 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . esc_attr( $css_animation );
91 }
92 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
93 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
94
95 // Allowed tags for name and job position
96 $allowed_tags = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span', 'p' );
97 $name_tag = in_array( $name_tag, $allowed_tags ) ? $name_tag : 'h3';
98 $job_position_tag = in_array( $job_position_tag, $allowed_tags ) ? $job_position_tag : 'h4';
99
100 // Output
101 $output .= '<div ' . $el_id . ' class="borderless-wpbakery-team-member ' . esc_attr( $css_class ) . '">';
102 $output .= '<img class="borderless-wpbakery-team-member-picture" src="' . $picture . '" >';
103
104 $output .= '<div class="borderless-wpbakery-team-content">';
105
106 if ( $name ) {
107 $output .= '<' . esc_attr( $name_tag ) . '>' . esc_html( $name ) . '</' . esc_attr( $name_tag ) . '>';
108 }
109
110 if ( $job_position ) {
111 $output .= '<' . esc_attr( $job_position_tag ) . '>' . esc_html( $job_position ) . '</' . esc_attr( $job_position_tag ) . '>';
112 }
113
114 $output .= '<ul class="borderless-wpbakery-team-member-social-profiles">';
115
116 $social_links = array(
117 'behance' => 'vi-behance',
118 'dribbble' => 'vi-dribbble',
119 'facebook' => 'vi-facebook',
120 'github' => 'vi-github',
121 'instagram' => 'vi-instagram',
122 'linkedin' => 'vi-linkedin',
123 'medium' => 'vi-medium',
124 'pinterest' => 'vi-pinterest',
125 'reddit' => 'vi-reddit',
126 'snapchat' => 'vi-snapchat',
127 'tiktok' => 'vi-tiktok',
128 'twitch' => 'vi-twitch',
129 'twitter' => 'vi-twitter',
130 'vimeo' => 'vi-vimeo',
131 'wechat' => 'vi-wechat',
132 'whatsapp' => 'vi-whatsapp',
133 'youtube' => 'vi-youtube',
134 );
135
136 foreach ( $social_links as $key => $icon_class ) {
137 if ( ! empty( $$key ) ) {
138 $url = esc_url( $$key );
139 $title = ucfirst( $key );
140 $output .= '<li class="borderless-wpbakery-team-member-social-profile">';
141 $output .= '<a href="' . $url . '" ' . $open_in_new_window . ' ' . $add_nofollow . ' ' . $color_attribute . ' title="' . esc_attr( $title ) . '">';
142 $output .= '<i class="vi ' . esc_attr( $icon_class ) . '"></i></a></li>';
143 }
144 }
145
146 $output .= '</ul>';
147
148 if ( $description ) {
149 $output .= '<p>' . esc_html( $description ) . '</p>';
150 }
151
152 $output .= '</div>';
153
154 $output .= '</div>';
155
156 return $output;
157 }
158 }
159
160
161 return array(
162 'name' => __( 'Team Member', 'borderless' ),
163 'base' => 'borderless_wpbakery_team_member',
164 'icon' => plugins_url('../images/team-member.png', __FILE__),
165 'show_settings_on_create' => true,
166 'category' => __( 'Borderless', 'borderless' ),
167 'description' => __( 'Create a stylish team member with the impressive options', 'borderless' ),
168 'params' => array(
169
170 array(
171 'type' => 'attach_image',
172 'heading' => __( 'Picture', 'borderless' ),
173 'param_name' => 'picture',
174 'description' => __( 'Upload team member picture.', 'borderless' ),
175 ),
176
177 array(
178 'type' => 'textfield',
179 'heading' => __( 'Picture Size', 'borderless' ),
180 'param_name' => 'picture_size',
181 'description' => __( 'Enter image size (Example: "thumbnail", "medium", "large", "full" or other sizes defined by theme). Alternatively enter size in pixels (Example: 200x100 (Width x Height)).', 'borderless' ),
182 ),
183
184
185 /*-----------------------------------------------------------------------------------*/
186 /* Content
187 /*-----------------------------------------------------------------------------------*/
188
189 array(
190 'type' => 'textfield',
191 'heading' => __( 'Name', 'borderless' ),
192 'param_name' => 'name',
193 'group' => 'Content',
194 'edit_field_class' => 'vc_col-sm-8',
195 ),
196
197 array(
198 'type' => 'dropdown',
199 'class' => '',
200 'heading' => __( 'Tag', 'borderless' ),
201 'param_name' => 'name_tag',
202 'value' => array(
203 __( 'Default', 'borderless' ) => 'h3',
204 __( 'H1', 'borderless' ) => 'h1',
205 __( 'H2', 'borderless' ) => 'h2',
206 __( 'H4', 'borderless' ) => 'h4',
207 __( 'H5', 'borderless' ) => 'h5',
208 __( 'H6', 'borderless' ) => 'h6',
209 __( 'Div', 'borderless' ) => 'div',
210 __( 'p', 'borderless' ) => 'p',
211 __( 'span', 'borderless' ) => 'span',
212 ),
213 'description' => __( 'Default is H3', 'borderless' ),
214 'group' => 'Content',
215 'edit_field_class' => 'vc_col-sm-4 borderless-wpbakery-remove-padding',
216 ),
217
218 array(
219 'type' => 'textfield',
220 'heading' => __( 'Job Position', 'borderless' ),
221 'param_name' => 'job_position',
222 'group' => 'Content',
223 'edit_field_class' => 'vc_col-sm-8',
224 ),
225
226 array(
227 'type' => 'dropdown',
228 'class' => '',
229 'heading' => __( 'Tag', 'borderless' ),
230 'param_name' => 'job_position_tag',
231 'value' => array(
232 __( 'Default', 'borderless' ) => 'h4',
233 __( 'H1', 'borderless' ) => 'h1',
234 __( 'H2', 'borderless' ) => 'h2',
235 __( 'H3', 'borderless' ) => 'h3',
236 __( 'H5', 'borderless' ) => 'h5',
237 __( 'H6', 'borderless' ) => 'h6',
238 __( 'Div', 'borderless' ) => 'div',
239 __( 'p', 'borderless' ) => 'p',
240 __( 'span', 'borderless' ) => 'span',
241 ),
242 'description' => __( 'Default is H4', 'borderless' ),
243 'group' => 'Content',
244 'edit_field_class' => 'vc_col-sm-4',
245 ),
246
247 array(
248 'type' => 'textarea',
249 'heading' => __( 'Description', 'borderless' ),
250 'holder' => 'div',
251 'param_name' => 'description',
252 'group' => 'Content',
253 ),
254
255
256 /*-----------------------------------------------------------------------------------*/
257 /* Social Profiles
258 /*-----------------------------------------------------------------------------------*/
259
260 array(
261 'type' => 'textfield',
262 'heading' => __( 'Behance', 'borderless' ),
263 'param_name' => 'behance',
264 'group' => 'Social Profiles',
265 ),
266
267 array(
268 'type' => 'textfield',
269 'heading' => __( 'Dribbble', 'borderless' ),
270 'param_name' => 'dribbble',
271 'group' => 'Social Profiles',
272 ),
273
274 array(
275 'type' => 'textfield',
276 'heading' => __( 'Facebook', 'borderless' ),
277 'param_name' => 'facebook',
278 'group' => 'Social Profiles',
279 ),
280
281 array(
282 'type' => 'textfield',
283 'heading' => __( 'Github', 'borderless' ),
284 'param_name' => 'github',
285 'group' => 'Social Profiles',
286 ),
287
288 array(
289 'type' => 'textfield',
290 'heading' => __( 'Instagram', 'borderless' ),
291 'param_name' => 'instagram',
292 'group' => 'Social Profiles',
293 ),
294
295 array(
296 'type' => 'textfield',
297 'heading' => __( 'Linkedin', 'borderless' ),
298 'param_name' => 'linkedin',
299 'group' => 'Social Profiles',
300 ),
301
302 array(
303 'type' => 'textfield',
304 'heading' => __( 'Medium', 'borderless' ),
305 'param_name' => 'medium',
306 'group' => 'Social Profiles',
307 ),
308
309 array(
310 'type' => 'textfield',
311 'heading' => __( 'Pinterest', 'borderless' ),
312 'param_name' => 'pinterest',
313 'group' => 'Social Profiles',
314 ),
315
316 array(
317 'type' => 'textfield',
318 'heading' => __( 'Reddit', 'borderless' ),
319 'param_name' => 'reddit',
320 'group' => 'Social Profiles',
321 ),
322
323 array(
324 'type' => 'textfield',
325 'heading' => __( 'Snapchat', 'borderless' ),
326 'param_name' => 'snapchat',
327 'group' => 'Social Profiles',
328 ),
329
330 array(
331 'type' => 'textfield',
332 'heading' => __( 'TikTok', 'borderless' ),
333 'param_name' => 'tiktok',
334 'group' => 'Social Profiles',
335 ),
336
337 array(
338 'type' => 'textfield',
339 'heading' => __( 'Twitch', 'borderless' ),
340 'param_name' => 'twitch',
341 'group' => 'Social Profiles',
342 ),
343
344 array(
345 'type' => 'textfield',
346 'heading' => __( 'Twitter', 'borderless' ),
347 'param_name' => 'twitter',
348 'group' => 'Social Profiles',
349 ),
350
351 array(
352 'type' => 'textfield',
353 'heading' => __( 'Vimeo', 'borderless' ),
354 'param_name' => 'vimeo',
355 'group' => 'Social Profiles',
356 ),
357
358 array(
359 'type' => 'textfield',
360 'heading' => __( 'WeChat', 'borderless' ),
361 'param_name' => 'wechat',
362 'group' => 'Social Profiles',
363 ),
364
365 array(
366 'type' => 'textfield',
367 'heading' => __( 'WhatsApp', 'borderless' ),
368 'param_name' => 'whatsapp',
369 'group' => 'Social Profiles',
370 ),
371
372 array(
373 'type' => 'textfield',
374 'heading' => __( 'Youtube', 'borderless' ),
375 'param_name' => 'youtube',
376 'group' => 'Social Profiles',
377 ),
378
379 array(
380 'type' => 'checkbox',
381 'heading' => __( 'Open in new window', 'borderless' ),
382 'param_name' => 'open_in_new_window',
383 'value' => __( '', 'borderless' ),
384 'group' => 'Social Profiles',
385 ),
386
387 array(
388 'type' => 'checkbox',
389 'heading' => __( 'Add nofollow', 'borderless' ),
390 'param_name' => 'add_nofollow',
391 'value' => __( '', 'borderless' ),
392 'group' => 'Social Profiles',
393 ),
394
395
396 /*-----------------------------------------------------------------------------------*/
397 /* Style
398 /*-----------------------------------------------------------------------------------*/
399
400 array(
401 'type' => 'dropdown',
402 'class' => '',
403 'heading' => __( 'Color', 'borderless' ),
404 'param_name' => 'color',
405 'value' => array(
406 __( 'Primary Color', 'borderless' ) => 'primary_color',
407 __( 'Secondary Color', 'borderless' ) => 'secondary_color',
408 __( 'Custom Color', 'borderless' ) => 'custom_color',
409 ),
410 'description' => __( 'Default is Primary Color', 'borderless' ),
411 'group' => 'Style',
412 ),
413
414 array(
415 'type' => 'colorpicker',
416 'heading' => __( 'Custom Color', 'borderless' ),
417 'param_name' => 'custom_color',
418 'description' => __( 'Select custom color.', 'borderless' ),
419 'group' => 'Style',
420 'dependency' => array(
421 'element' => 'color',
422 'value' => array( 'custom_color' ),
423 ),
424 ),
425
426 // Animation
427 vc_map_add_css_animation(),
428
429 array(
430 'type' => 'el_id',
431 'heading' => __( 'Element ID', 'borderless' ),
432 'param_name' => 'el_id',
433 '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>' ),
434 ),
435
436 array(
437 'type' => 'textfield',
438 'heading' => __( 'Extra class name', 'borderless' ),
439 'param_name' => 'el_class',
440 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
441 ),
442
443 array(
444 'type' => 'css_editor',
445 'heading' => __( 'CSS box', 'borderless' ),
446 'param_name' => 'css',
447 'group' => __( 'Design Options', 'borderless' ),
448 ),
449 ),
450 );
451