D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
cwd
/
wp-content
/
plugins
/
aeen-core
/
elementor
/
practice
/
Filename :
class.php
back
Copy
<?php /** * This file can be overridden by copying it to yourtheme/elementor-custom/title/class.php * * @author RadiusTheme * @since 1.0 * @version 1.0 */ namespace radiustheme\Aeen_Core; use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Background; use radiustheme\aeen\inc\RDTheme; use radiustheme\aeen\inc\Helper; if ( ! defined( 'ABSPATH' ) ) exit; class Rt_Practice extends Custom_Widget_Base { public function __construct( $data = [], $args = null ){ $this->rt_name = __( 'RT Practices', 'aeen-core' ); $this->rt_base = 'rt-practice'; $this->rt_translate = array( 'cols' => array( '12' => esc_html__( '1 Col', 'aeen-core' ), '6' => esc_html__( '2 Col', 'aeen-core' ), '4' => esc_html__( '3 Col', 'aeen-core' ), '3' => esc_html__( '4 Col', 'aeen-core' ), '2' => esc_html__( '6 Col', 'aeen-core' ), ), ); parent::__construct( $data, $args ); } public function rt_fields(){ $cpt = AEEN_CORE_CPT; $terms = get_terms( array( 'taxonomy' => "{$cpt}_practice_category", 'fields' => 'id=>name' ) ); $category_dropdown = array( '0' => esc_html__( 'All Categories', 'aeen-core' ) ); foreach ( $terms as $id => $name ) { $category_dropdown[$id] = $name; } $fields = array( array( 'mode' => 'section_start', 'id' => 'sec_general_layout', 'label' => esc_html__( 'General', 'aeen-core' ), ), array( 'type' => Controls_Manager::SELECT2, 'id' => 'style', 'label' => esc_html__( 'Layout', 'aeen-core' ), 'options' => array( 'style1' => esc_html__( 'Style 1', 'aeen-core' ), 'style2' => esc_html__( 'Style 2', 'aeen-core' ), 'style3' => esc_html__( 'Style 3', 'aeen-core' ), ), 'default' => 'style1', ), array( 'mode' => 'section_end', ), array( 'mode' => 'section_start', 'id' => 'sec_general_qurey', 'label' => esc_html__( 'Qurey', 'aeen-core' ), ), array( 'type' => Controls_Manager::NUMBER, 'mode' => 'responsive', 'id' => 'number', 'label' => esc_html__( 'Total number of items', 'aeen-core' ), 'default' => 6, 'description' => esc_html__( 'Write -1 to show all', 'aeen-core' ), ), array( 'type' => Controls_Manager::SELECT2, 'id' => 'cat', 'label' => esc_html__( 'Categories', 'aeen-core' ), 'options' => $category_dropdown, 'default' => '0', ), array( 'type' => Controls_Manager::SELECT2, 'id' => 'orderby', 'label' => esc_html__( 'Order By', 'aeen-core' ), 'options' => array( 'date' => esc_html__( 'Date (Recents comes first)', 'aeen-core' ), 'title' => esc_html__( 'Title', 'aeen-core' ), 'menu_order' => esc_html__( 'Custom Order (Available via Order field inside Page Attributes box)', 'aeen-core' ), ), 'default' => 'date', ), array( 'mode' => 'section_end', ), array( 'mode' => 'section_start', 'id' => 'sec_general_display', 'label' => esc_html__( 'Display', 'aeen-core' ), ), array( 'type' => Controls_Manager::SWITCHER, 'id' => 'services_imgover_icon', 'label' => esc_html__( 'Services Icon Show', 'aeen-core' ), 'label_on' => esc_html__( 'On', 'aeen-core' ), 'label_off' => esc_html__( 'Off', 'aeen-core' ), 'default' => 'yes', 'description' => esc_html__( 'Show or Hide Services Icon. Default: On', 'aeen-core' ), 'condition' => array( 'style' => 'style2' ), ), array( 'type' => Controls_Manager::SWITCHER, 'id' => 'services_content', 'label' => esc_html__( 'Services Content Show', 'aeen-core' ), 'label_on' => esc_html__( 'On', 'aeen-core' ), 'label_off' => esc_html__( 'Off', 'aeen-core' ), 'default' => 'yes', 'description' => esc_html__( 'Show or Hide Services Content. Default: On', 'aeen-core' ), ), array( 'type' => Controls_Manager::NUMBER, 'id' => 'count', 'label' => esc_html__( 'Word count', 'aeen-core' ), 'default' => 20, 'description' => esc_html__( 'Maximum number of words', 'aeen-core' ), 'condition' => array( 'services_content' => 'yes' ), ), array( 'mode' => 'section_end', ), // Responsive Columns array( 'mode' => 'section_start', 'id' => 'sec_responsive', 'label' => esc_html__( 'Number of Responsive Columns', 'aeen-core' ), 'condition' => array( 'style' => 'style3' ), ), array( 'type' => Controls_Manager::SELECT2, 'id' => 'col_lg', 'label' => esc_html__( 'Desktops: > 1199px', 'aeen-core' ), 'options' => $this->rt_translate['cols'], 'default' => '4', ), array( 'type' => Controls_Manager::SELECT2, 'id' => 'col_md', 'label' => esc_html__( 'Desktops: > 991px', 'aeen-core' ), 'options' => $this->rt_translate['cols'], 'default' => '4', ), array( 'type' => Controls_Manager::SELECT2, 'id' => 'col_sm', 'label' => esc_html__( 'Tablets: > 767px', 'aeen-core' ), 'options' => $this->rt_translate['cols'], 'default' => '6', ), array( 'type' => Controls_Manager::SELECT2, 'id' => 'col_xs', 'label' => esc_html__( 'Phones: < 768px', 'aeen-core' ), 'options' => $this->rt_translate['cols'], 'default' => '12', ), array( 'mode' => 'section_end', ), // Box style array( 'mode' => 'section_start', 'id' => 'box_style', 'label' => esc_html__( 'Box Style', 'aeen-core' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => array( 'style' => array( 'style1' ) ), ), array( 'id' => 'box_bg_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Background Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1' => 'background-color: {{VALUE}}', '{{WRAPPER}} .practice-box-layout2' => 'background-color: {{VALUE}}', ), ), array( 'mode' => 'group', 'type' => Group_Control_Background::get_type(), 'name' => 'box_bgov_img', 'label' => esc_html__( 'Background Image', 'aeen-core' ), 'selector' => '{{WRAPPER}} .practice-box-layout1:hover:before', ), array( 'id' => 'box_bg_overlay_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Overlay Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1:after' => 'background-color: {{VALUE}}', ), ), array( 'mode' => 'section_end', ), // Icon style array( 'mode' => 'section_start', 'id' => 'icon_style', 'label' => esc_html__( 'Icon Style', 'aeen-core' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => array( 'style' => array( 'style1', 'style2' ) ), ), array( 'id' => 'icon_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1 .item-icon i:before' => 'color: {{VALUE}}', '{{WRAPPER}} .practice-box-layout1.practice-box-layout2 .item-icon i:before' => 'color: {{VALUE}}', ), ), array( 'mode' => 'group', 'type' => Group_Control_Typography::get_type(), 'name' => 'icon_typo', 'label' => esc_html__( 'Typography', 'aeen-core' ), 'selector' => '{{WRAPPER}} .practice-box-layout1 .item-icon i:before, {{WRAPPER}} .practice-box-layout1.practice-box-layout2 .item-icon i:before', ), array( 'id' => 'boxh_icon_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Box Hover Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1:hover .item-icon i' => 'color: {{VALUE}}', ), 'condition' => array( 'style' => array( 'style1' ) ), ), array( 'mode' => 'section_end', ), // Title style array( 'mode' => 'section_start', 'id' => 'title_style', 'label' => esc_html__( 'Title Style', 'aeen-core' ), 'tab' => Controls_Manager::TAB_STYLE, ), array( 'id' => 'title_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1 .item-title a' => 'color: {{VALUE}}', '{{WRAPPER}} .practice-box-layout1.practice-box-layout2 .item-title a' => 'color: {{VALUE}}', ), ), array( 'mode' => 'group', 'type' => Group_Control_Typography::get_type(), 'name' => 'title_typo', 'label' => esc_html__( 'Typography', 'aeen-core' ), 'selector' => '{{WRAPPER}} .practice-box-layout1 .item-title a, {{WRAPPER}} .practice-box-layout1.practice-box-layout2 .item-title a', ), array( 'id' => 'titleh_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Hover Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1 .item-title a:hover' => 'color: {{VALUE}}', '{{WRAPPER}} .practice-box-layout1.practice-box-layout2 .item-title a:hover' => 'color: {{VALUE}}', ), ), array( 'id' => 'boxh_title_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Box Hover Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1:hover .item-title a' => 'color: {{VALUE}}', ), 'condition' => array( 'style' => array( 'style1' ) ), ), array( 'mode' => 'section_end', ), // Content style array( 'mode' => 'section_start', 'id' => 'content_style', 'label' => esc_html__( 'Content Style', 'aeen-core' ), 'tab' => Controls_Manager::TAB_STYLE, ), array( 'id' => 'content_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1 p' => 'color: {{VALUE}}', '{{WRAPPER}} .practice-box-layout1.practice-box-layout2 p' => 'color: {{VALUE}}', ), ), array( 'mode' => 'group', 'type' => Group_Control_Typography::get_type(), 'name' => 'content_typo', 'label' => esc_html__( 'Typography', 'aeen-core' ), 'selector' => '{{WRAPPER}} .practice-box-layout1 p, {{WRAPPER}} .practice-box-layout1.practice-box-layout2 p', ), array( 'id' => 'boxh_content_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Box Hover Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1:hover p' => 'color: {{VALUE}}', ), 'condition' => array( 'style' => array( 'style1' ) ), ), array( 'mode' => 'section_end', ), // Read More style array( 'mode' => 'section_start', 'id' => 'readmore_style', 'label' => esc_html__( 'Read More', 'aeen-core' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => array( 'style' => array( 'style2', 'style3' ) ), ), array( 'id' => 'readmore_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1.practice-box-layout2 a.item-link' => 'color: {{VALUE}}', ), ), array( 'mode' => 'group', 'type' => Group_Control_Typography::get_type(), 'name' => 'readmore_typo', 'label' => esc_html__( 'Typography', 'aeen-core' ), 'selector' => '{{WRAPPER}} .practice-box-layout1.practice-box-layout2 a.item-link', ), array( 'id' => 'readmoreh_color', 'type' => Controls_Manager::COLOR, 'label' => __( 'Hover Color', 'aeen-core' ), 'default' => '', 'selectors' => array( '{{WRAPPER}} .practice-box-layout1.practice-box-layout2 a.item-link:hover' => 'color: {{VALUE}}', ), ), array( 'mode' => 'section_end', ), ); return $fields; } protected function render() { $data = $this->get_settings(); switch ($data['style']) { case 'style3': $template = 'view-3'; break; case 'style2': $template = 'view-2'; break; default: $template = 'view-1'; break; } return $this->rt_template( $template, $data ); } } // Current file ajax settings $current_url=esc_url("//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); if( strpos( $current_url, 'action=elementor') == true ){ add_action( 'wp_footer', function() { if ( ! defined( 'ELEMENTOR_VERSION' ) ) { return; } wp_enqueue_script( 'aeen-core', AEEN_CORE_BASE_URL . 'assets/js/aeen-core.js' , array(), '', true ); // make the ajaxurl var available to the above script wp_localize_script( 'aeen-core', 'rtajax_handler', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), ) ); } ); }