| 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;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Tp Core
*
* Elementor widget for hello world.
*
* @since 1.0.0
*/
class TP_CTA 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-cta';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'CTA', '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' ];
}
public function get_tp_contact_form(){
if ( ! class_exists( 'WPCF7' ) ) {
return;
}
$tp_cfa = array();
$tp_cf_args = array( 'posts_per_page' => -1, 'post_type'=> 'wpcf7_contact_form' );
$tp_forms = get_posts( $tp_cf_args );
$tp_cfa = ['0' => esc_html__( 'Select Form', 'tpcore' ) ];
if( $tp_forms ){
foreach ( $tp_forms as $tp_form ){
$tp_cfa[$tp_form->ID] = $tp_form->post_title;
}
}else{
$tp_cfa[ esc_html__( 'No contact form found', 'tpcore' ) ] = 0;
}
return $tp_cfa;
}
/**
* 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();
}
// controls file
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'),
'layout-2' => esc_html__('Layout 2', 'tp-core'),
'layout-3' => esc_html__('Layout 3', 'tp-core'),
'layout-4' => esc_html__('Layout 4', 'tp-core'),
],
'default' => 'layout-1',
]
);
$this->end_controls_section();
// tp_section_title
$this->start_controls_section(
'tp_section_title',
[
'label' => esc_html__('Title & Content', 'tpcore'),
]
);
$this->add_control(
'tp_sub_title',
[
'label' => esc_html__('Sub Title', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'intermediate' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__('TP Sub Title Here', 'tpcore'),
'placeholder' => esc_html__('Type Sub Heading Text', 'tpcore'),
'label_block' => true,
]
);
$this->add_control(
'tp_title',
[
'label' => esc_html__('Title', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'intermediate' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__('TP Title Here', 'tpcore'),
'placeholder' => esc_html__('Type Heading Text', 'tpcore'),
'label_block' => true,
]
);
$this->add_control(
'tp_description',
[
'label' => esc_html__('Description', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'intermediate' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__('TP Description Here', 'tpcore'),
'placeholder' => esc_html__('Type Description Text', 'tpcore'),
'label_block' => true,
]
);
$this->add_control(
'tp_title_tag',
[
'label' => esc_html__('Title HTML Tag', 'tp-core'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'h1' => [
'title' => esc_html__('H1', 'tp-core'),
'icon' => 'eicon-editor-h1'
],
'h2' => [
'title' => esc_html__('H2', 'tp-core'),
'icon' => 'eicon-editor-h2'
],
'h3' => [
'title' => esc_html__('H3', 'tp-core'),
'icon' => 'eicon-editor-h3'
],
'h4' => [
'title' => esc_html__('H4', 'tp-core'),
'icon' => 'eicon-editor-h4'
],
'h5' => [
'title' => esc_html__('H5', 'tp-core'),
'icon' => 'eicon-editor-h5'
],
'h6' => [
'title' => esc_html__('H6', 'tp-core'),
'icon' => 'eicon-editor-h6'
]
],
'default' => 'h2',
'toggle' => false,
]
);
$this->add_responsive_control(
'tp_align',
[
'label' => esc_html__('Alignment', 'tpcore'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'text-left' => [
'title' => esc_html__('Left', 'tpcore'),
'icon' => 'eicon-text-align-left',
],
'text-center' => [
'title' => esc_html__('Center', 'tpcore'),
'icon' => 'eicon-text-align-center',
],
'text-right' => [
'title' => esc_html__('Right', 'tpcore'),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'left',
'toggle' => false,
'condition' => [
'tp_design_style' => ['layout-2', 'layout-3']
]
]
);
$this->end_controls_section();
$this->tp_button_render('cta', 'Button', ['layout-1','layout-2']);
// _tp_image
$this->start_controls_section(
'_tp_image',
[
'label' => esc_html__('Thumbnail', 'tpcore'),
]
);
$this->add_control(
'tp_image',
[
'label' => esc_html__( 'Choose BG 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();
}
// style_tab_content
protected function style_tab_content(){
$this->tp_section_style_controls('cta_section', 'Section Style', '.ele-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-3' ):
// 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_cta_btn_link_type']) {
$this->add_render_attribute('tp-button-arg', 'href', get_permalink($settings['tp_cta_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');
} else {
if ( ! empty( $settings['tp_cta_btn_link']['url'] ) ) {
$this->add_link_attributes( 'tp-button-arg', $settings['tp_cta_btn_link'] );
$this->add_render_attribute('tp-button-arg', 'class', 'tp-btn');
}
}
$this->add_render_attribute('title_args', 'class', 'tp-newslatter__title-sm');
?>
<div class="tp-newslatter__area tp-newslatter-3__customize">
<div class="tp-newslatter__bg" data-background="<?php echo esc_url($tp_image); ?>">
<div class="container">
<div class="row align-items-center">
<div class="col-xl-6 col-lg-6 wow tpfadeLeft" data-wow-duration=".9s" data-wow-delay=".3s">
<div class="tp-newslatter__title-box">
<?php if ( !empty($settings['tp_title']) ) :
printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['tp_title_tag'] ),
$this->get_render_attribute_string( 'title_args' ),
tp_kses( $settings['tp_title'] )
);
endif;
?>
</div>
</div>
<?php if( !empty($settings['tpcore_select_contact_form']) ) : ?>
<div class="col-xl-6 col-lg-6 wow tpfadeRight" data-wow-duration=".9s" data-wow-delay=".5s">
<?php echo do_shortcode( '[contact-form-7 id="'.$settings['tpcore_select_contact_form'].'"]' ); ?>
</div>
<?php else : ?>
<?php echo '<div class="alert alert-info"><p class="m-0">' . __('Please Select contact form.', 'tpcore' ). '</p></div>'; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php elseif ( $settings['tp_design_style'] == 'layout-2' ):
// 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);
}
if ( !empty($settings['tp_image_2']['url']) ) {
$tp_image_2 = !empty($settings['tp_image_2']['id']) ? wp_get_attachment_image_url( $settings['tp_image_2']['id'], $settings['tp_image_size_size']) : $settings['tp_image_2']['url'];
$tp_image_alt_2 = get_post_meta($settings["tp_image_2"]["id"], "_wp_attachment_image_alt", true);
}
// Link
if ('2' == $settings['tp_cta_btn_link_type']) {
$this->add_render_attribute('tp-button-arg', 'href', get_permalink($settings['tp_cta_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');
} else {
if ( ! empty( $settings['tp_cta_btn_link']['url'] ) ) {
$this->add_link_attributes( 'tp-button-arg', $settings['tp_cta_btn_link'] );
$this->add_render_attribute('tp-button-arg', 'class', 'tp-btn-white');
}
}
$this->add_render_attribute('title_args', 'class', 'tp-cta-title-2');
?>
<div class="cta-area-2 theme-color-2 pt-60 pb-60 p-relative fix">
<div class="tp-cta__lg-circel">
<img src="<?php echo get_template_directory_uri( ); ?>/assets/img/blog/lg-circel.png" alt="">
</div>
<div class="tp-cta__sm-circel">
<img src="<?php echo get_template_directory_uri( ); ?>/assets/img/blog/circel.png" alt="">
</div>
<div class="tp-cta__shap-3 wow slideInLeft ">
<img src="<?php echo get_template_directory_uri( ); ?>/assets/img/cta/cta-shap-3.png" alt="">
</div>
<div class="container">
<div class="row align-items-center">
<div class="col-xl-9 col-lg-8">
<div class="tp-cta-2">
<div class="tp-cta__content wow fadeInUp text-center text-lg-start" data-wow-duration=".9s"
data-wow-delay=".5s">
<?php
if ( !empty($settings['tp_title']) ) :
printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['tp_title_tag'] ),
$this->get_render_attribute_string( 'title_args' ),
tp_kses( $settings['tp_title'] )
);
endif;
?>
</div>
</div>
</div>
<?php if ( !empty($settings['tp_cta_btn_text']) ) : ?>
<div class="col-xl-3 col-lg-4">
<div class="tp-cta-2__btn text-center text-lg-start pt-20">
<div class="tp-cta-2__btn wow fadeInUp " data-wow-duration=".9s" data-wow-delay=".7s">
<a <?php echo $this->get_render_attribute_string( 'tp-button-arg' ); ?>><?php echo tp_kses($settings['tp_cta_btn_text']); ?></a>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php else:
if ( !empty($settings['tp_image']['url']) ) {
$tp_bg_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_bg_image_alt = get_post_meta($settings["tp_image"]["id"], "_wp_attachment_image_alt", true);
}
// Link
if ('2' == $settings['tp_cta_btn_link_type']) {
$this->add_render_attribute('tp-button-arg', 'href', get_permalink($settings['tp_cta_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');
} else {
if ( ! empty( $settings['tp_cta_btn_link']['url'] ) ) {
$this->add_link_attributes( 'tp-button-arg', $settings['tp_cta_btn_link'] );
$this->add_render_attribute('tp-button-arg', 'class', 'tp-btn');
}
}
$this->add_render_attribute('title_args', 'class', 'cta-title-1');
?>
<section class="cta-area cta-opasity pt-170 pb-180 p-relative include-bg jarallax ele-section"
data-background="<?php echo esc_url($tp_bg_image); ?>">
<div class="container">
<div class="row">
<div class="col-xl-12">
<div class="cta__content text-center z-index-1">
<?php if (!empty($settings['tp_sub_title'])): ?>
<span class=" wow fadeInUp " data-wow-duration=".9s" data-wow-delay=".3s"><?php echo tp_kses( $settings['tp_sub_title'] ); ?></span>
<?php endif; ?>
<div class="wow fadeInUp" data-wow-duration=".9s" data-wow-delay=".5s">
<?php
if ( !empty($settings['tp_title']) ) :
printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['tp_title_tag'] ),
$this->get_render_attribute_string( 'title_args' ),
tp_kses( $settings['tp_title'] )
);
endif;
?>
</div>
<?php if (!empty($settings['tp_description'])): ?>
<p><?php echo tp_kses( $settings['tp_description'] ); ?></p>
<?php endif; ?>
<?php if ( !empty($settings['tp_cta_btn_text']) ) : ?>
<div class="cta__btn wow fadeInUp " data-wow-duration=".9s" data-wow-delay=".7s">
<a <?php echo $this->get_render_attribute_string( 'tp-button-arg' ); ?>><?php echo tp_kses($settings['tp_cta_btn_text']); ?></a>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
</section>
<?php endif;
}
}
$widgets_manager->register( new TP_CTA() );