| @@ -20,36 +20,42 @@ | ||
| 20 | 20 | 'css' => '', |
| 21 | 21 | 'css_animation' => '' |
| 22 | 22 | ), $atts ) ); |
| 23 | 23 | $output = ''; |
| 24 | + | |
| 25 | + // Assets. | |
| 26 | + wp_enqueue_style( | |
| 27 | + 'borderless-wpbakery-style', | |
| 28 | + BORDERLESS__STYLES . 'wpbakery.min.css', | |
| 29 | + false, | |
| 30 | + BORDERLESS__VERSION | |
| 31 | + ); | |
| 24 | 32 | |
| 25 | - | |
| 26 | 33 | // Retrieve data from the database. |
| 27 | 34 | $options = get_option( 'borderless' ); |
| 28 | 35 | |
| 29 | - | |
| 30 | 36 | // 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 | + $borderless_primary_color = isset( $options['primary_color'] ) ? esc_attr( $options['primary_color'] ) : '#3379fc'; | |
| 38 | + $borderless_secondary_color = isset( $options['secondary_color'] ) ? esc_attr( $options['secondary_color'] ) : '#3379fc'; | |
| 39 | + $borderless_text_color = isset( $options['text_color'] ) ? esc_attr( $options['text_color'] ) : ''; | |
| 40 | + $borderless_accent_color = isset( $options['accent_color'] ) ? esc_attr( $options['accent_color'] ) : '#3379fc'; | |
| 41 | + | |
| 37 | 42 | // Default Extra Class, CSS and CSS animation |
| 38 | - $css = isset( $atts['css'] ) ? $atts['css'] : ''; | |
| 39 | - $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : ''; | |
| 40 | - $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : ''; | |
| 43 | + $css = isset( $atts['css'] ) ? esc_attr( $atts['css'] ) : ''; | |
| 44 | + $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $atts['el_id'] ) . '"' : ''; | |
| 45 | + $el_class = isset( $atts['el_class'] ) ? esc_attr( $atts['el_class'] ) : ''; | |
| 41 | 46 | if ( '' !== $css_animation ) { |
| 42 | 47 | wp_enqueue_script( 'waypoints' ); |
| 43 | - $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation; | |
| 48 | + $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . esc_attr( $css_animation ); | |
| 44 | 49 | } |
| 45 | 50 | $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation ); |
| 46 | 51 | $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts ); |
| 47 | 52 | |
| 48 | - | |
| 49 | 53 | // Output |
| 50 | - $output .= '<div '.$el_id.' class="borderless-wpbakery-list-group '.$css_class.' '.$direction.' '.$appearance.' '.$alignment.' '.$mode.'">'.wpb_js_remove_wpautop($content).'</div>'; | |
| 51 | - | |
| 54 | + $output .= '<div ' . $el_id . ' class="borderless-wpbakery-list-group ' . esc_attr( $css_class ) . ' ' . esc_attr( $direction ) . ' ' . esc_attr( $appearance ) . ' ' . esc_attr( $alignment ) . ' ' . esc_attr( $mode ) . '">'; | |
| 55 | + $output .= wpb_js_remove_wpautop( $content ); | |
| 56 | + $output .= '</div>'; | |
| 57 | + | |
| 52 | 58 | return $output; |
| 53 | 59 | } |
| 54 | 60 | } |
| 55 | 61 | |
| @@ -61,9 +67,8 @@ | ||
| 61 | 67 | 'icon' => '', |
| 62 | 68 | 'colors' => '', |
| 63 | 69 | 'icon_color' => '', |
| 64 | 70 | 'title_color' => '', |
| 65 | - //Static | |
| 66 | 71 | 'el_id' => '', |
| 67 | 72 | 'el_class' => '', |
| 68 | 73 | 'css' => '', |
| 69 | 74 | 'css_animation' => '' |
| @@ -68,67 +73,56 @@ | ||
| 68 | 73 | 'css' => '', |
| 69 | 74 | 'css_animation' => '' |
| 70 | 75 | ), $atts ) ); |
| 71 | 76 | $output = ''; |
| 72 | - | |
| 73 | - | |
| 77 | + | |
| 74 | 78 | // Retrieve data from the database. |
| 75 | 79 | $options = get_option( 'borderless' ); |
| 76 | 80 | |
| 77 | - | |
| 78 | 81 | // Set default values |
| 79 | - $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color | |
| 80 | - $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color | |
| 81 | - $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color | |
| 82 | - $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color | |
| 83 | - | |
| 84 | - | |
| 82 | + $borderless_primary_color = isset( $options['primary_color'] ) ? esc_attr( $options['primary_color'] ) : '#3379fc'; | |
| 83 | + $borderless_secondary_color = isset( $options['secondary_color'] ) ? esc_attr( $options['secondary_color'] ) : '#3379fc'; | |
| 84 | + $borderless_text_color = isset( $options['text_color'] ) ? esc_attr( $options['text_color'] ) : ''; | |
| 85 | + $borderless_accent_color = isset( $options['accent_color'] ) ? esc_attr( $options['accent_color'] ) : '#3379fc'; | |
| 86 | + | |
| 85 | 87 | // Default Extra Class, CSS and CSS animation |
| 86 | - $css = isset( $atts['css'] ) ? $atts['css'] : ''; | |
| 87 | - $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : ''; | |
| 88 | - $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : ''; | |
| 88 | + $css = isset( $atts['css'] ) ? esc_attr( $atts['css'] ) : ''; | |
| 89 | + $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $atts['el_id'] ) . '"' : ''; | |
| 90 | + $el_class = isset( $atts['el_class'] ) ? esc_attr( $atts['el_class'] ) : ''; | |
| 89 | 91 | |
| 90 | 92 | if ( '' !== $css_animation ) { |
| 91 | 93 | wp_enqueue_script( 'waypoints' ); |
| 92 | - $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation; | |
| 94 | + $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . esc_attr( $css_animation ); | |
| 93 | 95 | } |
| 94 | 96 | |
| 95 | 97 | $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation ); |
| 96 | 98 | $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts ); |
| 97 | - | |
| 98 | - | |
| 99 | + | |
| 99 | 100 | // URL Builder |
| 100 | 101 | $link = vc_build_link( $link ); |
| 101 | - | |
| 102 | - | |
| 102 | + | |
| 103 | 103 | // Set custom values |
| 104 | - $icon_color = $icon_color ? 'style=color:'.$icon_color.'' : ''; | |
| 105 | - $title_color = $title_color ? 'style=color:'.$title_color.'' : ''; | |
| 104 | + $icon_color = $icon_color ? 'style="color:' . esc_attr( $icon_color ) . ';"' : ''; | |
| 105 | + $title_color = $title_color ? 'style="color:' . esc_attr( $title_color ) . ';"' : ''; | |
| 106 | 106 | |
| 107 | - // End Custom Colors | |
| 108 | - | |
| 109 | - // Start Icon | |
| 110 | - | |
| 111 | - $icon = $icon ? '<i class="'.$icon.'" '.$icon_color.' aria-hidden="true"></i>' : ''; | |
| 112 | - | |
| 113 | - //End Icon | |
| 114 | - | |
| 115 | - // Start Link | |
| 116 | - if($link['url'] != ''){ | |
| 107 | + // Icon | |
| 108 | + $icon = $icon ? '<i class="' . esc_attr( $icon ) . '" ' . $icon_color . ' aria-hidden="true"></i>' : ''; | |
| 109 | + | |
| 110 | + // Link | |
| 111 | + if ( ! empty( $link['url'] ) ) { | |
| 117 | 112 | $tag = 'a'; |
| 118 | - $href = 'href="'.esc_attr( $link['url'] ).'"'; | |
| 113 | + $href = 'href="' . esc_url( $link['url'] ) . '"'; | |
| 119 | 114 | } else { |
| 120 | 115 | $tag = 'span'; |
| 121 | 116 | $href = ''; |
| 122 | 117 | } |
| 123 | - // End Link | |
| 118 | + | |
| 119 | + $output .= '<' . $tag . ' ' . $href . ' ' . $el_id . ' class="borderless-wpbakery-list-group-item ' . esc_attr( $css_class ) . '" ' . $title_color . '>' . $icon . esc_html( $title ) . '</' . $tag . '>'; | |
| 124 | 120 | |
| 125 | - $output .= '<'.$tag.' '.$href.' '.$el_id.' class="borderless-wpbakery-list-group-item '.$css_class.'" '.$title_color.'>'.$icon.$title.'</'.$tag.'>'; | |
| 126 | - | |
| 127 | - | |
| 128 | 121 | return $output; |
| 129 | 122 | } |
| 130 | 123 | } |
| 124 | + | |
| 131 | 125 | |
| 132 | 126 | vc_map( array( |
| 133 | 127 | 'name' => __( 'List Group', 'borderless' ), |
| 134 | 128 | 'base' => 'borderless_wpbakery_list_group', |