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 / svg.php

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

124 lines 4.3 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 /* SVG
8 /*-----------------------------------------------------------------------------------*/
9
10 class WPBakeryShortCode_borderless_wpbakery_svg extends WPBakeryShortCode {
11 protected function content( $atts, $content = null ) {
12 extract( shortcode_atts( array(
13 'svg' => '',
14 'alignment' => 'left',
15 'height' => 'auto',
16 'width' => '100%',
17 //Static
18 'el_id' => '',
19 'el_class' => '',
20 'css' => '',
21 'css_animation' => ''
22 ), $atts ) );
23 $output = '';
24
25
26 // Retrieve data from the database.
27 $options = get_option( 'borderless' );
28
29
30 // Set default values
31 $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color
32 $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color
33 $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color
34 $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color
35
36
37 $svg_img = wp_get_attachment_image_src( $svg );
38 $svg_src = $svg_img[0];
39
40 // Default Extra Class, CSS and CSS animation
41 $css = isset( $atts['css'] ) ? $atts['css'] : '';
42 $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : '';
43 $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
44 if ( '' !== $css_animation ) {
45 wp_enqueue_script( 'waypoints' );
46 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation;
47 }
48 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
49 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
50
51
52 // Output
53 $output .= '<div '.$el_id.' class="borderless-wpbakery-svg '.$css_class.' '. $alignment.'">
54 <div class="borderless-wpbakery-svg-inner" style="height:'.$height.';width:'.$width.';"><img class="borderless-svg-img" src="'.$svg_src.'"/></div>
55 </div>';
56
57 return $output;
58 }
59 }
60
61 return array(
62 'name' => __( 'SVG', 'borderless' ),
63 'base' => 'borderless_wpbakery_svg',
64 'icon' => plugins_url('../images/svg.png', __FILE__),
65 'show_settings_on_create' => true,
66 'category' => __( 'Borderless', 'borderless' ),
67 'description' => __( 'Animated or static SVG for your content', 'borderless' ),
68 'params' => array(
69 array(
70 'type' => 'attach_image',
71 'heading' => __( 'SVG', 'borderless' ),
72 'param_name' => 'svg',
73 'description' => __( 'Select a SVG Icon from media library.', 'borderless' ),
74 ),
75 array(
76 'type' => 'textfield',
77 'heading' => __( 'Height', 'borderless' ),
78 'param_name' => 'height',
79 'description' => __( 'Insert the SVG height.', 'borderless' ),
80 ),
81 array(
82 'type' => 'textfield',
83 'heading' => __( 'Width', 'borderless' ),
84 'param_name' => 'width',
85 'description' => __( 'Insert the SVG width.', 'borderless' ),
86 ),
87 array(
88 'type' => 'dropdown',
89 'heading' => __( 'Alignment', 'borderless' ),
90 'param_name' => 'alignment',
91 'value' => array(
92 __( 'Left', 'borderless' ) => 'borderless-wpbakery-svg-align-left',
93 __( 'Right', 'borderless' ) => 'borderless-wpbakery-svg-align-right',
94 __( 'Center', 'borderless' ) => 'borderless-wpbakery-svg-align-center',
95 ),
96 'description' => __( 'Select icon alignment.', 'borderless' ),
97 ),
98
99 // Animation
100 vc_map_add_css_animation(),
101
102 array(
103 'type' => 'el_id',
104 'heading' => __( 'Element ID', 'borderless' ),
105 'param_name' => 'el_id',
106 '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>' ),
107 ),
108
109 array(
110 'type' => 'textfield',
111 'heading' => __( 'Extra class name', 'borderless' ),
112 'param_name' => 'el_class',
113 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
114 ),
115
116 array(
117 'type' => 'css_editor',
118 'heading' => __( 'CSS box', 'borderless' ),
119 'param_name' => 'css',
120 'group' => __( 'Design Options', 'borderless' ),
121 ),
122 ),
123 );
124