| @@ -97,9 +97,17 @@ | ||
| 97 | 97 | 'css_animation' => '' |
| 98 | 98 | ), $atts ) ); |
| 99 | 99 | $output = ''; |
| 100 | 100 | |
| 101 | + // Assets. | |
| 102 | + wp_enqueue_style( | |
| 103 | + 'borderless-wpbakery-style', | |
| 104 | + BORDERLESS__STYLES . 'wpbakery.min.css', | |
| 105 | + false, | |
| 106 | + BORDERLESS__VERSION | |
| 107 | + ); | |
| 101 | 108 | |
| 109 | + | |
| 102 | 110 | // Retrieve data from the database. |
| 103 | 111 | $options = get_option( 'borderless' ); |
| 104 | 112 | |
| 105 | 113 | |
| @@ -116,9 +124,9 @@ | ||
| 116 | 124 | $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : ''; |
| 117 | 125 | |
| 118 | 126 | if ( '' !== $css_animation ) { |
| 119 | 127 | wp_enqueue_script( 'waypoints' ); |
| 120 | - $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation; | |
| 128 | + $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . esc_attr( $css_animation ); | |
| 121 | 129 | } |
| 122 | 130 | |
| 123 | 131 | $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation ); |
| 124 | 132 | $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts ); |
| @@ -125,65 +133,73 @@ | ||
| 125 | 133 | |
| 126 | 134 | // End Default Extra Class, CSS and CSS animation |
| 127 | 135 | |
| 128 | 136 | // Icon |
| 129 | - if ($icon_display == 'image_icon') { | |
| 137 | + if ( $icon_display == 'image_icon' ) { | |
| 130 | 138 | |
| 131 | - if($icon_alignment != '') { | |
| 132 | - $icon_alignment = 'text-align:'.$icon_alignment.';'; | |
| 139 | + if ( ! empty( $icon_alignment ) ) { | |
| 140 | + $icon_alignment_style = 'text-align:' . esc_attr( $icon_alignment ) . ';'; | |
| 141 | + } else { | |
| 142 | + $icon_alignment_style = ''; | |
| 133 | 143 | } |
| 134 | 144 | |
| 135 | 145 | $default_src = vc_asset_url( 'vc/no_image.png' ); |
| 136 | 146 | $img = wp_get_attachment_image_src( $custom_image_icon ); |
| 137 | 147 | $src = $img[0]; |
| 138 | - $custom_src = $src ? esc_attr( $src ) : $default_src; | |
| 148 | + $custom_src = $src ? esc_url( $src ) : esc_url( $default_src ); | |
| 139 | 149 | |
| 140 | - $icon_content = '<div style="'.$icon_alignment.'"><img src="'.$custom_src.'" ></div>'; | |
| 150 | + $icon_content = '<div style="' . esc_attr( $icon_alignment_style ) . '"><img src="' . esc_url( $custom_src ) . '" ></div>'; | |
| 141 | 151 | |
| 142 | - } elseif ($icon_display == 'svg_icon') { | |
| 152 | + } elseif ( $icon_display == 'svg_icon' ) { | |
| 143 | 153 | |
| 144 | - if($icon_alignment != '') { | |
| 145 | - $icon_alignment = 'text-align:'.$icon_alignment.';'; | |
| 154 | + if ( ! empty( $icon_alignment ) ) { | |
| 155 | + $icon_alignment_style = 'text-align:' . esc_attr( $icon_alignment ) . ';'; | |
| 156 | + } else { | |
| 157 | + $icon_alignment_style = ''; | |
| 146 | 158 | } |
| 147 | 159 | |
| 148 | 160 | $default_src = vc_asset_url( 'vc/no_image.png' ); |
| 149 | 161 | $img = wp_get_attachment_image_src( $custom_svg_icon ); |
| 150 | 162 | $src = $img[0]; |
| 151 | - $custom_src = $src ? esc_attr( $src ) : $default_src; | |
| 163 | + $custom_src = $src ? esc_url( $src ) : esc_url( $default_src ); | |
| 152 | 164 | |
| 153 | - $icon_content = '<div class="elvn" style="'.$icon_alignment.'"><img class="vesvg" src="'.$custom_src.'" ></div>'; | |
| 165 | + $icon_content = '<div class="elvn" style="' . esc_attr( $icon_alignment_style ) . '"><img class="borderless-svg-img" src="' . esc_url( $custom_src ) . '" ></div>'; | |
| 154 | 166 | |
| 155 | 167 | } else { |
| 156 | 168 | |
| 157 | 169 | $iconClass = isset( $icon ) ? esc_attr( $icon ) : 'fa fa-adjust'; |
| 158 | 170 | |
| 159 | - $custom_icon_color = $icon_color ? 'color:'.$custom_icon_color.';' : 'color:'.$borderless_primary_color.';'; //Icon Color | |
| 171 | + $custom_icon_color_style = ! empty( $custom_icon_color ) ? 'color:' . esc_attr( $custom_icon_color ) . ';' : 'color:' . esc_attr( $borderless_primary_color ) . ';'; //Icon Color | |
| 160 | 172 | |
| 161 | - $font_size_reference = $icon_size; | |
| 173 | + $font_size_reference = esc_attr( $icon_size ); | |
| 162 | 174 | |
| 163 | - if($icon_size != '') { | |
| 164 | - $icon_size = 'font-size:'.$icon_size.';'; | |
| 175 | + if ( ! empty( $icon_size ) ) { | |
| 176 | + $icon_size_style = 'font-size:' . esc_attr( $icon_size ) . ';'; | |
| 177 | + } else { | |
| 178 | + $icon_size_style = ''; | |
| 165 | 179 | } |
| 166 | 180 | |
| 167 | - if($icon_alignment != '') { | |
| 168 | - $icon_alignment = 'text-align:'.$icon_alignment.';display: block;'; | |
| 181 | + if ( ! empty( $icon_alignment ) ) { | |
| 182 | + $icon_alignment_style = 'text-align:' . esc_attr( $icon_alignment ) . ';display: block;'; | |
| 183 | + } else { | |
| 184 | + $icon_alignment_style = ''; | |
| 169 | 185 | } |
| 170 | 186 | |
| 171 | - if($shape != '') { | |
| 187 | + if ( ! empty( $shape ) ) { | |
| 172 | 188 | |
| 173 | - if($shape == 'rounded' || $shape == 'square' || $shape == 'round') { | |
| 174 | - $color_shape = $color_shape ? 'background-color:'.$color_shape.';' : 'background-color:'.$borderless_primary_color.';'; //Background Color Shape | |
| 189 | + if ( $shape == 'rounded' || $shape == 'square' || $shape == 'round' ) { | |
| 190 | + $color_shape_style = ! empty( $color_shape ) ? 'background-color:' . esc_attr( $color_shape ) . ';' : 'background-color:' . esc_attr( $borderless_primary_color ) . ';'; //Background Color Shape | |
| 175 | 191 | } else { |
| 176 | - $color_shape = $color_shape ? 'border-color:'.$color_shape.';' : 'border-color:'.$borderless_primary_color.';'; //Border Color Shape | |
| 192 | + $color_shape_style = ! empty( $color_shape ) ? 'border-color:' . esc_attr( $color_shape ) . ';' : 'border-color:' . esc_attr( $borderless_primary_color ) . ';'; //Border Color Shape | |
| 177 | 193 | } |
| 178 | 194 | |
| 179 | - if($icon_spacing != '') { | |
| 180 | - $icon_spacing = 'height:'.$icon_spacing.'; width:'.$icon_spacing.';'; | |
| 195 | + if ( ! empty( $icon_spacing ) ) { | |
| 196 | + $icon_spacing_style = 'height:' . esc_attr( $icon_spacing ) . '; width:' . esc_attr( $icon_spacing ) . ';'; | |
| 181 | 197 | } else { |
| 182 | - $icon_spacing = 'height:calc('.$font_size_reference.' + 2em); width:calc('.$font_size_reference.' + 2em);'; | |
| 198 | + $icon_spacing_style = 'height:calc(' . esc_attr( $font_size_reference ) . ' + 2em); width:calc(' . esc_attr( $font_size_reference ) . ' + 2em);'; | |
| 183 | 199 | } |
| 184 | 200 | |
| 185 | - $shape_render_start = '<div style="'.$icon_alignment.'"><div class="icon-pricing '.$shape.'" style="'.$color_shape.''.$icon_spacing.'">'; | |
| 201 | + $shape_render_start = '<div style="' . esc_attr( $icon_alignment_style ) . '"><div class="icon-pricing ' . esc_attr( $shape ) . '" style="' . esc_attr( $color_shape_style . $icon_spacing_style ) . '">'; | |
| 186 | 202 | $shape_render_finish = '</div></div>'; |
| 187 | 203 | |
| 188 | 204 | } else { |
| 189 | 205 | $shape_render_start = ''; |
| @@ -189,99 +205,131 @@ | ||
| 189 | 205 | $shape_render_start = ''; |
| 190 | 206 | $shape_render_finish = ''; |
| 191 | 207 | } |
| 192 | 208 | |
| 193 | - $icon_content = ''.$shape_render_start.'<span style="'.$custom_icon_color.' '.$icon_size.' '.$icon_alignment.'" class="vc_icon_element-icon '.$iconClass.'"></span>'.$shape_render_finish.''; | |
| 209 | + $icon_content = $shape_render_start . '<span style="' . esc_attr( $custom_icon_color_style . ' ' . $icon_size_style . ' ' . $icon_alignment_style ) . '" class="vc_icon_element-icon ' . esc_attr( $iconClass ) . '"></span>' . $shape_render_finish; | |
| 194 | 210 | } |
| 195 | 211 | |
| 196 | 212 | |
| 197 | 213 | |
| 198 | 214 | // Title |
| 199 | - $title_content = '<'.$title_tag.' style="font-size:'.$title_size.';line-height:'.$title_line_height.';margin:'.$title_spacing.';text-align:'.$title_alignment.';color:'.$title_color.';">'.$title.'</'.$title_tag.'>'; | |
| 215 | + $allowed_tags = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p' ); | |
| 216 | + $title_tag = in_array( $title_tag, $allowed_tags ) ? $title_tag : 'h3'; | |
| 200 | 217 | |
| 218 | + $title_style = 'font-size:' . esc_attr( $title_size ) . ';line-height:' . esc_attr( $title_line_height ) . ';margin:' . esc_attr( $title_spacing ) . ';text-align:' . esc_attr( $title_alignment ) . ';color:' . esc_attr( $title_color ) . ';'; | |
| 219 | + | |
| 220 | + $title_content = '<' . esc_attr( $title_tag ) . ' style="' . esc_attr( $title_style ) . '">' . esc_html( $title ) . '</' . esc_attr( $title_tag ) . '>'; | |
| 221 | + | |
| 201 | 222 | //Price |
| 202 | - $price_content = '<p class="price" style="line-height:'.$price_line_height.';margin:'.$price_spacing.';text-align:'.$price_alignment.';color:'.$price_color.';"> | |
| 203 | - <span class="pricing-currency" style="font-size:'.$currency_size.';margin:'.$currency_spacing.';">'.$currency.'</span><span class="pricing-value" style="font-size:'.$price_size.';">'.$price.'</span> | |
| 204 | - <span class="pricing-plan">'.$plan.'</span> | |
| 223 | + $price_style = 'line-height:' . esc_attr( $price_line_height ) . ';margin:' . esc_attr( $price_spacing ) . ';text-align:' . esc_attr( $price_alignment ) . ';color:' . esc_attr( $price_color ) . ';'; | |
| 224 | + | |
| 225 | + $currency_style = 'font-size:' . esc_attr( $currency_size ) . ';margin:' . esc_attr( $currency_spacing ) . ';'; | |
| 226 | + $price_value_style = 'font-size:' . esc_attr( $price_size ) . ';'; | |
| 227 | + | |
| 228 | + $price_content = '<p class="price" style="' . esc_attr( $price_style ) . '"> | |
| 229 | + <span class="pricing-currency" style="' . esc_attr( $currency_style ) . '">' . esc_html( $currency ) . '</span><span class="pricing-value" style="' . esc_attr( $price_value_style ) . '">' . esc_html( $price ) . '</span> | |
| 230 | + <span class="pricing-plan">' . esc_html( $plan ) . '</span> | |
| 205 | 231 | </p>'; |
| 206 | 232 | |
| 207 | 233 | //Sub Heading |
| 208 | 234 | |
| 209 | - $sub_heading_content = $content; | |
| 235 | + $sub_heading_content = wpb_js_remove_wpautop( do_shortcode( $content ) ); | |
| 210 | 236 | |
| 211 | 237 | //Featured List |
| 212 | - if($features_icon == 'features-arrow') { | |
| 213 | - $features_icon = 'fa-chevron-right'; | |
| 214 | - } else if($features_icon == 'features-check') { | |
| 215 | - $features_icon = 'fa-check'; | |
| 216 | - } else if($features_icon == 'features-more') { | |
| 217 | - $features_icon = 'fa-plus'; | |
| 218 | - } else { | |
| 219 | - $features_icon = 'fa-star'; | |
| 238 | + switch ( $features_icon ) { | |
| 239 | + case 'features-arrow': | |
| 240 | + $features_icon_class = 'fa-chevron-right'; | |
| 241 | + break; | |
| 242 | + case 'features-check': | |
| 243 | + $features_icon_class = 'fa-check'; | |
| 244 | + break; | |
| 245 | + case 'features-more': | |
| 246 | + $features_icon_class = 'fa-plus'; | |
| 247 | + break; | |
| 248 | + default: | |
| 249 | + $features_icon_class = 'fa-star'; | |
| 250 | + break; | |
| 220 | 251 | } |
| 221 | 252 | |
| 222 | 253 | $featured_list = ''; |
| 223 | 254 | |
| 224 | - if($features_icon_color != '') { | |
| 225 | - $features_icon_color = 'style="color:'.$features_icon_color.'"'; | |
| 255 | + if ( ! empty( $features_icon_color ) ) { | |
| 256 | + $features_icon_color_style = 'style="color:' . esc_attr( $features_icon_color ) . '"'; | |
| 226 | 257 | } else { |
| 227 | - $features_icon_color = ''; | |
| 258 | + $features_icon_color_style = ''; | |
| 228 | 259 | } |
| 229 | 260 | |
| 230 | - if($features_line_list == 'line_list' ) { | |
| 231 | - $features_line_list = 'line-list'; | |
| 232 | - if($features_line_list_color != '') { | |
| 233 | - $features_line_list_color = 'border-bottom-color:'.$features_line_list_color.';'; | |
| 261 | + if ( $features_line_list == 'line_list' ) { | |
| 262 | + $features_line_list_class = 'line-list'; | |
| 263 | + if ( ! empty( $features_line_list_color ) ) { | |
| 264 | + $features_line_list_color_style = 'border-bottom-color:' . esc_attr( $features_line_list_color ) . ';'; | |
| 234 | 265 | } else { |
| 235 | - $features_line_list_color = ''; | |
| 266 | + $features_line_list_color_style = ''; | |
| 236 | 267 | } |
| 237 | 268 | } else { |
| 238 | - $features_line_list = ''; | |
| 239 | - $features_line_list_color = ''; | |
| 269 | + $features_line_list_class = ''; | |
| 270 | + $features_line_list_color_style = ''; | |
| 240 | 271 | } |
| 241 | 272 | |
| 242 | 273 | $features_counter = 1; |
| 243 | 274 | |
| 244 | - while( $features_counter <= 15 ){ | |
| 245 | - if(${'feature_' . $features_counter} != ''){ | |
| 246 | - $featured_list = $featured_list .'<li class="'.$features_line_list.'" style="color:'.$features_color.';padding:'.$features_spacing.';'.$features_line_list_color.'"><i '.$features_icon_color.' class="fa '.$features_icon.'"></i>'.${'feature_' . $features_counter}.'</li>'; | |
| 275 | + while ( $features_counter <= 15 ) { | |
| 276 | + $feature = ${'feature_' . $features_counter}; | |
| 277 | + if ( ! empty( $feature ) ) { | |
| 278 | + $feature_text = esc_html( $feature ); | |
| 279 | + $feature_style = 'color:' . esc_attr( $features_color ) . ';padding:' . esc_attr( $features_spacing ) . ';' . esc_attr( $features_line_list_color_style ); | |
| 280 | + $featured_list .= '<li class="' . esc_attr( $features_line_list_class ) . '" style="' . esc_attr( $feature_style ) . '"><i ' . $features_icon_color_style . ' class="fa ' . esc_attr( $features_icon_class ) . '"></i>' . $feature_text . '</li>'; | |
| 247 | 281 | } |
| 248 | 282 | $features_counter++; |
| 249 | 283 | } |
| 250 | 284 | |
| 251 | 285 | |
| 252 | - $featured_list_content = '<div><ul class="featured-list">'.$featured_list.'</ul></div>'; | |
| 286 | + $featured_list_content = '<div><ul class="featured-list">' . $featured_list . '</ul></div>'; | |
| 253 | 287 | |
| 254 | 288 | |
| 255 | - if($shadow_pricing_table != '') { | |
| 256 | - $shadow_pricing_table = 'shadow-pricing'; | |
| 289 | + if ( ! empty( $shadow_pricing_table ) ) { | |
| 290 | + $shadow_pricing_table_class = 'shadow-pricing'; | |
| 291 | + } else { | |
| 292 | + $shadow_pricing_table_class = ''; | |
| 257 | 293 | } |
| 258 | 294 | |
| 259 | 295 | //Button |
| 260 | 296 | |
| 261 | 297 | $link = vc_build_link( $button_link ); |
| 298 | + $button_url = isset( $link['url'] ) ? esc_url( $link['url'] ) : '#'; | |
| 262 | 299 | |
| 263 | - if( $button_shape == 'rounded' || $button_shape == 'square' || $button_shape == 'round' ){ | |
| 264 | - $button_background_color = $button_background_color ? 'background-color:'.$button_background_color.';' : 'background-color:'.$borderless_primary_color.';'; //Background Color | |
| 300 | + if ( in_array( $button_shape, array( 'rounded', 'square', 'round' ) ) ) { | |
| 301 | + $button_background_style = ! empty( $button_background_color ) ? 'background-color:' . esc_attr( $button_background_color ) . ';' : 'background-color:' . esc_attr( $borderless_primary_color ) . ';'; //Background Color | |
| 265 | 302 | } else { |
| 266 | - $button_background_color = $button_background_color ? 'border-width: 2px;border-style: solid;border-color:'.$button_background_color.';' : 'border-width: 2px;border-style: solid;border-color:'.$borderless_primary_color.';'; //Border Color | |
| 303 | + $button_background_style = ! empty( $button_background_color ) ? 'border-width: 2px;border-style: solid;border-color:' . esc_attr( $button_background_color ) . ';' : 'border-width: 2px;border-style: solid;border-color:' . esc_attr( $borderless_primary_color ) . ';'; //Border Color | |
| 267 | 304 | } |
| 268 | 305 | |
| 269 | - $pricing_button_content = '<div class="'.$button_alignment.'"><a style="'.$button_background_color.' color:'.$button_text_color.';padding:'.$button_extra_size.';" href="'.esc_attr( $link['url'] ).'" class="'.$button_shape.' pricing-button btn '.$button_size.'" role="button">'.$button_title.'</a></div>'; | |
| 306 | + $button_style = $button_background_style . ' color:' . esc_attr( $button_text_color ) . ';padding:' . esc_attr( $button_extra_size ) . ';'; | |
| 270 | 307 | |
| 308 | + $button_class = esc_attr( $button_shape ) . ' pricing-button btn ' . esc_attr( $button_size ); | |
| 309 | + | |
| 310 | + $pricing_button_content = '<div class="' . esc_attr( $button_alignment ) . '"><a style="' . esc_attr( $button_style ) . '" href="' . $button_url . '" class="' . esc_attr( $button_class ) . '" role="button">' . esc_html( $button_title ) . '</a></div>'; | |
| 311 | + | |
| 271 | 312 | //Layout |
| 272 | 313 | |
| 273 | 314 | $layout = 1; |
| 274 | 315 | |
| 275 | - $output .= '<div class="borderless-wpbakery-pricing '.$css_class.' '.$shadow_pricing_table.'">'; | |
| 316 | + $output .= '<div class="borderless-wpbakery-pricing ' . esc_attr( $css_class ) . ' ' . esc_attr( $shadow_pricing_table_class ) . '">'; | |
| 276 | 317 | |
| 277 | - while( $layout <= 6 ){ | |
| 278 | - if(${'area_' . $layout} != '' && ${'area_' . $layout} != 'disable'){ | |
| 318 | + while ( $layout <= 6 ) { | |
| 319 | + $area = ${'area_' . $layout}; | |
| 320 | + if ( ! empty( $area ) && $area != 'disable' ) { | |
| 279 | 321 | |
| 280 | - $data_content = ${'area_' . $layout} . '_content'; | |
| 322 | + $data_content = ${$area . '_content'}; | |
| 281 | 323 | |
| 282 | - $output .= '<div class="'.${'area_' . $layout}.'" style="margin:'.${'margin_area_' . $layout}.';padding:'.${'padding_area_' . $layout}.';background-color:'.${'background_area_' . $layout}.';">'.${$data_content}.'</div>'; | |
| 324 | + $margin = esc_attr( ${'margin_area_' . $layout} ); | |
| 325 | + $padding = esc_attr( ${'padding_area_' . $layout} ); | |
| 326 | + $background_color = esc_attr( ${'background_area_' . $layout} ); | |
| 283 | 327 | |
| 328 | + $style = 'margin:' . $margin . ';padding:' . $padding . ';background-color:' . $background_color . ';'; | |
| 329 | + | |
| 330 | + $output .= '<div class="' . esc_attr( $area ) . '" style="' . esc_attr( $style ) . '">' . $data_content . '</div>'; | |
| 331 | + | |
| 284 | 332 | } |
| 285 | 333 | $layout++; |
| 286 | 334 | } |
| 287 | 335 | |
| @@ -289,8 +337,9 @@ | ||
| 289 | 337 | |
| 290 | 338 | return $output; |
| 291 | 339 | } |
| 292 | 340 | } |
| 341 | + | |
| 293 | 342 | |
| 294 | 343 | return array( |
| 295 | 344 | 'name' => __( 'Pricing', 'borderless' ), |
| 296 | 345 | 'base' => 'borderless_wpbakery_pricing', |