'', 'after' => '', 'start' => '50', 'mode' => 'slider', 'orientation' => 'horizontal', 'label_before' => '', 'label_after' => '', 'divider_color' => '#ffffff', 'hover' => '0', 'animate' => '0', 'css_class' => '', ), $atts, 'bfas_before_after_slider' ); $before_url = esc_url( $atts['before'] ); $after_url = esc_url( $atts['after'] ); if ( empty( $before_url ) || empty( $after_url ) ) { return ''; } wp_enqueue_style( 'bfas-frontend' ); wp_enqueue_script( 'bfas-frontend' ); return $this->build_html( $atts, $before_url, $after_url ); } /** * Get allowed HTML for wp_kses when outputting the slider SVG handle. * * @return array */ public static function get_kses_allowed_svg() { return array( 'svg' => array( 'class' => array(), 'xmlns' => array(), 'viewbox' => array(), 'fill' => array(), 'stroke' => array(), 'stroke-width' => array(), 'stroke-linecap' => array(), 'stroke-linejoin' => array(), ), 'polyline' => array( 'points' => array(), ), ); } /** * Get allowed HTML for wp_kses when outputting the full slider markup. * * @return array */ public static function get_kses_allowed_html() { return array( 'div' => array( 'class' => array(), 'data-bfas-start' => array(), 'data-bfas-hover' => array(), 'data-bfas-animate' => array(), 'style' => array(), ), 'img' => array( 'src' => array(), 'alt' => array(), ), 'span' => array( 'class' => array(), ), 'svg' => array( 'class' => array(), 'xmlns' => array(), 'viewbox' => array(), 'fill' => array(), 'stroke' => array(), 'stroke-width' => array(), 'stroke-linecap' => array(), 'stroke-linejoin' => array(), ), 'polyline' => array( 'points' => array(), ), ); } /** * Build the slider HTML markup. * * @param array $atts Sanitized attributes. * @param string $before_url Before image URL. * @param string $after_url After image URL. * @return string */ public function build_html( $atts, $before_url, $after_url ) { $is_vertical = ( 'vertical' === sanitize_text_field( $atts['orientation'] ) ); $mode = sanitize_text_field( $atts['mode'] ); $is_reveal = ( 'reveal' === $mode ); $start = max( 0, min( 100, absint( $atts['start'] ) ) ); $hover = ( '1' === $atts['hover'] ) ? '1' : '0'; $animate = ( '1' === $atts['animate'] ) ? '1' : '0'; $divider_color = sanitize_hex_color( $atts['divider_color'] ); $css_class = sanitize_html_class( $atts['css_class'] ); if ( empty( $divider_color ) ) { $divider_color = '#ffffff'; } $classes = 'bfas-container'; if ( $is_vertical ) { $classes .= ' bfas-vertical'; } if ( $is_reveal ) { $classes .= ' bfas-reveal'; } if ( ! empty( $css_class ) ) { $classes .= ' ' . $css_class; } $label_before = sanitize_text_field( $atts['label_before'] ); $label_after = sanitize_text_field( $atts['label_after'] ); $arrow_svg = ''; if ( $is_vertical ) { $arrow_svg .= ''; } else { $arrow_svg .= ''; } $arrow_svg .= ''; ob_start(); ?>
<?php esc_attr_e( 'After', '2fox4-before-after' ); ?>
<?php esc_attr_e( 'Before', '2fox4-before-after' ); ?>