| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | protected function content( $atts, $content = null ) { |
| 12 | 12 | extract( shortcode_atts( array( |
| 13 | 13 | 'type' => 'borderless-wpbakery-alert-success', |
| 14 | 14 | 'dismissible' => '', |
| 15 | - //Static | |
| 15 | + // Static | |
| 16 | 16 | 'el_id' => '', |
| 17 | 17 | 'el_class' => '', |
| 18 | 18 | 'css' => '', |
| 19 | 19 | 'css_animation' => '' |
| @@ -19,40 +19,45 @@ | ||
| 19 | 19 | 'css_animation' => '' |
| 20 | 20 | ), $atts ) ); |
| 21 | 21 | $output = ''; |
| 22 | 22 | |
| 23 | + // Assets. | |
| 24 | + wp_enqueue_style( | |
| 25 | + 'borderless-wpbakery-style', | |
| 26 | + BORDERLESS__STYLES . 'wpbakery.min.css', | |
| 27 | + false, | |
| 28 | + BORDERLESS__VERSION | |
| 29 | + ); | |
| 23 | 30 | |
| 24 | 31 | // Retrieve data from the database. |
| 25 | 32 | $options = get_option( 'borderless' ); |
| 26 | 33 | |
| 27 | - | |
| 28 | 34 | // Set default values |
| 29 | - $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color | |
| 30 | - $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color | |
| 31 | - $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color | |
| 32 | - $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color | |
| 35 | + $borderless_primary_color = isset( $options['primary_color'] ) ? esc_attr( $options['primary_color'] ) : '#3379fc'; // Primary Color | |
| 36 | + $borderless_secondary_color = isset( $options['secondary_color'] ) ? esc_attr( $options['secondary_color'] ) : '#3379fc'; // Secondary Color | |
| 37 | + $borderless_text_color = isset( $options['text_color'] ) ? esc_attr( $options['text_color'] ) : ''; // Text Color | |
| 38 | + $borderless_accent_color = isset( $options['accent_color'] ) ? esc_attr( $options['accent_color'] ) : '#3379fc'; // Accent Color | |
| 33 | 39 | |
| 34 | - | |
| 35 | 40 | // Default Extra Class, CSS and CSS animation |
| 36 | - $css = isset( $atts['css'] ) ? $atts['css'] : ''; | |
| 37 | - $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : ''; | |
| 38 | - $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : ''; | |
| 41 | + $css = isset( $atts['css'] ) ? esc_attr( $atts['css'] ) : ''; | |
| 42 | + $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $atts['el_id'] ) . '"' : ''; | |
| 43 | + $el_class = isset( $atts['el_class'] ) ? esc_attr( $atts['el_class'] ) : ''; | |
| 39 | 44 | if ( '' !== $css_animation ) { |
| 40 | 45 | wp_enqueue_script( 'waypoints' ); |
| 41 | - $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation; | |
| 46 | + $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . esc_attr( $css_animation ); | |
| 42 | 47 | } |
| 43 | 48 | $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation ); |
| 44 | 49 | $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts ); |
| 45 | 50 | |
| 46 | - | |
| 47 | 51 | // Set custom values |
| 48 | 52 | $quote = "'"; |
| 49 | - | |
| 50 | 53 | |
| 51 | 54 | // Output |
| 52 | - $output .= '<div '.$el_id.' class="borderless-wpbakery-alert '.$css_class.' '.$type.'">'; | |
| 53 | - $output .= $content; | |
| 54 | - if(!empty($dismissible)) { $output .= '<span class="borderless-wpbakery-alert-close-button" onclick="this.parentElement.style.display='.$quote.'none'.$quote.';">×</span>'; } | |
| 55 | + $output .= '<div '.$el_id.' class="borderless-wpbakery-alert '.esc_attr( $css_class ).' '.esc_attr( $type ).'">'; | |
| 56 | + $output .= wp_kses_post( $content ); | |
| 57 | + if ( ! empty( $dismissible ) ) { | |
| 58 | + $output .= '<span class="borderless-wpbakery-alert-close-button" onclick="this.parentElement.style.display=' . $quote . 'none' . $quote . ';">×</span>'; | |
| 59 | + } | |
| 55 | 60 | $output .= '</div>'; |
| 56 | 61 | |
| 57 | 62 | return $output; |
| 58 | 63 | } |
| @@ -121,5 +126,4 @@ | ||
| 121 | 126 | 'group' => __( 'Design Options', 'borderless' ), |
| 122 | 127 | ), |
| 123 | 128 | ), |
| 124 | 129 | ); |
| 125 | - | |