Submit
Path:
~
/
home
/
getwphos
/
www
/
almajd14
/
wp-content
/
plugins
/
halstein-core
/
inc
/
shortcodes
/
countdown
/
File Content:
class-halsteincore-countdown-shortcode.php
<?php if ( ! function_exists( 'halstein_core_add_countdown_shortcode' ) ) { /** * Function that add shortcode into shortcodes list for registration * * @param array $shortcodes * * @return array */ function halstein_core_add_countdown_shortcode( $shortcodes ) { $shortcodes[] = 'HalsteinCore_Countdown_Shortcode'; return $shortcodes; } add_filter( 'halstein_core_filter_register_shortcodes', 'halstein_core_add_countdown_shortcode' ); } if ( class_exists( 'HalsteinCore_Shortcode' ) ) { class HalsteinCore_Countdown_Shortcode extends HalsteinCore_Shortcode { public function __construct() { $this->set_layouts( apply_filters( 'halstein_core_filter_countdown_layouts', array() ) ); parent::__construct(); } public function map_shortcode() { $this->set_shortcode_path( HALSTEIN_CORE_SHORTCODES_URL_PATH . '/countdown' ); $this->set_base( 'halstein_core_countdown' ); $this->set_name( esc_html__( 'Countdown', 'halstein-core' ) ); $this->set_description( esc_html__( 'Shortcode that displays countdown with provided parameters', 'halstein-core' ) ); $options_map = halstein_core_get_variations_options_map( $this->get_layouts() ); $this->set_option( array( 'field_type' => 'select', 'name' => 'layout', 'title' => esc_html__( 'Layout', 'halstein-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' => 'custom_class', 'title' => esc_html__( 'Custom Class', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'date', 'name' => 'date', 'title' => esc_html__( 'Date', 'halstein-core' ), 'description' => esc_html__( 'Enter date in format Y/m/d H:i:s', 'halstein-core' ), // because of the wpbackery ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'week_label', 'title' => esc_html__( 'Week Label', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'week_label_plural', 'title' => esc_html__( 'Week Label Plural', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'day_label', 'title' => esc_html__( 'Day Label', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'day_label_plural', 'title' => esc_html__( 'Day Label Plural', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'hour_label', 'title' => esc_html__( 'Hour Label', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'hour_label_plural', 'title' => esc_html__( 'Hour Label Plural', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'minute_label', 'title' => esc_html__( 'Minute Label', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'minute_label_plural', 'title' => esc_html__( 'Minute Label Plural', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'second_label', 'title' => esc_html__( 'Second Label', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'second_label_plural', 'title' => esc_html__( 'Second Label Plural', 'halstein-core' ), ) ); $this->set_option( array( 'field_type' => 'select', 'name' => 'skin', 'title' => esc_html__( 'Skin', 'halstein-core' ), 'options' => array( '' => esc_html__( 'Default', 'halstein-core' ), 'light' => esc_html__( 'Light', 'halstein-core' ), ), ) ); } public function render( $options, $content = null ) { parent::render( $options ); $atts = $this->get_atts(); $atts['data_attrs'] = $this->get_data_attrs( $atts ); $atts['holder_classes'] = $this->get_holder_classes( $atts ); return halstein_core_get_template_part( 'shortcodes/countdown', 'variations/' . $atts['layout'] . '/templates/countdown', '', $atts ); } private function get_holder_classes( $atts ) { $holder_classes = $this->init_holder_classes(); $holder_classes[] = 'qodef-countdown'; $holder_classes[] = 'qodef-show--5'; $holder_classes[] = ! empty( $atts['skin'] ) ? 'qodef-countdown--' . $atts['skin'] : ''; $holder_classes[] = ! empty( $atts['layout'] ) ? 'qodef-layout--' . $atts['layout'] : ''; return implode( ' ', $holder_classes ); } private function get_data_attrs( $atts ) { $data = array(); if ( ! empty( $atts['date'] ) ) { $date = $atts['date']; $date_formatted = gmdate( 'Y/m/d H:i:s', strtotime( $date ) ); $data['data-date'] = $date_formatted; } $date_formats = array( 'week' => array( 'default' => esc_html__( 'Week', 'halstein-core' ), 'plural' => esc_html__( 'Weeks', 'halstein-core' ), ), 'day' => array( 'default' => esc_html__( 'Day', 'halstein-core' ), 'plural' => esc_html__( 'Days', 'halstein-core' ), ), 'hour' => array( 'default' => esc_html__( 'Hour', 'halstein-core' ), 'plural' => esc_html__( 'Hours', 'halstein-core' ), ), 'minute' => array( 'default' => esc_html__( 'Minute', 'halstein-core' ), 'plural' => esc_html__( 'Minutes', 'halstein-core' ), ), 'second' => array( 'default' => esc_html__( 'Second', 'halstein-core' ), 'plural' => esc_html__( 'Seconds', 'halstein-core' ), ), ); foreach ( $date_formats as $key => $value ) { if ( ! empty( $atts[ $key . '_label' ] ) ) { $data[ 'data-' . $key . '-label' ] = $atts[ $key . '_label' ]; } else { $data[ 'data-' . $key . '-label' ] = $value['default']; } if ( ! empty( $atts[ $key . '_label_plural' ] ) ) { $data[ 'data-' . $key . '-label-plural' ] = $atts[ $key . '_label_plural' ]; } else { $data[ 'data-' . $key . '-label-plural' ] = $value['plural']; } } return $data; } } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
assets
---
0755
variations
---
0755
class-halsteincore-countdown-shortcode-elementor.php
380 bytes
0644
class-halsteincore-countdown-shortcode.php
6501 bytes
0644
include.php
244 bytes
0644
N4ST4R_ID | Naxtarrr