Submit
Path:
~
/
home
/
getwphos
/
www
/
twinkletown
/
wp-content
/
plugins
/
wuko-core
/
includes
/
elementor
/
widgets
/
File Content:
wgl-dynamic-title.php
<?php /** * This template can be overridden by copying it to `yourtheme[-child]/wgl-extensions/elementor/widgets/wgl-dynamic-title.php`. */ namespace WGL_Extensions\Widgets; defined('ABSPATH') || exit; // Abort, if called directly. use Elementor\{ Widget_Base, Controls_Manager, Group_Control_Typography, }; class WGL_Dynamic_Title extends Widget_Base { public function get_name() { return 'wgl-dynamic-title'; } public function get_title() { return esc_html__('WGL Dynamic Title', 'wuko-core'); } public function get_icon() { return 'wgl-dynamic-title'; } public function get_categories() { return ['wgl-modules']; } public function get_fields() { $groups = apply_filters('wuko-core/dynamic_title/groups', array( array( 'label' => esc_html__('Post', 'wuko-core'), 'options' => apply_filters( 'wuko-core/dynamic_title/field/post', array( 'post_id' => esc_html__('Post ID', 'wuko-core'), 'post_title' => esc_html__('Title', 'wuko-core'), 'post_name' => esc_html__('Post Slug', 'wuko-core'), 'post_type' => esc_html__('Post Type', 'wuko-core'), 'post_date' => esc_html__('Date', 'wuko-core'), 'post_modified' => esc_html__('Date Modified', 'wuko-core'), 'post_status' => esc_html__('Post Status', 'wuko-core'), ) ) ), array( 'label' => esc_html__('Term', 'wuko-core'), 'options' => apply_filters( 'wuko-core/dynamic_title/field/term', array( 'term_id' => esc_html__('Term ID', 'wuko-core'), 'term_title' => esc_html__('Term Title', 'wuko-core'), 'term_t_n' => esc_html__('Term Title & Name', 'wuko-core'), 'name' => esc_html__('Term name', 'wuko-core'), 'slug' => esc_html__('Term slug', 'wuko-core'), 'description' => esc_html__('Term description', 'wuko-core'), 'count' => esc_html__('Posts count', 'wuko-core'), 'parent' => esc_html__('Parent term ID', 'wuko-core'), ) ) ), )); return $groups; } protected function register_controls() { $this->start_controls_section( 'wgl_dynamic_Title_section', ['label' => esc_html__('Dynamic Settings', 'wuko-core')] ); $this->add_control( 'dynamic_field', array( 'label' => __('Dynamic Field', 'wuko-core'), 'type' => Controls_Manager::SELECT, 'default' => 'term_t_n', 'groups' => $this->get_fields(), ) ); $this->add_control( 'dynamic_title_format', array( 'label' => __('Title format', 'wuko-core'), 'type' => Controls_Manager::TEXTAREA, 'default' => '%s', 'description' => __('%s will be replaced with field dynamic title.', 'wuko-core'), ) ); $this->add_control( 'default_text', [ 'label' => esc_html__('Default text if value is empty', 'wuko-core'), 'type' => Controls_Manager::TEXT, 'dynamic' => ['active' => true], 'label_block' => true, 'placeholder' => esc_attr__('Portfolio', 'wuko-core'), ] ); $this->add_control( 'title_tag', [ 'label' => esc_html__('HTML Tag', 'wuko-core'), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => esc_html('‹h1›'), 'h2' => esc_html('‹h2›'), 'h3' => esc_html('‹h3›'), 'h4' => esc_html('‹h4›'), 'h5' => esc_html('‹h5›'), 'h6' => esc_html('‹h6›'), 'div' => esc_html('‹div›'), 'span' => esc_html('‹span›'), ], 'default' => 'h3', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style', [ 'label' => esc_html__('Dynamic Title Styles', 'wuko-core'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'dynamic_title_type', 'selector' => '{{WRAPPER}} .wgl-dynamic_title', ] ); $this->add_responsive_control( 'dynamic_title_display', [ 'label' => esc_html__( 'Display', 'wuko-core' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'inline' => esc_html__( 'Inline', 'wuko-core' ), 'block' => esc_html__( 'Block', 'wuko-core' ), 'inline-block' => esc_html__( 'Inline Block', 'wuko-core' ), ], 'default' => 'inline', 'selectors' => [ '{{WRAPPER}} .wgl-dynamic_title' => 'display: {{VALUE}};', ], ] ); $this->add_responsive_control( 'dynamic_title_padding', [ 'label' => esc_html__('Padding', 'wuko-core'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .wgl-dynamic_title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->start_controls_tabs('dynamic_title'); $this->start_controls_tab( 'dynamic_title_color', ['label' => esc_html__('Idle', 'wuko-core')] ); $this->add_control( 'dynamic_title_color_idle', [ 'label' => esc_html__('Text Color', 'wuko-core'), 'type' => Controls_Manager::COLOR, 'dynamic' => ['active' => true], 'selectors' => [ '{{WRAPPER}} .wgl-dynamic_title' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'dynamic_title_hover', ['label' => esc_html__('Hover', 'wuko-core')] ); $this->add_control( 'dynamic_title_color_hover', [ 'label' => esc_html__('Text Color', 'wuko-core'), 'type' => Controls_Manager::COLOR, 'dynamic' => ['active' => true], 'selectors' => [ '{{WRAPPER}} .wgl-dynamic_title:hover' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } public function get_current_object() { $obj = false; global $post; if (is_singular()) { $obj = $post; } elseif (is_tax() || is_category() || is_tag() || is_author()) { $obj = get_queried_object(); } elseif (is_archive() || is_home() || is_post_type_archive()) { $obj = $post; } elseif ($post) { $obj = $post; } $obj = apply_filters('wuko-core/dynamic_title/object', $obj, $this); return $obj; } public function get_item($settings = null) { $object = $this->get_current_object(); if (!$object) { return false; } $object_vars = get_object_vars($object); if ('post_id' === $settings && 'WP_Post' === get_class($object)) { $object_vars['post_id'] = $object_vars['ID']; } if (isset($object_vars[$settings])) { return $object_vars[$settings]; } if (is_object($object) && method_exists($object, $settings)) { return call_user_func(array($object, $settings)); } else if (is_object($object) && 'term_title' === $settings && is_tax()) { $tax = get_taxonomy($object->taxonomy); return sprintf( _x('%s:', 'taxonomy term archive title prefix'), $tax->labels->singular_name, 'wuko-core' ); } else if (is_object($object) && 'term_t_n' === $settings && is_tax()) { return get_the_archive_title(); } } protected function render() { $_s = $this->get_settings_for_display(); $dynamic_field = $this->get_item($_s['dynamic_field']); $default_text = $_s['default_text']; $kses_allowed_html = [ 'a' => [ 'href' => true, 'title' => true, 'class' => true, 'style' => true, 'rel' => true, 'target' => true ], 'br' => ['class' => true, 'style' => true], 'em' => ['class' => true, 'style' => true], 'strong' => ['class' => true, 'style' => true], 'span' => ['class' => true, 'style' => true], 'p' => ['class' => true, 'style' => true], 'small' => ['class' => true, 'style' => true] ]; if (!empty($dynamic_field) || !empty($default_text)) { echo '<' . $_s['title_tag'] . ' class="wgl-dynamic_title">'; if(!empty($dynamic_field)){ $this->render_filtered_result($dynamic_field, $_s); }else if(!empty($default_text)){ echo wp_kses($default_text, $kses_allowed_html); } echo '</' . $_s['title_tag'] . '>'; } } public function render_filtered_result($field, $settings) { if (!empty($settings['dynamic_title_format'])) { if (false === strpos($settings['dynamic_title_format'], '%s')) { echo __('<b>Error:</b> the field format must contains "%s"', 'wuko-core'); return; } $field = !is_array($field) && !is_object($field) ? $field : ''; $result = sprintf($settings['dynamic_title_format'], $field); echo $result; } } public function wpml_support_module() { add_filter('wpml_elementor_widgets_to_translate', [$this, 'wpml_widgets_to_translate_filter']); } public function wpml_widgets_to_translate_filter($widgets) { return \WGL_Extensions\Includes\WGL_WPML_Settings::get_translate( $this, $widgets ); } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
wgl-accordion-service.php
110791 bytes
0644
wgl-background-clip-text.php
21249 bytes
0644
wgl-blog.php
54012 bytes
0644
wgl-button-physics.php
48634 bytes
0644
wgl-button-widget.php
78290 bytes
0644
wgl-carousel.php
5648 bytes
0644
wgl-cases.php
174614 bytes
0644
wgl-circuit-service.php
21621 bytes
0644
wgl-clients.php
28542 bytes
0644
wgl-combo-menu.php
17440 bytes
0644
wgl-contact-form-7.php
64476 bytes
0644
wgl-countdown.php
19442 bytes
0644
wgl-counter.php
36515 bytes
0644
wgl-demo-item.php
33716 bytes
0644
wgl-double-heading.php
71788 bytes
0644
wgl-dynamic-title.php
11086 bytes
0644
wgl-flipbox.php
154999 bytes
0644
wgl-gallery.php
53821 bytes
0644
wgl-highlight-board.php
64418 bytes
0644
wgl-horizontal-scroll.php
25075 bytes
0644
wgl-image-animate.php
20947 bytes
0644
wgl-image-comparison.php
6032 bytes
0644
wgl-image-hotspots.php
52892 bytes
0644
wgl-image-layers.php
25243 bytes
0644
wgl-infinity-carousel.php
30821 bytes
0644
wgl-info-box.php
224793 bytes
0644
wgl-instagram.php
38631 bytes
0644
wgl-link-overlay.php
2495 bytes
0644
wgl-pie-chart.php
22332 bytes
0644
wgl-portfolio.php
115147 bytes
0644
wgl-pricing-table.php
209138 bytes
0644
wgl-products-categories.php
51718 bytes
0644
wgl-products-grid.php
79654 bytes
0644
wgl-progress-bar.php
30822 bytes
0644
wgl-rotated-text.php
22605 bytes
0644
wgl-satellite-service.php
35978 bytes
0644
wgl-showcase.php
208669 bytes
0644
wgl-social-icons.php
22240 bytes
0644
wgl-steps.php
48391 bytes
0644
wgl-striped-services.php
183259 bytes
0644
wgl-tabs-horizontal.php
42144 bytes
0644
wgl-tabs.php
53431 bytes
0644
wgl-team.php
36456 bytes
0644
wgl-template.php
8246 bytes
0644
wgl-testimonials.php
61375 bytes
0644
wgl-text-editor.php
55551 bytes
0644
wgl-text-path.php
41438 bytes
0644
wgl-time-line-horizontal.php
37694 bytes
0644
wgl-time-line-vertical.php
199396 bytes
0644
wgl-toggle-accordion.php
66819 bytes
0644
wgl-video-popup.php
30956 bytes
0644
wgl-working-hours.php
10870 bytes
0644
wgl-zoom.php
24854 bytes
0644
N4ST4R_ID | Naxtarrr