File "pricing.php"
Full Path: /home/flipjqml/onlinebetsolution.com/next_old/wp-content/plugins/cyarb-toolkit/widgets/pricing.php
File size: 13.51 KB
MIME-type: text/x-php
Charset: utf-8
<?php
namespace Elementor;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Pricing_table extends Widget_Base {
public function get_name() {
return 'cyarb-pricing-table';
}
public function get_title() {
return __( 'Pricing Table', 'cyarb-hero' );
}
public function get_icon() {
return ' eicon-price-list';
}
public function get_categories() {
return [ 'cyarb-elements' ];
}
protected function register_controls() {
// Pricing Plan controls
$this-> start_controls_section(
'cyarb_monthly_plan',
[
'label' => esc_html__('Pricing Plan', 'cyarb-toolkit'),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$repeater = new Repeater();
$repeater->add_control(
'monthly_type', [
'label' => esc_html__( 'Pricing Type', 'cyarb-toolkit' ),
'type'=>Controls_Manager:: TEXT,
]
);
$repeater->add_control(
'price_content_text',
[
'label'=>esc_html__('Pricing Content', 'cyarb-toolkit'),
'type'=>Controls_Manager:: TEXT,
]
);
$repeater->add_control(
'monthly_price', [
'label' => esc_html__( 'Price Amount', 'cyarb-toolkit' ),
'type'=>Controls_Manager:: TEXT,
]
);
$repeater->add_control(
'duration_type', [
'label' => esc_html__( 'Duration Type', 'cyarb-toolkit' ),
'type'=>Controls_Manager:: TEXT,
]
);
$repeater->add_control(
'price_bottom_text', [
'label' => esc_html__( 'Price Bottom Text', 'cyarb-toolkit' ),
'type'=>Controls_Manager:: TEXT,
]
);
$repeater->add_control(
'btn_text',
[
'label'=>esc_html__('Button Title', 'cyarb-toolkit'),
'type'=>Controls_Manager:: TEXT,
]
);
$repeater->add_control(
'link_type',
[
'label' => esc_html__( 'Link Type', 'cyarb-toolkit' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => [
'1' => esc_html__( 'Link To Page', 'cyarb-toolkit' ),
'2' => esc_html__( 'External Link', 'cyarb-toolkit' ),
],
]
);
$repeater->add_control(
'link_to_page',
[
'label' => esc_html__( 'Link Page', 'cyarb-toolkit' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => cyarb_toolkit_get_page_as_list(),
'condition' => [
'link_type' => '1',
]
]
);
$repeater->add_control(
'external_link',
[
'label'=>esc_html__('External Link', 'cyarb-toolkit'),
'type'=>Controls_Manager:: TEXT,
'condition' => [
'link_type' => '2',
]
]
);
//Target Page
$repeater->add_control(
'target_page',
[
'label' => esc_html__( 'Link Open In New Tab?', 'cyarb-toolkit' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'cyarb-toolkit' ),
'label_off' => esc_html__( 'No', 'cyarb-toolkit' ),
'return_value' => 'yes',
'default' => 'yes',
]
);
$repeater->add_control(
'feature_text',
[
'label'=>esc_html__('Feature Text', 'cyarb-toolkit'),
'type'=>Controls_Manager:: TEXT,
]
);
$repeater->add_control(
'price_list', [
'label' => esc_html__( 'Pricing List', 'cyarb-toolkit' ),
'type'=>Controls_Manager:: WYSIWYG,
]
);
$repeater->add_control(
'popular_text',
[
'label'=>esc_html__('Popular Text', 'cyarb-toolkit'),
'type'=>Controls_Manager:: TEXT,
]
);
$this->add_control(
'all_monthly_plan',
[
'label' => esc_html__( 'Add Pricing Plan', 'cyarb-toolkit' ),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
]
);
$this-> end_controls_section();
$this->start_controls_section(
'section_style',
[
'label' => esc_html__( 'Style', 'cyarb-toolkit' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-pricing-box .pricing-header h3' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => __( 'Title Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .single-pricing-box .pricing-header h3',
]
);
$this->add_control(
'price_content_color',
[
'label' => esc_html__( 'Price Content Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} p' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'price_content_typography',
'label' => __( 'Price Content Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} p',
]
);
$this->add_control(
'price_color',
[
'label' => esc_html__( 'Price Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-pricing-box .price h4' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'price_typography',
'label' => __( 'Price Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .single-pricing-box .price h4',
]
);
$this->add_control(
'price_duration_color',
[
'label' => esc_html__( 'Price Duration Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-pricing-box .price h4 span' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'price_duration_typography',
'label' => __( 'Price Duration Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .single-pricing-box .price h4 span',
]
);
$this->add_control(
'feature_text_color',
[
'label' => esc_html__( 'Feature Text Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-pricing-box .features-list h5' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'feature_text_typography',
'label' => __( 'Feature Text Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .single-pricing-box .features-list h5',
]
);
$this->add_control(
'price_list_color',
[
'label' => esc_html__( 'Price Lists Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-pricing-box .features-list ul li' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'price_list_typography',
'label' => __( 'Price Lists Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .single-pricing-box .features-list ul li',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
?>
<div class="pricing-area pt-100 pb-75">
<div class="container">
<div class="row justify-content-center">
<?php
if ( $settings['all_monthly_plan']!='' ) :
foreach ( $settings['all_monthly_plan'] as $item ) :
if($item['monthly_type']!='' || $item['monthly_price']!='') {
// Get Plan Button link
$link_source = '';
if($item['link_type'] == 1){
$link_source = get_page_link($item['link_to_page']);
} else {
$link_source = $item['external_link'];
}?>
<div class="col-xl-3 col-lg-6 col-md-6 col-sm-6">
<div class="single-pricing-box">
<div class="pricing-header">
<h3><?php echo esc_html($item['monthly_type']); ?></h3>
<p><?php echo esc_html($item['price_content_text']); ?></p>
</div>
<div class="price">
<h4><?php echo esc_html($item['monthly_price']); ?><span><?php echo esc_html($item['duration_type']); ?></span></h4>
<p><?php echo esc_html($item['price_bottom_text']); ?></p>
</div>
<?php if( $item['btn_text'] !='' ) :
if ( 'yes' === $item['target_page'] ) { ?>
<a target="_blank" href="<?php echo esc_url($link_source); ?>" class="link-btn"><?php echo esc_html($item['btn_text']); ?></a> <?php
} else { ?>
<a href="<?php echo esc_url($link_source); ?>" class="link-btn"><?php echo esc_html($item['btn_text']); ?></a><?php
}
endif; ?>
<div class="features-list">
<h5><?php echo esc_html($item['feature_text']); ?></h5>
<ul>
<?php $inner_list = explode(",", $item['price_list']);
foreach( $inner_list as $list ) :
if( $list !='' ) : ?>
<li> <?php echo wp_kses_post( $list ); ?></li><?php
endif;
endforeach;
?>
</ul>
</div>
<?php if( $item['popular_text'] !='' ) : ?>
<div class="ribbon"><span><?php echo esc_html($item['popular_text']); ?></span></div>
<?php endif;?>
</div>
</div><?php
}
endforeach;
endif;
?>
</div>
</div>
</div>
<?php
}
}
Plugin::instance()->widgets_manager->register_widget_type( new Pricing_table );