| Server IP : 172.67.71.254 / Your IP : 216.73.216.4 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : arabianexpress ( 1872) PHP Version : 8.0.30 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v9321/leapdubai/public_html/wp-content/plugins/printx-core/include/elementor/ |
Upload File : |
<?php
namespace TPCore\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Repeater;
use \Elementor\Utils;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Text_Shadow;
use \Elementor\Group_Control_Typography;
Use \Elementor\Core\Schemes\Typography;
use \Elementor\Group_Control_Background;
use TPCore\Elementor\Controls\Group_Control_TPBGGradient;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Tp Core
*
* Elementor widget for hello world.
*
* @since 1.0.0
*/
class TP_Fact 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 'tp-fact';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Fact', 'tpcore' );
}
/**
* 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 [ 'tpcore' ];
}
/**
* 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', 'tpcore'),
]
);
$this->add_control(
'tp_design_style',
[
'label' => esc_html__('Select Layout', 'tpcore'),
'type' => Controls_Manager::SELECT,
'options' => [
'layout-1' => esc_html__('Layout 1', 'tpcore'),
'layout-2' => esc_html__('Layout 2', 'tpcore'),
],
'default' => 'layout-1',
]
);
$this->end_controls_section();
$this->tp_section_title_render_controls('fact', 'Section Title', 'Sub Title', 'your title here', 'Hic nesciunt galisum aut dolorem aperiam eum soluta quod ea cupiditate.', 'layout-2');
// fact group
$this->start_controls_section(
'tp_fact',
[
'label' => esc_html__('Fact List', 'tpcore'),
'description' => esc_html__( 'Control all the style settings from Style tab', 'tpcore' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'repeater_condition',
[
'label' => __( 'Field condition', 'tpcore' ),
'type' => Controls_Manager::SELECT,
'options' => [
'style_1' => __( 'Style 1', 'tpcore' ),
'style_2' => __( 'Style 2', 'tpcore' ),
],
'default' => 'style_1',
'frontend_available' => true,
'style_transfer' => true,
]
);
$repeater->add_control(
'tp_fact_number', [
'label' => esc_html__('Number', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'basic' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__('17', 'tpcore'),
'label_block' => true,
]
);
$repeater->add_control(
'tp_fact_before',
[
'label' => esc_html__('Before Content', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'intermediate' ),
'type' => \Elementor\Controls_Manager::TEXT,
]
);
$repeater->add_control(
'tp_fact_after',
[
'label' => esc_html__('After Content', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'intermediate' ),
'type' => \Elementor\Controls_Manager::TEXT,
]
);
$repeater->add_control(
'tp_fact_title',
[
'label' => esc_html__('Title', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'intermediate' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__('Food', 'tpcore'),
'label_block' => true,
'condition' => [
'repeater_condition' => 'style_1'
]
]
);
$repeater->add_control(
'tp_fact_des',
[
'label' => esc_html__('Description', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'intermediate' ),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'default' => esc_html__('Modern customer service exactly what we were look to the pricing', 'tpcore'),
'label_block' => true,
]
);
$repeater->add_control(
'tp_fact_svg',
[
'label' => esc_html__('SVG Code', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'intermediate' ),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'label_block' => true,
'condition' => [
'repeater_condition' => 'style_2'
]
]
);
$this->add_control(
'tp_fact_list',
[
'label' => esc_html__('Fact - List', 'tpcore'),
'type' => \Elementor\Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'tp_fact_number' => esc_html__('5', 'tpcore'),
'tp_fact_title' => esc_html__('Business', 'tpcore'),
],
[
'tp_fact_number' => esc_html__('4', 'tpcore'),
'tp_fact_title' => esc_html__('Website', 'tpcore')
],
[
'tp_fact_number' => esc_html__('3', 'tpcore'),
'tp_fact_title' => esc_html__('Marketing', 'tpcore')
]
],
'title_field' => '{{{ tp_fact_title }}}',
]
);
$this->end_controls_section();
// shape
$this->start_controls_section(
'tp_shape',
[
'label' => esc_html__( 'Shape Section', 'tpcore' ),
'condition' => [
'tp_design_style' => 'layout-2'
]
]
);
$this->add_control(
'tp_shape_switch',
[
'label' => esc_html__( 'Shape On/Off', 'tpcore' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'tpcore' ),
'label_off' => esc_html__( 'Hide', 'tpcore' ),
'return_value' => 'yes',
'default' => '0',
]
);
$this->add_control(
'tp_shape_image_1',
[
'label' => esc_html__( 'Choose Shape Image 1', 'tpcore' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
'condition' => [
'tp_shape_switch' => 'yes'
]
]
);
$this->add_control(
'tp_shape_image_2',
[
'label' => esc_html__( 'Choose Shape Image 2', 'tpcore' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
'condition' => [
'tp_shape_switch' => 'yes',
]
]
);
$this->add_control(
'tp_shape_image_3',
[
'label' => esc_html__( 'Choose Shape Image 3', 'tpcore' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
'condition' => [
'tp_shape_switch' => 'yes',
]
]
);
$this->add_group_control(
Group_Control_Image_Size::get_type(),
[
'name' => 'shape_image_size', // // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
'exclude' => ['custom'],
'condition' => [
'tp_shape_switch' => 'yes'
],
'default' => 'full'
]
);
$this->end_controls_section();
}
// style_tab_content
protected function style_tab_content(){
$this->tp_section_style_controls('fact_section', 'Section - Style', '.tp-el-section');
$this->tp_basic_style_controls('heading_subtitle', 'Subtitle', '.tp-el-subtitle', 'layout-2');
$this->tp_basic_style_controls('heading_title', 'Title', '.tp-el-title', 'layout-2');
$this->tp_basic_style_controls('heading_desc', 'Description', '.tp-el-content', 'layout-2');
// rep
$this->tp_basic_style_controls('rep_num', 'Fact List Number', '.tp-el-rep-num', ['layout-1', 'layout-2']);
$this->tp_basic_style_controls('rep_title', 'Fact List Title', '.tp-el-rep-title', 'layout-1');
$this->tp_basic_style_controls('rep_des', 'Fact List Description', '.tp-el-rep-des', ['layout-1', 'layout-2']);
}
/**
* 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' ) :
// shape image
if ( !empty($settings['tp_shape_image_1']['url']) ) {
$tp_shape_image = !empty($settings['tp_shape_image_1']['id']) ? wp_get_attachment_image_url( $settings['tp_shape_image_1']['id'], $settings['shape_image_size_size']) : $settings['tp_shape_image_1']['url'];
$tp_shape_image_alt = get_post_meta($settings["tp_shape_image_1"]["id"], "_wp_attachment_image_alt", true);
}
if ( !empty($settings['tp_shape_image_2']['url']) ) {
$tp_shape_image2 = !empty($settings['tp_shape_image_2']['id']) ? wp_get_attachment_image_url( $settings['tp_shape_image_2']['id'], $settings['shape_image_size_size']) : $settings['tp_shape_image_2']['url'];
$tp_shape_image_alt2 = get_post_meta($settings["tp_shape_image_2"]["id"], "_wp_attachment_image_alt", true);
}
if ( !empty($settings['tp_shape_image_3']['url']) ) {
$tp_shape_image3 = !empty($settings['tp_shape_image_3']['id']) ? wp_get_attachment_image_url( $settings['tp_shape_image_3']['id'], $settings['shape_image_size_size']) : $settings['tp_shape_image_3']['url'];
$tp_shape_image_alt3 = get_post_meta($settings["tp_shape_image_3"]["id"], "_wp_attachment_image_alt", true);
}
$this->add_render_attribute('title_args', 'class', 'tp-team-3__top-title tp-el-title');
?>
<div class="tp-team-3__top-area fix tp-team-3__top-bg p-relative pt-110 tp-el-section">
<?php if(!empty($tp_shape_image)) : ?>
<div class="tp-team-3__shape-1 d-none d-xl-block">
<img src="<?php echo esc_url($tp_shape_image); ?>" alt="<?php echo esc_attr($tp_shape_image_alt); ?>">
</div>
<?php endif; ?>
<?php if(!empty($tp_shape_image2)) : ?>
<div class="tp-team-3__shape-2 d-none d-xl-block">
<img src="<?php echo esc_url($tp_shape_image2); ?>" alt="<?php echo esc_attr($tp_shape_image_alt2); ?>">
</div>
<?php endif; ?>
<?php if(!empty($tp_shape_image3)) : ?>
<div class="tp-team-3__shape-3 d-none d-xl-block">
<img src="<?php echo esc_url($tp_shape_image3); ?>" alt="<?php echo esc_attr($tp_shape_image_alt3); ?>">
</div>
<?php endif; ?>
<div class="container custom-container-1">
<div class="tp-team-3__top-pb">
<div class="row align-items-start">
<div class="col-xl-6 col-lg-6 col-md-8">
<div class="tp-team-3__top-left">
<?php if ( !empty($settings['tp_fact_sub_title']) ) : ?>
<span class="tp-gradiant-section-subtitle tp-el-subtitle"><?php echo tp_kses($settings['tp_fact_sub_title']); ?></span>
<?php endif; ?>
<?php
if ( !empty($settings['tp_fact_title' ]) ) :
printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['tp_fact_title_tag'] ),
$this->get_render_attribute_string( 'title_args' ),
tp_kses( $settings['tp_fact_title' ] )
);
endif;
?>
<?php if ( !empty($settings['tp_fact_description']) ) : ?>
<p class="tp-el-content"><?php echo tp_kses( $settings['tp_fact_description'] ); ?></p>
<?php endif; ?>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-4 d-none d-md-block">
<div class="tp-team-3__top-right text-end">
<ul>
<?php foreach ($settings['tp_fact_list'] as $key => $item) :
$key = $key + 1;
$keyCount = count($settings['tp_fact_list']);
$paddingLast = $key == $keyCount ? 'plr' : NULL;
?>
<li>
<div class="tp-team-3__top-item">
<?php echo $item['tp_fact_before'] ? "<h3 class='d-inline-block tp-el-rep-num'>".tp_kses($item['tp_fact_before'])."</h3>" : NULL; ?><h6 class="p-relative tp-el-rep-num"><span data-purecounter-duration="1" data-purecounter-end="<?php echo esc_attr($item['tp_fact_number']); ?>" class="purecounter">0</span><?php echo $item['tp_fact_after'] ? tp_kses($item['tp_fact_after']) : NULL; ?>
<?php if(!empty($item['tp_fact_svg'])) : ?>
<span class="tp-team-3__title-shape d-none d-xl-block">
<?php echo tp_kses($item['tp_fact_svg']); ?>
</span>
<?php endif; ?>
</h6>
<?php if(!empty($item['tp_fact_des'])) : ?>
<p class="tp-el-rep-des"><?php echo tp_kses($item['tp_fact_des']); ?></p>
<?php endif; ?>
</div>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<?php else : ?>
<div class="tp-catagori-2__content-box d-flex align-items-center justify-content-between mb-35 tp-el-section">
<?php foreach ($settings['tp_fact_list'] as $key => $item) :
$key = $key + 1;
$keyCount = count($settings['tp_fact_list']);
$paddingLast = $key == $keyCount ? 'plr' : NULL;
?>
<div class="tp-catagori-2__content <?php echo esc_attr($paddingLast); ?>">
<h5 class="tp-catagori-2__number tp-el-rep-num"><?php echo $item['tp_fact_before'] ? tp_kses($item['tp_fact_before']) : NULL; ?><span data-purecounter-duration="1" data-purecounter-end="<?php echo esc_attr($item['tp_fact_number']); ?>" class="purecounter">0</span><?php echo $item['tp_fact_after'] ? tp_kses($item['tp_fact_after']) : NULL; ?></h5>
<?php if(!empty($item['tp_fact_title'])) : ?>
<h4 class="tp-catagori-2__title tp-el-rep-title"><?php echo tp_kses($item['tp_fact_title']); ?></h4>
<?php endif; ?>
<?php if(!empty($item['tp_fact_des'])) : ?>
<p class="tp-el-rep-des"><?php echo tp_kses($item['tp_fact_des']); ?></p>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif;
}
}
$widgets_manager->register( new TP_Fact() );