Submit
Path:
~
/
home
/
getwphos
/
www
/
BenjaminMarc-Struktur
/
wp-content
/
plugins
/
struktur-core
/
shortcodes
/
section-title
/
File Content:
section-title.php
<?php namespace StrukturCore\CPT\Shortcodes\SectionTitle; use StrukturCore\Lib; class SectionTitle implements Lib\ShortcodeInterface { private $base; function __construct() { $this->base = 'qodef_section_title'; add_action( 'vc_before_init', array( $this, 'vcMap' ) ); } public function getBase() { return $this->base; } public function vcMap() { if ( function_exists( 'vc_map' ) ) { vc_map( array( 'name' => esc_html__( 'Section Title', 'struktur-core' ), 'base' => $this->base, 'category' => esc_html__( 'by STRUKTUR', 'struktur-core' ), 'icon' => 'icon-wpb-section-title extended-custom-icon', 'allowed_container_element' => 'vc_row', 'params' => array( array( 'type' => 'textfield', 'param_name' => 'custom_class', 'heading' => esc_html__( 'Custom CSS Class', 'struktur-core' ), 'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS', 'struktur-core' ) ), array( 'type' => 'dropdown', 'param_name' => 'title_type', 'heading' => esc_html__( 'Type', 'struktur-core' ), 'value' => array( esc_html__( 'Standard', 'struktur-core' ) => 'standard', esc_html__( 'Underlined', 'struktur-core' ) => 'underlined' ), 'save_always' => true ), array( 'type' => 'dropdown', 'param_name' => 'position', 'heading' => esc_html__( 'Horizontal Position', 'struktur-core' ), 'value' => array( esc_html__( 'Default', 'struktur-core' ) => '', esc_html__( 'Left', 'struktur-core' ) => 'left', esc_html__( 'Center', 'struktur-core' ) => 'center', esc_html__( 'Right', 'struktur-core' ) => 'right' ), 'save_always' => true ), array( 'type' => 'textfield', 'param_name' => 'holder_padding', 'heading' => esc_html__( 'Holder Side Padding (px or %)', 'struktur-core' ) ), array( 'type' => 'textfield', 'param_name' => 'title', 'heading' => esc_html__( 'Title', 'struktur-core' ), 'admin_label' => true ), array( 'type' => 'dropdown', 'param_name' => 'title_tag', 'heading' => esc_html__( 'Title Tag', 'struktur-core' ), 'value' => array_flip( struktur_select_get_title_tag( true ) ), 'save_always' => true, 'dependency' => array( 'element' => 'title', 'not_empty' => true ), 'group' => esc_html__( 'Title Style', 'struktur-core' ) ), array( 'type' => 'colorpicker', 'param_name' => 'title_color', 'heading' => esc_html__( 'Title Color', 'struktur-core' ), 'dependency' => array( 'element' => 'title', 'not_empty' => true ), 'group' => esc_html__( 'Title Style', 'struktur-core' ) ), array( 'type' => 'textfield', 'param_name' => 'title_font_size', 'heading' => esc_html__( 'Title Font Size (px)', 'struktur-core' ), 'dependency' => array( 'element' => 'title', 'not_empty' => true ), 'group' => esc_html__( 'Title Style', 'struktur-core' ) ), array( 'type' => 'textfield', 'param_name' => 'title_emphasize_words', 'heading' => esc_html__('Emphasize Words', 'struktur-core'), 'description' => esc_html__('Enter the positions of the words you would like to Emphasize. Separate the positions with commas (e.g. if you would like the first, third, and fourth word to be emphasized, you would enter "1,3,4")', 'struktur-core'), 'dependency' => array('element' => 'title', 'not_empty' => true), 'group' => esc_html__('Title Style', 'struktur-core') ), array( 'type' => 'textfield', 'param_name' => 'title_break_words', 'heading' => esc_html__( 'Position of Line Break', 'struktur-core' ), 'description' => esc_html__( 'Enter the position of the word after which you would like to create a line break (e.g. if you would like the line break after the 3rd word, you would enter "3")', 'struktur-core' ), 'dependency' => array( 'element' => 'title', 'not_empty' => true ), 'group' => esc_html__( 'Title Style', 'struktur-core' ) ), array( 'type' => 'dropdown', 'param_name' => 'disable_break_words', 'heading' => esc_html__( 'Disable Line Break for Smaller Screens', 'struktur-core' ), 'value' => array_flip( struktur_select_get_yes_no_select_array( false ) ), 'save_always' => true, 'dependency' => array( 'element' => 'title', 'not_empty' => true ), 'group' => esc_html__( 'Title Style', 'struktur-core' ) ), array( 'type' => 'textarea', 'param_name' => 'text', 'heading' => esc_html__( 'Text', 'struktur-core' ) ), array( 'type' => 'dropdown', 'param_name' => 'text_tag', 'heading' => esc_html__( 'Text Tag', 'struktur-core' ), 'value' => array_flip( struktur_select_get_title_tag( true, array( 'p' => 'p' ) ) ), 'save_always' => true, 'dependency' => array( 'element' => 'text', 'not_empty' => true ), 'group' => esc_html__( 'Text Style', 'struktur-core' ) ), array( 'type' => 'colorpicker', 'param_name' => 'text_color', 'heading' => esc_html__( 'Text Color', 'struktur-core' ), 'dependency' => array( 'element' => 'text', 'not_empty' => true ), 'group' => esc_html__( 'Text Style', 'struktur-core' ) ), array( 'type' => 'textfield', 'param_name' => 'text_font_size', 'heading' => esc_html__( 'Text Font Size (px)', 'struktur-core' ), 'dependency' => array( 'element' => 'text', 'not_empty' => true ), 'group' => esc_html__( 'Text Style', 'struktur-core' ) ), array( 'type' => 'textfield', 'param_name' => 'text_line_height', 'heading' => esc_html__( 'Text Line Height (px)', 'struktur-core' ), 'dependency' => array( 'element' => 'text', 'not_empty' => true ), 'group' => esc_html__( 'Text Style', 'struktur-core' ) ), array( 'type' => 'dropdown', 'param_name' => 'text_font_weight', 'heading' => esc_html__( 'Text Font Weight', 'struktur-core' ), 'value' => array_flip( struktur_select_get_font_weight_array( true ) ), 'save_always' => true, 'dependency' => array( 'element' => 'text', 'not_empty' => true ), 'group' => esc_html__( 'Text Style', 'struktur-core' ) ), array( 'type' => 'textfield', 'param_name' => 'text_margin', 'heading' => esc_html__( 'Text Top Margin (px)', 'struktur-core' ), 'dependency' => array( 'element' => 'text', 'not_empty' => true ), 'group' => esc_html__( 'Text Style', 'struktur-core' ) ), array( 'type' => 'textfield', 'param_name' => 'button_text', 'heading' => esc_html__( 'Button Text', 'struktur-core' ) ), array( 'type' => 'textfield', 'param_name' => 'button_link', 'heading' => esc_html__( 'Button Link', 'struktur-core' ), 'group' => esc_html__( 'Button Style', 'struktur-core' ) ), array( 'type' => 'dropdown', 'param_name' => 'button_target', 'heading' => esc_html__( 'Button Link Target', 'struktur-core' ), 'value' => array_flip( struktur_select_get_link_target_array() ), 'group' => esc_html__( 'Button Style', 'struktur-core' ) ), array( 'type' => 'colorpicker', 'param_name' => 'button_color', 'heading' => esc_html__( 'Button Color', 'struktur-core' ), 'group' => esc_html__( 'Button Style', 'struktur-core' ) ), array( 'type' => 'colorpicker', 'param_name' => 'button_hover_color', 'heading' => esc_html__( 'Button Hover Color', 'struktur-core' ), 'group' => esc_html__( 'Button Style', 'struktur-core' ) ), array( 'type' => 'textfield', 'param_name' => 'button_top_margin', 'heading' => esc_html__( 'Button Top Margin (px)', 'struktur-core' ), 'group' => esc_html__( 'Button Style', 'struktur-core' ) ) ) ) ); } } public function render( $atts, $content = null ) { $args = array( 'custom_class' => '', 'position' => '', 'title_type' => 'standard', 'holder_padding' => '', 'title' => '', 'title_tag' => 'h2', 'title_font_size' => '', 'title_color' => '', 'title_emphasize_words' => '', 'title_break_words' => '', 'disable_break_words' => '', 'text' => '', 'text_tag' => 'p', 'text_color' => '', 'text_font_size' => '', 'text_line_height' => '', 'text_font_weight' => '', 'text_margin' => '', 'button_text' => '', 'button_link' => '', 'button_target' => '_self', 'button_color' => '', 'button_hover_color' => '', 'button_top_margin' => '' ); $params = shortcode_atts( $args, $atts ); $params['holder_classes'] = $this->getHolderClasses( $params, $args ); $params['holder_styles'] = $this->getHolderStyles( $params ); $params['title'] = $this->getModifiedTitle( $params ); $params['title_tag'] = ! empty( $params['title_tag'] ) ? $params['title_tag'] : $args['title_tag']; $params['title_styles'] = $this->getTitleStyles( $params ); $params['text_tag'] = ! empty( $params['text_tag'] ) ? $params['text_tag'] : $args['text_tag']; $params['text_styles'] = $this->getTextStyles( $params ); $params['button_parameters'] = $this->getButtonParameters( $params ); $html = struktur_core_get_shortcode_module_template_part( 'templates/section-title', 'section-title', '', $params ); return $html; } private function getHolderClasses( $params, $args ) { $holderClasses = array(); $holderClasses[] = ! empty( $params['custom_class'] ) ? esc_attr( $params['custom_class'] ) : ''; $holderClasses[] = $params['disable_break_words'] === 'yes' ? 'qodef-st-disable-title-break' : ''; if (!empty($params['title_type'])) { if ($params['title_type'] === 'standard') { $holderClasses[] = 'qodef-st-standard'; } else { $holderClasses[] = 'qodef-st-underlined'; } } return implode( ' ', $holderClasses ); } private function getHolderStyles( $params ) { $styles = array(); if ( ! empty( $params['holder_padding'] ) ) { $styles[] = 'padding: 0 ' . $params['holder_padding']; } if ( ! empty( $params['position'] ) ) { $styles[] = 'text-align: ' . $params['position']; } return implode( ';', $styles ); } private function getModifiedTitle( $params ) { $title = $params['title']; $title_emphasize_words = str_replace(' ', '', $params['title_emphasize_words']); $title_break_words = str_replace( ' ', '', $params['title_break_words'] ); if ( ! empty( $title ) ) { $emphasize_words = explode(',', $title_emphasize_words); $split_title = explode( ' ', $title ); if (!empty($title_emphasize_words)) { foreach ($emphasize_words as $value) { $value = intval($value); if (!empty($split_title[$value - 1])) { $split_title[$value - 1] = '<span class="qodef-st-title-emphasize"><span>'.$split_title[$value - 1].'</span><span>' . $split_title[$value - 1] . '</span></span>'; } } } if ( ! empty( $title_break_words ) ) { $title_break_words = intval($title_break_words); if ( ! empty( $split_title[ $title_break_words - 1 ] ) ) { $split_title[ $title_break_words - 1 ] = $split_title[ $title_break_words - 1 ] . '<br />'; } } $title = implode( ' ', $split_title ); } return $title; } private function getTitleStyles( $params ) { $styles = array(); if ( ! empty( $params['title_color'] ) ) { $styles[] = 'color: ' . $params['title_color']; } if ( ! empty( $params['title_font_size'] ) ) { $styles[] = 'font-size: ' . struktur_select_filter_px( $params['title_font_size'] ) . 'px'; } return implode( ';', $styles ); } private function getTextStyles( $params ) { $styles = array(); if ( ! empty( $params['text_color'] ) ) { $styles[] = 'color: ' . $params['text_color']; } if ( ! empty( $params['text_font_size'] ) ) { $styles[] = 'font-size: ' . struktur_select_filter_px( $params['text_font_size'] ) . 'px'; } if ( ! empty( $params['text_line_height'] ) ) { $styles[] = 'line-height: ' . struktur_select_filter_px( $params['text_line_height'] ) . 'px'; } if ( ! empty( $params['text_font_weight'] ) ) { $styles[] = 'font-weight: ' . $params['text_font_weight']; } if ( $params['text_margin'] !== '' ) { $styles[] = 'margin-top: ' . struktur_select_filter_px( $params['text_margin'] ) . 'px'; } return implode( ';', $styles ); } private function getButtonParameters( $params ) { $button_params = array(); if ( ! empty( $params['button_text'] ) ) { $button_params['text'] = $params['button_text']; $button_params['type'] = 'simple'; $button_params['link'] = ! empty( $params['button_link'] ) ? $params['button_link'] : '#'; $button_params['target'] = ! empty( $params['button_target'] ) ? $params['button_target'] : '_self'; if ( ! empty( $params['button_color'] ) ) { $button_params['color'] = $params['button_color']; } if ( ! empty( $params['button_hover_color'] ) ) { $button_params['hover_color'] = $params['button_hover_color']; } if ( $params['button_top_margin'] !== '' ) { $button_params['margin'] = intval( $params['button_top_margin'] ) . 'px 0 0'; } } return $button_params; } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
assets
---
0755
templates
---
0755
elementor-section-title.php
15499 bytes
0644
functions.php
1076 bytes
0644
load.php
164 bytes
0644
section-title.php
14365 bytes
0644
N4ST4R_ID | Naxtarrr