Submit
Path:
~
/
home
/
getwphos
/
www
/
almajd14
/
wp-content
/
plugins
/
halstein-core
/
inc
/
shortcodes
/
separator
/
File Content:
class-halsteincore-separator-shortcode.php
<?php if ( ! function_exists( 'halstein_core_add_separator_shortcode' ) ) { /** * Function that add shortcode into shortcodes list for registration * * @param array $shortcodes * * @return array */ function halstein_core_add_separator_shortcode( $shortcodes ) { $shortcodes[] = 'HalsteinCore_Separator_Shortcode'; return $shortcodes; } add_filter( 'halstein_core_filter_register_shortcodes', 'halstein_core_add_separator_shortcode', 9 ); } if ( class_exists( 'HalsteinCore_Shortcode' ) ) { class HalsteinCore_Separator_Shortcode extends HalsteinCore_Shortcode { public function map_shortcode() { $this->set_shortcode_path( HALSTEIN_CORE_SHORTCODES_URL_PATH . '/separator' ); $this->set_base( 'halstein_core_separator' ); $this->set_name( esc_html__( 'Separator', 'halstein-core' ) ); $this->set_description( esc_html__( 'Shortcode that displays separator with provided parameters', 'halstein-core' ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'custom_class', 'title' => esc_html__( 'Custom Class', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'select', 'name' => 'position', 'title' => esc_html__( 'Position', 'halstein-core' ), 'options' => array( '' => esc_html__( 'Default', 'halstein-core' ), 'center' => esc_html__( 'Center', 'halstein-core' ), 'left' => esc_html__( 'Left', 'halstein-core' ), 'right' => esc_html__( 'Right', 'halstein-core' ), ), ) ); $this->set_option( array( 'field_type' => 'color', 'name' => 'color', 'title' => esc_html__( 'Color', 'halstein-core' ), 'group' => esc_html__( 'Style', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'select', 'name' => 'border_style', 'title' => esc_html__( 'Border Style', 'halstein-core' ), 'options' => halstein_core_get_select_type_options_pool( 'border_style' ), 'group' => esc_html__( 'Style', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'width', 'title' => esc_html__( 'Width (px or %)', 'halstein-core' ), 'group' => esc_html__( 'Style', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'thickness', 'title' => esc_html__( 'Thickness (px)', 'halstein-core' ), 'group' => esc_html__( 'Style', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'margin_top', 'title' => esc_html__( 'Margin Top (px or %)', 'halstein-core' ), 'group' => esc_html__( 'Style', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'margin_bottom', 'title' => esc_html__( 'Margin Bottom (px or %)', 'halstein-core' ), 'group' => esc_html__( 'Style', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'select', 'name' => 'disable_on_phone', 'title' => esc_html__( 'Disable On Phone', 'halstein-core' ), 'options' => halstein_core_get_select_type_options_pool( 'no_yes', false ), ) ); $this->set_option( array( 'field_type' => 'select', 'name' => 'appear_animation', 'title' => esc_html__( 'Enable Appear Animation', 'halstein-core' ), 'options' => halstein_core_get_select_type_options_pool( 'no_yes', false ), ) ); } public static function call_shortcode( $params ) { $html = qode_framework_call_shortcode( 'halstein_core_separator', $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['separator_styles'] = $this->get_separator_styles( $atts ); return halstein_core_get_template_part( 'shortcodes/separator', 'templates/separator', '', $atts ); } private function get_holder_classes( $atts ) { $holder_classes = $this->init_holder_classes(); $holder_classes[] = 'qodef-separator'; $holder_classes[] = 'clear'; $holder_classes[] = ! empty( $atts['position'] ) ? 'qodef-position--' . $atts['position'] : ''; $holder_classes[] = isset( $atts['disable_on_phone'] ) && ( 'yes' === $atts['disable_on_phone'] ) ? 'qodef-phone--disabled' : ''; $holder_classes[] = ! empty( $atts['appear_animation'] ) && ( 'yes' === $atts['appear_animation'] ) ? 'qodef--has-appear' : ''; return implode( ' ', $holder_classes ); } private function get_separator_styles( $atts ) { $styles = array(); if ( ! empty( $atts['color'] ) ) { $styles[] = 'border-color: ' . $atts['color']; } if ( ! empty( $atts['border_style'] ) ) { $styles[] = 'border-style: ' . $atts['border_style']; } $width = $atts['width']; if ( ! empty( $width ) ) { if ( qode_framework_string_ends_with_space_units( $width ) ) { $styles[] = 'width: ' . $width; } else { $styles[] = 'width: ' . intval( $width ) . 'px'; } } $thickness = $atts['thickness']; if ( ! empty( $thickness ) ) { $styles[] = 'border-bottom-width: ' . intval( $thickness ) . 'px'; } $margin_top = $atts['margin_top']; if ( ! empty( $margin_top ) ) { if ( qode_framework_string_ends_with_space_units( $margin_top ) ) { $styles[] = 'margin-top: ' . $margin_top; } else { $styles[] = 'margin-top: ' . intval( $margin_top ) . 'px'; } } $margin_bottom = $atts['margin_bottom']; if ( ! empty( $margin_bottom ) ) { if ( qode_framework_string_ends_with_space_units( $margin_bottom ) ) { $styles[] = 'margin-bottom: ' . $margin_bottom; } else { $styles[] = 'margin-bottom: ' . intval( $margin_bottom ) . 'px'; } } return implode( ';', $styles ); } } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
assets
---
0755
templates
---
0755
widget
---
0755
class-halsteincore-separator-shortcode-elementor.php
380 bytes
0644
class-halsteincore-separator-shortcode.php
6093 bytes
0644
include.php
109 bytes
0644
N4ST4R_ID | Naxtarrr