| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | - die( '-1' ); | |
| 3 | + die( '-1' ); | |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /*-----------------------------------------------------------------------------------*/ |
| 7 | 7 | /* SVG |
| @@ -7,57 +7,69 @@ | ||
| 7 | 7 | /* SVG |
| 8 | 8 | /*-----------------------------------------------------------------------------------*/ |
| 9 | 9 | |
| 10 | 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 = ''; | |
| 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 | 24 | |
| 25 | + // Assets. | |
| 26 | + wp_enqueue_style( | |
| 27 | + 'borderless-wpbakery-style', | |
| 28 | + BORDERLESS__STYLES . 'wpbakery.min.css', | |
| 29 | + false, | |
| 30 | + BORDERLESS__VERSION | |
| 31 | + ); | |
| 25 | 32 | |
| 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 | - | |
| 33 | + // Retrieve data from the database. | |
| 34 | + $options = get_option( 'borderless' ); | |
| 51 | 35 | |
| 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 | - } | |
| 36 | + // Set default values | |
| 37 | + $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; // Primary Color | |
| 38 | + $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; // Secondary Color | |
| 39 | + $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; // Text Color | |
| 40 | + $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; // Accent Color | |
| 41 | + | |
| 42 | + $svg_img = wp_get_attachment_image_src( $svg ); | |
| 43 | + $svg_src = isset( $svg_img[0] ) ? $svg_img[0] : ''; | |
| 44 | + | |
| 45 | + // Default Extra Class, CSS and CSS animation | |
| 46 | + $css = isset( $atts['css'] ) ? $atts['css'] : ''; | |
| 47 | + $el_id = isset( $atts['el_id'] ) ? $atts['el_id'] : ''; | |
| 48 | + $el_id = ! empty( $el_id ) ? 'id="' . esc_attr( $el_id ) . '"' : ''; | |
| 49 | + $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : ''; | |
| 50 | + if ( '' !== $css_animation ) { | |
| 51 | + wp_enqueue_script( 'waypoints' ); | |
| 52 | + $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . esc_attr( $css_animation ); | |
| 53 | + } | |
| 54 | + $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation ); | |
| 55 | + $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts ); | |
| 56 | + | |
| 57 | + // Output | |
| 58 | + $alignment = esc_attr( $alignment ); | |
| 59 | + $height = esc_attr( $height ); | |
| 60 | + $width = esc_attr( $width ); | |
| 61 | + $svg_src = esc_url( $svg_src ); | |
| 62 | + $css_class = esc_attr( $css_class ); | |
| 63 | + | |
| 64 | + $output .= '<div ' . $el_id . ' class="borderless-wpbakery-svg ' . $css_class . ' ' . $alignment . '">'; | |
| 65 | + $output .= '<div class="borderless-wpbakery-svg-inner" style="height:' . $height . ';width:' . $width . ';"><img class="borderless-svg-img" src="' . $svg_src . '"/></div>'; | |
| 66 | + $output .= '</div>'; | |
| 67 | + | |
| 68 | + return $output; | |
| 69 | + } | |
| 59 | 70 | } |
| 71 | + | |
| 60 | 72 | |
| 61 | 73 | return array( |
| 62 | 74 | 'name' => __( 'SVG', 'borderless' ), |
| 63 | 75 | 'base' => 'borderless_wpbakery_svg', |