| Server IP : 104.26.4.103 / 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_Background;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Repeater;
use \Elementor\Utils;
use \Elementor\Control_Media;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Tp Core
*
* Elementor widget for hello world.
*
* @since 1.0.0
*/
class TP_Info_Card 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-info-card';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Info Card', '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'),
'layout-3' => esc_html__('Layout 3', 'tpcore'),
],
'default' => 'layout-1',
]
);
$this->end_controls_section();
// title/content
$this->tp_section_title_render_controls('section', 'Section Title', 'Sub Title', 'your title here', 'Description write here.', ['layout-1', 'layout-2', 'layout-3']);
// button
$this->tp_button_render('card', 'Button', ['layout-1', 'layout-2', 'layout-3']);
// _tp_image
$this->start_controls_section(
'_tp_image',
[
'label' => esc_html__('Thumbnail', 'tpcore'),
'condition' => [
'tp_design_style' => 'layout-1'
]
]
);
$this->add_control(
'tp_image',
[
'label' => esc_html__( 'Choose Image', 'tpcore' ),
'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();
// animation
$this->start_controls_section(
'tp_animation',
[
'label' => esc_html__('Animation', 'tpcore'),
'condition' => [
'tp_design_style' => 'layout-1'
]
]
);
// creative animation
$this->add_control(
'tp_creative_anima_switcher',
[
'label' => esc_html__( 'Active Animation', 'tpcore' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'tpcore' ),
'label_off' => esc_html__( 'No', 'tpcore' ),
'return_value' => 'yes',
'default' => '0',
'separator' => 'before',
]
);
$this->add_control(
'tp_anima_type',
[
'label' => __( 'Animation Type', 'tpcore' ),
'type' => Controls_Manager::SELECT,
'options' => [
'tpfadeUp' => __( 'tpfadeUp', 'tpcore' ),
'tpfadeInDown' => __( 'tpfadeInDown', 'tpcore' ),
'tpfadeLeft' => __( 'tpfadeLeft', 'tpcore' ),
'tpfadeRight' => __( 'tpfadeRight', 'tpcore' ),
],
'default' => 'tpfadeUp',
'frontend_available' => true,
'style_transfer' => true,
'condition' => [
'tp_creative_anima_switcher' => 'yes',
],
]
);
$this->add_control(
'tp_anima_dura', [
'label' => esc_html__('Animation Duration', 'tpcore'),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__('0.3s', 'tpcore'),
'condition' => [
'tp_creative_anima_switcher' => 'yes',
],
]
);
$this->add_control(
'tp_anima_delay', [
'label' => esc_html__('Animation Delay', 'tpcore'),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__('0.6s', 'tpcore'),
'condition' => [
'tp_creative_anima_switcher' => 'yes',
],
]
);
$this->end_controls_section();
}
protected function style_tab_content(){
$this->tp_section_style_controls('card_section', 'Section', '.tp-el-section');
$this->start_controls_section(
'card_img_sec',
[
'label' => esc_html__( 'Image', 'tpcore' ),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
'condition' => [
'tp_design_style' => 'layout-1'
]
]
);
$this->add_control(
'cardImg_width',
[
'label' => esc_html__( 'Width', 'textdomain' ),
'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .tp-card-img img' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'cardImg_height',
[
'label' => esc_html__( 'Height', 'textdomain' ),
'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .tp-card-img img' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->tp_basic_style_controls('heading_subtitle', 'Subtitle', '.tp-el-subtitle', ['layout-1', 'layout-2', 'layout-3']);
$this->tp_basic_style_controls('heading_title', 'Title', '.tp-el-title', ['layout-1', 'layout-2', 'layout-3']);
$this->tp_basic_style_controls('heading_desc', 'Description', '.tp-el-content', ['layout-1', 'layout-2', 'layout-3']);
$this->tp_link_controls_style('tpel_btn', 'Button', '.tp-el-btn', ['layout-1', 'layout-2', 'layout-3']);
}
/**
* 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' ) :
// Link
if ('2' == $settings['tp_card_btn_link_type']) {
$this->add_render_attribute('tp-button-arg', 'href', get_permalink($settings['tp_card_btn_page_link']));
$this->add_render_attribute('tp-button-arg', 'target', '_self');
$this->add_render_attribute('tp-button-arg', 'rel', 'nofollow');
$this->add_render_attribute('tp-button-arg', 'class', 'tp-btn-white-sm tp-el-btn');
} else {
if ( ! empty( $settings['tp_card_btn_link']['url'] ) ) {
$this->add_link_attributes( 'tp-button-arg', $settings['tp_card_btn_link'] );
$this->add_render_attribute('tp-button-arg', 'class', 'tp-btn-white-sm tp-el-btn');
}
}
$this->add_render_attribute('title_args', 'class', 'tp-banner__title tp-el-title');
?>
<div class="tp-banner-2__item p-relative fix theme-bg tp-el-section" >
<div class="tp-banner__content z-index">
<?php if ( !empty($settings['tp_section_sub_title']) ) : ?>
<p class="tp-el-subtitle"><?php echo tp_kses( $settings['tp_section_sub_title'] ); ?></p>
<?php endif; ?>
<?php
if ( !empty($settings['tp_section_title' ]) ) :
printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['tp_section_title_tag'] ),
$this->get_render_attribute_string( 'title_args' ),
tp_kses( $settings['tp_section_title' ] )
);
endif;
?>
<?php if ( !empty($settings['tp_section_description']) ) : ?>
<span class="tp-el-content"><?php echo tp_kses( $settings['tp_section_description'] ); ?></span>
<?php endif; ?>
<?php if ( !empty($settings['tp_card_btn_text']) ) : ?>
<a <?php echo $this->get_render_attribute_string( 'tp-button-arg' ); ?>><?php echo tp_kses($settings['tp_card_btn_text']); ?></a>
<?php endif; ?>
</div>
</div>
<?php elseif ( $settings['tp_design_style'] == 'layout-3' ) :
// Link
if ('2' == $settings['tp_card_btn_link_type']) {
$this->add_render_attribute('tp-button-arg', 'href', get_permalink($settings['tp_card_btn_page_link']));
$this->add_render_attribute('tp-button-arg', 'target', '_self');
$this->add_render_attribute('tp-button-arg', 'rel', 'nofollow');
$this->add_render_attribute('tp-button-arg', 'class', 'tp-btn-white-sm tp-el-btn');
} else {
if ( ! empty( $settings['tp_card_btn_link']['url'] ) ) {
$this->add_link_attributes( 'tp-button-arg', $settings['tp_card_btn_link'] );
$this->add_render_attribute('tp-button-arg', 'class', 'tp-btn-white-sm tp-el-btn');
}
}
$this->add_render_attribute('title_args', 'class', 'tp-banner__title tp-el-title');
?>
<div class="tp-banner-2__item gradiant fix p-relative theme-bg tp-el-section">
<div class="tp-banner__content z-index">
<?php if ( !empty($settings['tp_section_sub_title']) ) : ?>
<p class="tp-el-subtitle"><?php echo tp_kses( $settings['tp_section_sub_title'] ); ?></p>
<?php endif; ?>
<?php
if ( !empty($settings['tp_section_title' ]) ) :
printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['tp_section_title_tag'] ),
$this->get_render_attribute_string( 'title_args' ),
tp_kses( $settings['tp_section_title' ] )
);
endif;
?>
<?php if ( !empty($settings['tp_section_description']) ) : ?>
<span class="tp-el-content"><?php echo tp_kses( $settings['tp_section_description'] ); ?></span>
<?php endif; ?>
<?php if ( !empty($settings['tp_card_btn_text']) ) : ?>
<a <?php echo $this->get_render_attribute_string( 'tp-button-arg' ); ?>><?php echo tp_kses($settings['tp_card_btn_text']); ?></a>
<?php endif; ?>
</div>
</div>
<?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);
}
// Link
if ('2' == $settings['tp_card_btn_link_type']) {
$this->add_render_attribute('tp-button-arg', 'href', get_permalink($settings['tp_card_btn_page_link']));
$this->add_render_attribute('tp-button-arg', 'target', '_self');
$this->add_render_attribute('tp-button-arg', 'rel', 'nofollow');
$this->add_render_attribute('tp-button-arg', 'class', 'tp-btn-white-sm tp-el-btn');
} else {
if ( ! empty( $settings['tp_card_btn_link']['url'] ) ) {
$this->add_link_attributes( 'tp-button-arg', $settings['tp_card_btn_link'] );
$this->add_render_attribute('tp-button-arg', 'class', 'tp-btn-white-sm tp-el-btn');
}
}
$this->add_render_attribute('title_args', 'class', 'tp-feature-4__title tp-el-title');
?>
<div class="tp-feature-4__item p-relative tp-el-section <?php echo $settings['tp_creative_anima_switcher'] ? "wow ".$settings['tp_anima_type'] : NULL; ?>" <?php echo $settings['tp_creative_anima_switcher'] ? "data-wow-duration=".$settings['tp_anima_dura']." "."data-wow-delay=".$settings['tp_anima_delay']." " : NULL; ?>>
<?php if(!empty($tp_image)) : ?>
<div class="tp-feature-4__thumb tp-card-img">
<img src="<?php echo esc_url($tp_image); ?>" alt="<?php echo esc_attr($tp_image_alt); ?>">
</div>
<?php endif; ?>
<div class="tp-feature-4__content">
<?php if ( !empty($settings['tp_section_sub_title']) ) : ?>
<span class="tp-el-subtitle"><?php echo tp_kses( $settings['tp_section_sub_title'] ); ?></span>
<?php endif; ?>
<?php
if ( !empty($settings['tp_section_title' ]) ) :
printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['tp_section_title_tag'] ),
$this->get_render_attribute_string( 'title_args' ),
tp_kses( $settings['tp_section_title' ] )
);
endif;
?>
<?php if ( !empty($settings['tp_section_description']) ) : ?>
<p class="tp-el-content"><?php echo tp_kses( $settings['tp_section_description'] ); ?></p>
<?php endif; ?>
<?php if ( !empty($settings['tp_card_btn_text']) ) : ?>
<a <?php echo $this->get_render_attribute_string( 'tp-button-arg' ); ?>><?php echo tp_kses($settings['tp_card_btn_text']); ?></a>
<?php endif; ?>
</div>
</div>
<?php endif;
}
}
$widgets_manager->register( new TP_Info_Card() );