PATH:
home
/
lab2454c
/
fcxpro.com
/
wp-content
/
plugins
/
webon-core
/
inc
/
shortcodes
/
video-button
<?php if ( ! function_exists( 'webon_core_add_video_button_shortcode' ) ) { /** * Function that add shortcode into shortcodes list for registration * * @param array $shortcodes * * @return array */ function webon_core_add_video_button_shortcode( $shortcodes ) { $shortcodes[] = 'WebOnCoreVideoButton'; return $shortcodes; } add_filter( 'webon_core_filter_register_shortcodes', 'webon_core_add_video_button_shortcode' ); } if ( class_exists( 'WebOnCoreShortcode' ) ) { class WebOnCoreVideoButton extends WebOnCoreShortcode { public function __construct() { $this->set_layouts( apply_filters( 'webon_core_filter_video_button_layouts', array() ) ); $options_map = webon_core_get_variations_options_map( $this->get_layouts() ); $default_value = $options_map['default_value']; $this->set_extra_options( apply_filters( 'webon_core_filter_vodeo_button_extra_options', array(), $default_value ) ); parent::__construct(); } public function map_shortcode() { $this->set_shortcode_path( WEBON_CORE_SHORTCODES_URL_PATH . '/video-button' ); $this->set_base( 'webon_core_video_button' ); $this->set_name( esc_html__( 'Video Button', 'webon-core' ) ); $this->set_description( esc_html__( 'Shortcode that adds video button element', 'webon-core' ) ); $this->set_category( esc_html__( 'WebOn Core', 'webon-core' ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'custom_class', 'title' => esc_html__( 'Custom Class', 'webon-core' ), ) ); $options_map = webon_core_get_variations_options_map( $this->get_layouts() ); $this->set_option( array( 'field_type' => 'select', 'name' => 'layout', 'title' => esc_html__( 'Layout', 'webon-core' ), 'options' => $this->get_layouts(), 'default_value' => $options_map['default_value'], 'visibility' => array( 'map_for_page_builder' => $options_map['visibility'] ) ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'video_link', 'title' => esc_html__( 'Video Link', 'webon-core' ), ) ); $this->set_option( array( 'field_type' => 'image', 'name' => 'video_image', 'title' => esc_html__( 'Image', 'webon-core' ), 'description'=> esc_html__( 'Select image from media library', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'color', 'name' => 'play_button_color', 'title' => esc_html__( 'Play Button Color', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'play_button_size', 'title' => esc_html__( 'Play Button Size (px)', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'color', 'name' => 'background_color', 'title' => esc_html__( 'Background Color', 'webon-core' ), 'dependency' => array( 'show' => array( 'layout' => array( 'values' => 'standard', 'default_value' => '' ) ) ) ) ); $this->set_option( array( 'field_type' => 'color', 'name' => 'border_color', 'title' => esc_html__( 'Border Color', 'webon-core' ), 'dependency' => array( 'show' => array( 'layout' => array( 'values' => 'with-text', 'default_value' => '' ) ) ) ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'tagline', 'title' => esc_html__( 'Tagline', 'webon-core' ), 'dependency' => array( 'show' => array( 'layout' => array( 'values' => 'with-text', 'default_value' => '' ) ) ) ) ); $this->set_option( array( 'field_type' => 'color', 'name' => 'tagline_color', 'title' => esc_html__( 'Tagline Color', 'webon-core' ), 'dependency' => array( 'show' => array( 'layout' => array( 'values' => 'with-text', 'default_value' => '' ) ) ) ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'title', 'title' => esc_html__( 'Title', 'webon-core' ), 'dependency' => array( 'show' => array( 'layout' => array( 'values' => 'with-text', 'default_value' => '' ) ) ) ) ); $this->set_option( array( 'field_type' => 'select', 'name' => 'title_tag', 'title' => esc_html__( 'Title Tag', 'webon-core' ), 'options' => webon_core_get_select_type_options_pool( 'title_tag' ), 'default_value' => 'h3', 'dependency' => array( 'show' => array( 'layout' => array( 'values' => 'with-text', 'default_value' => '' ) ) ) ) ); $this->set_option( array( 'field_type' => 'color', 'name' => 'title_color', 'title' => esc_html__( 'Title Color', 'webon-core' ), 'dependency' => array( 'show' => array( 'layout' => array( 'values' => 'with-text', 'default_value' => '' ) ) ) ) ); } public static function call_shortcode( $params ) { $html = qode_framework_call_shortcode( 'webon_core_video_button', $params ); $html = str_replace( "\n", '', $html ); return $html; } public function render( $options, $content = null ) { parent::render( $options ); $atts = $this->get_atts(); $atts['holder_classes'] = $this->get_holder_classes( $atts ); $atts['play_button_styles'] = $this->get_play_button_styles( $atts ); $atts['tagline_styles'] = $this->get_tagline_styles( $atts ); $atts['title_styles'] = $this->get_title_styles( $atts ); $atts['border_styles'] = $this->get_border_styles( $atts ); $atts['circle_styles'] = $this->get_circle_styles( $atts ); return webon_core_get_template_part( 'shortcodes/video-button', 'variations/' . $atts['layout'] . '/templates/' . $atts['layout'], '', $atts ); } private function get_holder_classes( $atts ) { $holder_classes = $this->init_holder_classes(); $holder_classes[] = 'qodef-video-button'; $holder_classes[] = ! empty( $atts['layout'] ) ? 'qodef-layout--' . $atts['layout'] : ''; $holder_classes[] = ! empty( $atts['video_image'] ) ? 'qodef--has-img' : ''; return implode( ' ', $holder_classes ); } private function get_play_button_styles( $atts ) { $styles = array(); if ( ! empty( $atts['play_button_color'] ) ) { $styles[] = 'color: ' . $atts['play_button_color']; } if ( ! empty( $atts['play_button_size'] ) ) { if ( qode_framework_string_ends_with_typography_units( $atts['play_button_size'] ) ) { $styles[] = 'font-size: ' . $atts['play_button_size']; } else { $styles[] = 'font-size: ' . intval( $atts['play_button_size'] ) . 'px'; } } return implode( ';', $styles ); } private function get_tagline_styles( $atts ) { $styles = array(); if ( ! empty( $atts['tagline_color'] ) ) { $styles[] = 'color: ' . $atts['tagline_color']; } return implode( ';', $styles ); } private function get_title_styles( $atts ) { $styles = array(); if ( ! empty( $atts['title_color'] ) ) { $styles[] = 'color: ' . $atts['title_color']; } return implode( ';', $styles ); } private function get_border_styles( $atts ) { $styles = array(); if ( ! empty( $atts['border_color'] ) ) { $styles[] = 'border-color: ' . $atts['border_color']; } return implode( ';', $styles ); } private function get_circle_styles( $atts ) { $styles = array(); if ( ! empty( $atts['background_color'] ) ) { $styles[] = 'background-color: ' . $atts['background_color']; } return implode( ';', $styles ); } } }
[-] video-button.php
[edit]
[+]
..
[-] video-button-elementor.php
[edit]
[+]
variations
[+]
templates
[-] include.php
[edit]
[+]
assets