| Server IP : 198.38.94.67 / Your IP : 216.73.217.178 Web Server : LiteSpeed System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64 User : azfilmst ( 1070) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/azfilmst/public_html/wp-content/plugins/haru-frames/includes/widgets/ |
Upload File : |
<?php
/**
* @package HaruTheme/Haru Frames
* @version 1.0.0
* @author Administrator <admin@harutheme.com>
* @copyright Copyright (c) 2017, HaruTheme
* @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
* @link http://harutheme.com
*/
namespace Haru_Frames\Widgets;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
use \Elementor\Widget_Base;
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Typography;
use \Elementor\Group_Control_Text_Shadow;
use \Haru_Frames\Classes\Haru_Template;
if ( ! class_exists( 'Haru_Frames_Heading_Widget' ) ) {
class Haru_Frames_Heading_Widget extends Widget_Base {
public function get_name() {
return 'haru-heading';
}
public function get_title() {
return esc_html__( 'Haru Heading', 'haru-frames' );
}
public function get_icon() {
return 'eicon-t-letter';
}
public function get_categories() {
return [ 'haru-elements', 'haru-footer-elements' ];
}
public function get_keywords() {
return [
'heading',
'title',
];
}
public function get_custom_help_url() {
return 'https://document.harutheme.com/elementor/';
}
protected function register_controls() {
$this->start_controls_section(
'section_settings',
[
'label' => __( 'Heading Settings', 'haru-frames' ),
]
);
$this->add_control(
'pre_style',
[
'label' => __( 'Pre Heading', 'haru-frames' ),
'description' => __( 'If you choose Pre Heading you will use Style default from our theme.', 'haru-frames' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => [
'none' => __( 'None', 'haru-frames' ),
'footer-1' => __( 'Pre Footer 1', 'haru-frames' ),
'footer-2' => __( 'Pre Footer 2', 'haru-frames' ),
'footer-3' => __( 'Pre Footer 3', 'haru-frames' ),
'footer-copyright-1' => __( 'Pre Footer Copyright 1', 'haru-frames' ),
'footer-copyright-2' => __( 'Pre Footer Copyright 2', 'haru-frames' ),
'notice-1' => __( 'Pre Notice 1', 'haru-frames' ),
'heading-1' => __( 'Pre Heading 1 (48px - Primary Font - Bold)', 'haru-frames' ),
'heading-2' => __( 'Pre Heading 2 (48px - Secondary Font - Bold)', 'haru-frames' ),
'heading-3' => __( 'Pre Heading 3 (120px - Secondary Font - Bold)', 'haru-frames' ),
'heading-4' => __( 'Pre Heading 4 (72px - Primary Font - Bold)', 'haru-frames' ),
'heading-5' => __( 'Pre Heading 5 (100px - Primary Font - Bold)', 'haru-frames' ),
'heading-6' => __( 'Pre Heading 6 (48px - Secondary Font - Light)', 'haru-frames' ),
'heading-7' => __( 'Pre Heading 7 (72px - Secondary Font - Bold)', 'haru-frames' ),
'heading-8' => __( 'Pre Heading 8 (34px - Primary Font - Bold)', 'haru-frames' ),
'heading-9' => __( 'Pre Heading 9 (56px - Primary Font - Bold)', 'haru-frames' ),
'sub-heading-1' => __( 'Pre Sub Heading 1 (36px - Secondary Font - Light)', 'haru-frames' ),
'sub-heading-2' => __( 'Pre Sub Heading 2 (36px - Primary Font - Normal)', 'haru-frames' ),
'sub-heading-3' => __( 'Pre Sub Heading 3 (18px - Primary Font - Normal)', 'haru-frames' ),
'sub-heading-4' => __( 'Pre Sub Heading 4 (24px - Primary Font - Normal)', 'haru-frames' ),
'sub-heading-5' => __( 'Pre Sub Heading 5 (16px - Primary Font - Normal)', 'haru-frames' ),
'sub-heading-6' => __( 'Pre Sub Heading 6 (18px - Primary Font - 2nd Color)', 'haru-frames' ),
'sub-heading-7' => __( 'Pre Sub Heading 7 (18px - Primary Font - Bold)', 'haru-frames' ),
'sub-heading-8' => __( 'Pre Sub Heading 8 (24px - Secondary Font - Italic)', 'haru-frames' ),
'sub-heading-9' => __( 'Pre Sub Heading 9 (36px - Secondary Font - Italic)', 'haru-frames' ),
'sub-heading-10' => __( 'Pre Sub Heading 10 (24px - Primary Font - Uppercase)', 'haru-frames' ),
'sub-heading-11' => __( 'Pre Sub Heading 11 (24px - Secondary Font - Italic)', 'haru-frames' ),
'menu-heading-1' => __( 'Pre Menu Heading 1 (24px - Primary Font - Bold)', 'haru-frames' ),
]
]
);
$this->add_control(
'title',
[
'label' => __( 'Title', 'haru-frames' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'placeholder' => __( 'Enter your title', 'haru-frames' ),
'default' => __( 'Add Your Heading Text Here', 'haru-frames' ),
]
);
$this->add_control(
'sub_title',
[
'label' => __( 'Sub Title', 'haru-frames' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'placeholder' => __( 'Enter your sub title', 'haru-frames' ),
'default' => __( 'Add Your Sub Heading Text Here', 'haru-frames' ),
'condition' => [
'pre_style' => [ 'style-2' ],
],
]
);
$this->add_control(
'link',
[
'label' => __( 'Link', 'haru-frames' ),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'default' => [
'url' => '',
],
'separator' => 'before',
]
);
$this->add_control(
'size',
[
'label' => __( 'Size', 'haru-frames' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 100,
],
],
'condition' => [
'pre_style' => [ 'none' ],
],
'selectors' => [
'{{WRAPPER}} .haru-heading-title' => 'font-size: {{SIZE}}{{UNIT}}',
],
]
);
$this->add_control(
'header_size',
[
'label' => __( 'HTML Tag', 'haru-frames' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h1' => 'H1',
'h2' => 'H2',
'h3' => 'H3',
'h4' => 'H4',
'h5' => 'H5',
'h6' => 'H6',
'div' => 'div',
'span' => 'span',
'p' => 'p',
],
'default' => 'h2',
]
);
$this->add_responsive_control(
'align',
[
'label' => __( 'Alignment', 'haru-frames' ),
'type' => Controls_Manager::CHOOSE,
'devices' => [ 'desktop', 'tablet', 'mobile' ],
'options' => [
'left' => [
'title' => __( 'Left', 'haru-frames' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => __( 'Center', 'haru-frames' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => __( 'Right', 'haru-frames' ),
'icon' => 'eicon-text-align-right',
],
'justify' => [
'title' => __( 'Justified', 'haru-frames' ),
'icon' => 'eicon-text-align-justify',
],
],
'default' => '',
'selectors' => [
'{{WRAPPER}}' => 'text-align: {{VALUE}};',
],
]
);
$this->add_control(
'el_class',
[
'label' => __( 'CSS Classes', 'haru-frames' ),
'type' => Controls_Manager::TEXT,
'default' => '',
'title' => __( 'Add your custom class WITHOUT the dot. e.g: my-class', 'haru-frames' ),
]
);
$this->add_control(
'view',
[
'label' => __( 'View', 'haru-frames' ),
'type' => Controls_Manager::HIDDEN,
'default' => 'traditional',
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_title_style',
[
'label' => __( 'Layout', 'haru-frames' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'background_dark',
[
'label' => __( 'Background Dark', 'haru-frames' ),
'type' => Controls_Manager::SWITCHER,
'description' => __( 'Enable if use for section has background dark.', 'haru-frames' ),
'default' => 'no',
'return_value' => 'yes',
]
);
$this->add_control(
'title_color',
[
'label' => __( 'Text Color', 'haru-frames' ),
'type' => Controls_Manager::COLOR,
'global' => [
'default' => '',
],
'condition' => [
'pre_style' => [ 'none' ],
],
'selectors' => [
'{{WRAPPER}} .haru-heading-title' => 'color: {{VALUE}};',
'{{WRAPPER}} .haru-heading-title a' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'typography',
'global' => [
'default' => '',
],
'condition' => [
'pre_style' => [ 'none' ],
],
'selector' => '{{WRAPPER}} .haru-heading-title',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if ( '' === $settings['title'] ) {
return;
}
$this->add_render_attribute( 'title', 'class', 'haru-heading-title' );
if ( 'none' != $settings['pre_style'] ) {
$this->add_render_attribute( 'title', 'class', 'haru-heading-title--' . $settings['pre_style'] );
}
if ( in_array( $settings['pre_style'], array( 'heading-2', 'heading-3', 'heading-6', 'heading-7', 'sub-heading-1', 'sub-heading-8', 'sub-heading-9', 'sub-heading-11' ) ) ) {
$this->add_render_attribute( 'title', 'class', 'font__secondary' );
}
// Heading has Decoration
if ( in_array( $settings['pre_style'], array( 'heading-9' ) ) ) {
$this->add_render_attribute( 'title', 'class', 'haru-heading-title--align-' . $settings['align'] );
$this->add_render_attribute( 'title', 'class', 'haru-heading-title--align-tablet-' . $settings['align_tablet'] );
$this->add_render_attribute( 'title', 'class', 'haru-heading-title--align-mobile-' . $settings['align_mobile'] );
}
if ( ! empty( $settings['el_class'] ) ) {
$this->add_render_attribute( 'title', 'class', $settings['el_class'] );
}
$this->add_inline_editing_attributes( 'title' );
$title = $settings['title'];
$sub_title = $settings['sub_title'];
if ( ! empty( $settings['link']['url'] ) ) {
$this->add_link_attributes( 'url', $settings['link'] );
if ( ( $settings['sub_title'] != '' ) && in_array( $settings['pre_style'], array( 'style-2' ) ) ) {
$title = sprintf( '<a %1$s><span class="haru-heading-title__sub">%2$s</span>%3$s</a>', $this->get_render_attribute_string( 'url' ), $sub_title, $title );
} else {
$title = sprintf( '<a %1$s>%2$s</a>', $this->get_render_attribute_string( 'url' ), $title );
}
}
if ( ( $settings['sub_title'] != '' ) && in_array( $settings['pre_style'], array( 'style-2' ) ) ) {
$title_html = sprintf( '<%1$s %2$s><span class="haru-heading-title__sub">%3$s</span>%4$s</%1$s>', $settings['header_size'], $this->get_render_attribute_string( 'title' ), $sub_title, $title );
} else {
$title_html = sprintf( '<%1$s %2$s>%3$s</%1$s>', $settings['header_size'], $this->get_render_attribute_string( 'title' ), $title );
}
if ( 'yes' == $settings['background_dark'] ) {
$this->add_render_attribute( 'title', 'class', 'background-dark' );
$title_html = '<div class="background-dark">' . $title_html . '</div>';
}
echo $title_html;
}
}
}