| Server IP : 69.72.244.102 / Your IP : 216.73.216.164 Web Server : LiteSpeed System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : konzalta ( 1271) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/cwd/wp-content/plugins/portx-core/include/elementor/ |
Upload File : |
<?php
namespace TPCore\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use \Elementor\Group_Control_Background;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Repeater;
use \Elementor\Utils;
use \Elementor\Control_Media;
use TPCore\Elementor\Controls\Group_Control_TPBGGradient;
use TPCore\Elementor\Controls\Group_Control_TPGradient;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Tp Core
*
* Elementor widget for hello world.
*
* @since 1.0.0
*/
class TP_Features extends Widget_Base {
use \TPCore\Widgets\TPCoreElementFunctions;
/**
* Retrieve the widget name.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'features';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Features', 'tp-core' );
}
/**
* Retrieve the widget icon.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'tp-icon';
}
/**
* Retrieve the list of categories the widget belongs to.
*
* Used to determine where to display the widget in the editor.
*
* Note that currently Elementor supports only one category.
* When multiple categories passed, Elementor uses the first one.
*
* @since 1.0.0
*
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return [ 'tpcore' ];
}
/**
* Retrieve the list of scripts the widget depended on.
*
* Used to set scripts dependencies required to run the widget.
*
* @since 1.0.0
*
* @access public
*
* @return array Widget scripts dependencies.
*/
public function get_script_depends() {
return [ 'tp-core' ];
}
/**
* Register the widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 1.0.0
*
* @access protected
*/
protected function register_controls(){
$this->register_controls_section();
$this->style_tab_content();
}
protected function register_controls_section() {
// layout Panel
$this->start_controls_section(
'tp_layout',
[
'label' => esc_html__('Design Layout', 'tp-core'),
]
);
$this->add_control(
'tp_design_style',
[
'label' => esc_html__('Select Layout', 'tp-core'),
'type' => Controls_Manager::SELECT,
'options' => [
'layout-1' => esc_html__('Layout 1', 'tp-core'),
],
'default' => 'layout-1',
]
);
$this->end_controls_section();
$this->tp_section_title_render_controls('feature', 'Section Title', 'Sub Title', 'your title here', $default_description = 'Hic nesciunt galisum aut dolorem aperiam eum soluta quod ea cupiditate.');
// Features Sections
$this->start_controls_section(
'feature_features_list_sec',
[
'label' => esc_html__( 'Features List', 'tpcore' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
'condition' => [
'tp_design_style' => ['layout-1', 'layout-3']
]
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'tp_box_icon_type',
[
'label' => esc_html__('Select Icon Type', 'tpcore'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'icon',
'options' => [
'image' => esc_html__('Image', 'tpcore'),
'icon' => esc_html__('Icon', 'tpcore'),
'svg' => esc_html__('SVG', 'tpcore'),
],
]
);
$repeater->add_control(
'tp_box_icon_svg',
[
'show_label' => false,
'type' => Controls_Manager::TEXTAREA,
'label_block' => true,
'placeholder' => esc_html__('SVG Code Here', 'tpcore'),
'condition' => [
'tp_box_icon_type' => 'svg',
]
]
);
$repeater->add_control(
'tp_box_icon_image',
[
'label' => esc_html__('Upload Icon Image', 'tpcore'),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
'condition' => [
'tp_box_icon_type' => 'image',
]
]
);
if (tp_is_elementor_version('<', '2.6.0')) {
$repeater->add_control(
'tp_box_icon',
[
'show_label' => false,
'type' => Controls_Manager::ICON,
'label_block' => true,
'default' => 'fa fa-star',
'condition' => [
'tp_box_icon_type' => 'icon',
]
]
);
} else {
$repeater->add_control(
'tp_box_selected_icon',
[
'show_label' => false,
'type' => Controls_Manager::ICONS,
'fa4compatibility' => 'icon',
'label_block' => true,
'default' => [
'value' => 'fas fa-star',
'library' => 'solid',
],
'condition' => [
'tp_box_icon_type' => 'icon',
]
]
);
}
$repeater->add_control(
'feature_features_title',
[
'label' => esc_html__( 'Choose Title', 'tpcore' ),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'default' => esc_html__( 'See the action in live', 'tpcore' ),
'label_block' => true,
]
);
$this->add_control(
'feature_features_list',
[
'label' => esc_html__( 'Choose List', 'tpcore' ),
'type' => \Elementor\Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'feature_features_title' => esc_html__( 'See the action in live', 'tpcore' ),
],
[
'feature_features_title' => esc_html__( 'Intuitive dashboard', 'tpcore' ),
],
],
'title_field' => '{{{ feature_features_title }}}',
]
);
$this->end_controls_section();
// _tp_image
$this->start_controls_section(
'_tp_image',
[
'label' => esc_html__('Thumbnail', 'tp-core'),
]
);
$this->add_control(
'tp_image',
[
'label' => esc_html__( 'Choose Image', 'tp-core' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$this->add_group_control(
Group_Control_Image_Size::get_type(),
[
'name' => 'tp_image_size',
'default' => 'full',
'exclude' => [
'custom'
]
]
);
$this->end_controls_section();
}
// style_tab_content
protected function style_tab_content(){
$this->tp_section_style_controls('feature_section', 'Section - Style', '.tp-el-section');
}
/**
* Render the widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.0.0
*
* @access protected
*/
protected function render() {
$settings = $this->get_settings_for_display();
?>
<?php if ( $settings['tp_design_style'] == 'layout-2' ) : ?>
<?php else:
// thumbnail
if ( !empty($settings['tp_image']['url']) ) {
$tp_image = !empty($settings['tp_image']['id']) ? wp_get_attachment_image_url( $settings['tp_image']['id'], $settings['tp_image_size_size']) : $settings['tp_image']['url'];
$tp_image_alt = get_post_meta($settings["tp_image"]["id"], "_wp_attachment_image_alt", true);
}
$this->add_render_attribute('title_args', 'class', 'tp-section__title-white mb-40');
?>
<div class="features-area tp-features__bg-color tp-el-section">
<div class="container">
<div class="row align-items-xl-end">
<div class="col-xl-5 col-lg-5 col-md-12">
<?php if(!empty($tp_image)) : ?>
<div class="tp-features__img wow fadeInDownBig ">
<img src="<?php echo esc_url($tp_image); ?>" alt="<?php echo esc_attr($tp_image_alt); ?>">
</div>
<?php endif; ?>
</div>
<div class="col-xl-7 col-lg-7 col-md-12">
<div class="tp-features">
<div class="tp-features__wrap">
<div class="tp-section__subtitle tp-section__subtitle-before mb-15 p-relative text-white"><?php echo tp_kses( $settings['tp_feature_sub_title'] ); ?></div>
<?php if ( !empty($settings['tp_feature_sub_title']) ) : ?>
<div class="tp-section-subtitle-box">
<span class="tp-section-subtitle section-subtitle-border"><?php echo tp_kses( $settings['tp_feature_sub_title'] ); ?></span>
</div>
<?php endif; ?>
<?php
if ( !empty($settings['tp_feature_title' ]) ) :
printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['tp_feature_title_tag'] ),
$this->get_render_attribute_string( 'title_args' ),
tp_kses( $settings['tp_feature_title' ] )
);
endif;
?>
<?php if ( !empty($settings['tp_feature_description']) ) : ?>
<p class="text-white"><?php echo tp_kses( $settings['tp_feature_description'] ); ?></p>
<?php endif; ?>
<div class="tp-features__list">
<?php foreach($settings['feature_features_list'] as $key => $item) : ?>
<div class="tp-features__single d-flex align-items-start">
<?php if($item['tp_box_icon_type'] == 'icon') : ?>
<?php if (!empty($item['tp_box_icon']) || !empty($item['tp_box_selected_icon']['value'])) : ?>
<span class="mr-30">
<?php tp_render_icon($item, 'tp_box_icon', 'tp_box_selected_icon'); ?>
</span>
<?php endif; ?>
<?php elseif( $item['tp_box_icon_type'] == 'image' ) : ?>
<?php if (!empty($item['tp_box_icon_image']['url'])): ?>
<span class="mr-30">
<img src="<?php echo $item['tp_box_icon_image']['url']; ?>"
alt="<?php echo get_post_meta(attachment_url_to_postid($item['tp_box_icon_image']['url']), '_wp_attachment_image_alt', true); ?>">
</span>
<?php endif; ?>
<?php else : ?>
<?php if (!empty($item['tp_box_icon_svg'])): ?>
<span class="mr-30">
<?php echo $item['tp_box_icon_svg']; ?>
</span>
<?php endif; ?>
<?php endif; ?>
<?php if(!empty($item['feature_features_title'])) : ?>
<p><?php echo tp_kses($item['feature_features_title']); ?></p>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endif;
}
}
$widgets_manager->register( new TP_Features() );