PATH:
home
/
lab2454c
/
fcxpro.com
/
wp-content
/
plugins
/
webon-core
/
inc
/
shortcodes
/
section-title
<?php if ( ! function_exists( 'webon_core_add_section_title_shortcode' ) ) { /** * Function that add shortcode into shortcodes list for registration * * @param array $shortcodes * * @return array */ function webon_core_add_section_title_shortcode( $shortcodes ) { $shortcodes[] = 'WebOnCoreSectionTitleShortcode'; return $shortcodes; } add_filter( 'webon_core_filter_register_shortcodes', 'webon_core_add_section_title_shortcode' ); } if ( class_exists( 'WebOnCoreShortcode' ) ) { class WebOnCoreSectionTitleShortcode extends WebOnCoreShortcode { public function map_shortcode() { $this->set_shortcode_path( WEBON_CORE_SHORTCODES_URL_PATH . '/section-title' ); $this->set_base( 'webon_core_section_title' ); $this->set_name( esc_html__( 'Section Title', 'webon-core' ) ); $this->set_description( esc_html__( 'Shortcode that adds section title 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' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'tagline', 'title' => esc_html__( 'Tagline', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'color', 'name' => 'tagline_color', 'title' => esc_html__( 'Tagline Color', 'webon-core' ), 'group' => esc_html__( 'Tagline Style', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'title', 'title' => esc_html__( 'Title', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'line_break_positions', 'title' => esc_html__( 'Positions of Line Break', 'webon-core' ), 'description' => esc_html__( 'Enter the positions of the words after which you would like to create a line break. Separate the positions with commas (e.g. if you would like the first, third, and fourth word to have a line break, you would enter "1,3,4")', 'webon-core' ), 'group' => esc_html__( 'Title Style', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'select', 'name' => 'disable_title_break_words', 'title' => esc_html__( 'Disable Title Line Break', 'webon-core' ), 'description' => esc_html__( 'Enabling this option will disable title line breaks for screen size 1024 and lower', 'webon-core' ), 'options' => webon_core_get_select_type_options_pool( 'no_yes', false ), 'default_value' => 'no', 'group' => esc_html__( 'Title Style', 'webon-core' ) ) ); $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' => 'h2', 'group' => esc_html__( 'Title Style', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'color', 'name' => 'title_color', 'title' => esc_html__( 'Title Color', 'webon-core' ), 'group' => esc_html__( 'Title Style', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'title_margin_top', 'title' => esc_html__( 'Title Margin Top', 'webon-core' ), 'group' => esc_html__( 'Title Style', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'textarea', 'name' => 'section_text', 'title' => esc_html__( 'Text', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'text_line_break_positions', 'title' => esc_html__( 'Positions of Text Line Break', 'webon-core' ), 'description' => esc_html__( 'Enter the positions of the words after which you would like to create a line break. Separate the positions with commas (e.g. if you would like the first, third, and fourth word to have a line break, you would enter "1,3,4")', 'webon-core' ), 'group' => esc_html__( 'Text Style', 'webon-core' ), ) ); $this->set_option( array( 'field_type' => 'select', 'name' => 'disable_text_break_words', 'title' => esc_html__( 'Disable Text Line Break', 'webon-core' ), 'description' => esc_html__( 'Enabling this option will disable text line breaks for screen size 1024 and lower', 'webon-core' ), 'options' => webon_core_get_select_type_options_pool( 'no_yes', false ), 'default_value' => 'no', 'group' => esc_html__( 'Text Style', 'webon-core' ), ) ); $this->set_option( array( 'field_type' => 'color', 'name' => 'text_color', 'title' => esc_html__( 'Text Color', 'webon-core' ), 'group' => esc_html__( 'Text Style', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'text_margin_top', 'title' => esc_html__( 'Text Margin Top', 'webon-core' ), 'group' => esc_html__( 'Text Style', 'webon-core' ) ) ); $this->set_option( array( 'field_type' => 'select', 'name' => 'content_alignment', 'title' => esc_html__( 'Content Alignment', 'webon-core' ), 'options' => array( '' => esc_html__( 'Default', 'webon-core' ), 'left' => esc_html__( 'Left', 'webon-core' ), 'center' => esc_html__( 'Center', 'webon-core' ), 'right' => esc_html__( 'Right', 'webon-core' ) ), ) ); $this->set_option( array( 'field_type' => 'select', 'name' => 'skin', 'title' => esc_html__( 'Light Skin', 'webon-core' ), 'options' => webon_core_get_select_type_options_pool( 'no_yes', false ) ) ); $this->import_shortcode_options( array( 'shortcode_base' => 'webon_core_button', 'exclude' => array( 'custom_class' ), 'additional_params' => array( 'group' => esc_html__( 'Button', 'webon-core' ), ) ) ); } public function render( $options, $content = null ) { parent::render( $options ); $atts = $this->get_atts(); $atts['holder_classes'] = $this->get_holder_classes( $atts ); $atts['button_params'] = $this->generate_button_params( $atts ); $atts['title'] = $this->get_modified_title( $atts ); $atts['tagline_styles'] = $this->get_tagline_styles( $atts ); $atts['title_styles'] = $this->get_title_styles( $atts ); $atts['section_text'] = $this->get_modified_text( $atts ); $atts['text_styles'] = $this->get_text_styles( $atts ); return webon_core_get_template_part( 'shortcodes/section-title', 'templates/section-title', '', $atts ); } private function get_holder_classes( $atts ) { $holder_classes = $this->init_holder_classes(); $holder_classes[] = 'qodef-section-title'; $holder_classes[] = ! empty( $atts['content_alignment'] ) ? 'qodef-alignment--' . $atts['content_alignment'] : 'qodef-alignment--left'; $holder_classes[] = $atts['disable_title_break_words'] === 'yes' ? 'qodef-title-break--disabled' : ''; $holder_classes[] = $atts['disable_text_break_words'] === 'yes' ? 'qodef-text-break--disabled' : ''; $holder_classes[] = $atts['skin'] === 'yes' ? 'qodef-skin--light' : ''; return implode( ' ', $holder_classes ); } private function generate_button_params( $atts ) { $params = $this->populate_imported_shortcode_atts( array( 'shortcode_base' => 'webon_core_button', 'exclude' => array( 'custom_class' ), 'atts' => $atts, ) ); return $params; } private function get_modified_title( $atts ) { $title = $atts['title']; if ( ! empty( $title ) && ! empty( $atts['line_break_positions'] ) ) { $split_title = explode( ' ', $title ); $line_break_positions = explode( ',', str_replace( ' ', '', $atts['line_break_positions'] ) ); foreach ( $line_break_positions as $position ) { $position = intval( $position ); if ( isset( $split_title[ $position - 1 ] ) && ! empty( $split_title[ $position - 1 ] ) ) { $split_title[ $position - 1 ] = $split_title[ $position - 1 ] . '<br />'; } } $title = implode( ' ', $split_title ); } return $title; } private function get_tagline_styles( $atts ) { $styles = array(); if ( ! empty( $atts['tagline_color'] ) ) { $styles[] = 'color: ' . $atts['tagline_color']; } return $styles; } private function get_title_styles( $atts ) { $styles = array(); if ( $atts['title_margin_top'] !== '' ) { if ( qode_framework_string_ends_with_space_units( $atts['title_margin_top'] ) ) { $styles[] = 'margin-top: ' . $atts['title_margin_top']; } else { $styles[] = 'margin-top: ' . intval( $atts['title_margin_top'] ) . 'px'; } } if ( ! empty( $atts['title_color'] ) ) { $styles[] = 'color: ' . $atts['title_color']; } return $styles; } private function get_modified_text( $atts ) { $text = $atts['section_text']; if ( ! empty( $text ) && ! empty( $atts['text_line_break_positions'] ) ) { $split_text = explode( ' ', $text ); $line_break_positions = explode( ',', str_replace( ' ', '', $atts['text_line_break_positions'] ) ); foreach ( $line_break_positions as $position ) { $position = intval( $position ); if ( isset( $split_text[ $position - 1 ] ) && ! empty( $split_text[ $position - 1 ] ) ) { $split_text[ $position - 1 ] = $split_text[ $position - 1 ] . '<br />'; } } $text = implode( ' ', $split_text ); } return $text; } private function get_text_styles( $atts ) { $styles = array(); if ( $atts['text_margin_top'] !== '' ) { if ( qode_framework_string_ends_with_space_units( $atts['text_margin_top'] ) ) { $styles[] = 'margin-top: ' . $atts['text_margin_top']; } else { $styles[] = 'margin-top: ' . intval( $atts['text_margin_top'] ) . 'px'; } } if ( ! empty( $atts['text_color'] ) ) { $styles[] = 'color: ' . $atts['text_color']; } return $styles; } } }
[+]
..
[-] section-title.php
[edit]
[-] section-title-elementor.php
[edit]
[+]
templates
[-] include.php
[edit]
[+]
assets