| @@ -29,9 +29,35 @@ | ||
| 29 | 29 | 'css_animation' => '' |
| 30 | 30 | ), $atts ) ); |
| 31 | 31 | $output = ''; |
| 32 | 32 | |
| 33 | + // Assets. | |
| 34 | + wp_enqueue_style( | |
| 35 | + 'borderless-wpbakery-style', | |
| 36 | + BORDERLESS__STYLES . 'wpbakery.min.css', | |
| 37 | + false, | |
| 38 | + BORDERLESS__VERSION | |
| 39 | + ); | |
| 40 | + wp_enqueue_script( | |
| 41 | + 'borderless-wpbakery-appear-script', | |
| 42 | + BORDERLESS__LIB . 'appear.js', array('jquery'), | |
| 43 | + '1.0.0', | |
| 44 | + true | |
| 45 | + ); | |
| 46 | + wp_enqueue_script( | |
| 47 | + 'borderless-wpbakery-progressbar-script', | |
| 48 | + BORDERLESS__LIB . 'progressbar.js', array('jquery'), | |
| 49 | + '1.1.0', | |
| 50 | + true | |
| 51 | + ); | |
| 52 | + wp_enqueue_script( | |
| 53 | + 'borderless-wpbakery-script', | |
| 54 | + BORDERLESS__SCRIPTS . 'borderless-wpbakery.min.js', array('jquery'), | |
| 55 | + BORDERLESS__VERSION, | |
| 56 | + true | |
| 57 | + ); | |
| 33 | 58 | |
| 59 | + | |
| 34 | 60 | // Retrieve data from the database. |
| 35 | 61 | $options = get_option( 'borderless' ); |
| 36 | 62 | |
| 37 | 63 | |
| @@ -43,13 +69,14 @@ | ||
| 43 | 69 | |
| 44 | 70 | |
| 45 | 71 | // Default Extra Class, CSS and CSS animation |
| 46 | 72 | $css = isset( $atts['css'] ) ? $atts['css'] : ''; |
| 47 | - $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : ''; | |
| 73 | + $el_id = isset( $atts['el_id'] ) ? $atts['el_id'] : ''; | |
| 74 | + $el_id = ! empty( $el_id ) ? 'id="' . esc_attr( $el_id ) . '"' : ''; | |
| 48 | 75 | $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : ''; |
| 49 | 76 | if ( '' !== $css_animation ) { |
| 50 | 77 | wp_enqueue_script( 'waypoints' ); |
| 51 | - $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation; | |
| 78 | + $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . esc_attr( $css_animation ); | |
| 52 | 79 | } |
| 53 | 80 | $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation ); |
| 54 | 81 | $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts ); |
| 55 | 82 | |
| @@ -54,28 +81,32 @@ | ||
| 54 | 81 | $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts ); |
| 55 | 82 | |
| 56 | 83 | |
| 57 | 84 | // Start Custom Colors |
| 58 | - $title_color = $title_color ? 'style=color:'.$title_color.'' : 'style=color:'.$borderless_primary_color.''; | |
| 85 | + $title_color_style = $title_color ? 'color:' . esc_attr( $title_color ) . ';' : 'color:' . esc_attr( $borderless_primary_color ) . ';'; | |
| 59 | 86 | |
| 60 | - $icon_color = $icon_color ? 'style=color:'.$icon_color.'' : 'style=color:'.$borderless_primary_color.''; | |
| 87 | + $icon_color_style = $icon_color ? 'color:' . esc_attr( $icon_color ) . ';' : 'color:' . esc_attr( $borderless_primary_color ) . ';'; | |
| 61 | 88 | |
| 62 | - $bar_color = $bar_color ? $bar_color : $borderless_primary_color; | |
| 89 | + $bar_color = $bar_color ? esc_attr( $bar_color ) : esc_attr( $borderless_primary_color ); | |
| 63 | 90 | |
| 64 | - $track_color = $track_color ? $track_color : '#f9f9f9'; | |
| 91 | + $track_color = $track_color ? esc_attr( $track_color ) : '#f9f9f9'; | |
| 65 | 92 | // End Custom Colors |
| 66 | 93 | |
| 67 | - $height = $height ? 'style="height:'.$height.';"' : ''; | |
| 94 | + $height_style = $height ? 'height:' . esc_attr( $height ) . ';' : ''; | |
| 68 | 95 | |
| 69 | - if ($checkicon=="custom_icon") { $icon = '<i class="borderless-wpbakery-progress-bar-icon '.$icon.'" '.$icon_color.'></i>'; } else { $icon = ""; } | |
| 96 | + if ( $checkicon == "custom_icon" ) { | |
| 97 | + $icon = '<i class="borderless-wpbakery-progress-bar-icon ' . esc_attr( $icon ) . '" style="' . esc_attr( $icon_color_style ) . '"></i>'; | |
| 98 | + } else { | |
| 99 | + $icon = ""; | |
| 100 | + } | |
| 70 | 101 | |
| 71 | 102 | // Start Output |
| 72 | 103 | |
| 73 | - $output .= '<div '.$el_id.' class="borderless-wpbakery-progress-bar '.$css_class.'">'; | |
| 104 | + $output .= '<div ' . $el_id . ' class="borderless-wpbakery-progress-bar ' . esc_attr( $css_class ) . '">'; | |
| 74 | 105 | $output .= $icon; |
| 75 | 106 | $output .= '<div class="borderless-wpbakery-progress-bar-inner">'; |
| 76 | - $output .= '<span '.$title_color.' class="progress-bar-title">'.$title.'</span>'; | |
| 77 | - $output .= '<div class="borderless-wpbakery-progress-bar-params '.$corner.'" '.$height.' percentage="'.$percentage.'" bar_color="'.$bar_color.'" track_color="'.$track_color.'" percentage_color="'.$percentage_color.'"></div>'; | |
| 107 | + $output .= '<span style="' . esc_attr( $title_color_style ) . '" class="progress-bar-title">' . esc_html( $title ) . '</span>'; | |
| 108 | + $output .= '<div class="borderless-wpbakery-progress-bar-params ' . esc_attr( $corner ) . '" style="' . esc_attr( $height_style ) . '" percentage="' . esc_attr( $percentage ) . '" bar_color="' . esc_attr( $bar_color ) . '" track_color="' . esc_attr( $track_color ) . '" percentage_color="' . esc_attr( $percentage_color ) . '"></div>'; | |
| 78 | 109 | $output .= '</div></div>'; |
| 79 | 110 | |
| 80 | 111 | return $output; |
| 81 | 112 | |
| @@ -81,8 +112,9 @@ | ||
| 81 | 112 | |
| 82 | 113 | // End Output |
| 83 | 114 | } |
| 84 | 115 | } |
| 116 | + | |
| 85 | 117 | |
| 86 | 118 | return array( |
| 87 | 119 | 'name' => __( 'Progress Bar', 'borderless' ), |
| 88 | 120 | 'base' => 'borderless_wpbakery_progress_bar', |