OwlCyberSecurity - MANAGER
Edit File: class-elementor.php
<?php class Chursy_Elementor { function __construct() { // Register Header Footer Category in Pane add_action( 'elementor/elements/categories_registered', array( $this, 'chursy_add_category' ) ); add_action( 'elementor/frontend/after_register_scripts', array( $this, 'chursy_enqueue_scripts' ) ); add_action( 'elementor/widgets/register', array( $this, 'chursy_include_widgets' ) ); add_filter( 'elementor/controls/animations/additional_animations', array( $this, 'chursy_add_animations'), 10 , 0 ); add_action( 'wp_print_footer_scripts', array( $this, 'chursy_enqueue_footer_scripts' ) ); // load icons add_filter( 'elementor/icons_manager/additional_tabs', array( $this, 'chursy_icons_filters_new' ), 9999999, 1 ); // Add icons social custom add_action( 'elementor/element/social-icons/section_social_hover/after_section_end', array( $this, 'chursy_social_icons_custom' ), 10, 2 ); // Add text editor custom control style add_action( 'elementor/element/text-editor/section_style/after_section_end', array( $this, 'chursy_text_editor_custom' ), 10, 2 ); // Add accordion custom control style add_action( 'elementor/element/accordion/section_toggle_style_content/after_section_end', array( $this, 'chursy_accordion_custom' ), 10, 2 ); // Add customize icon box add_action( 'elementor/element/icon-box/section_style_content/after_section_end', array( $this, 'chursy_icon_box_custom' ), 10, 2 ); // Add customize image box add_action( 'elementor/element/image-box/section_style_content/after_section_end', array( $this, 'chursy_image_box_custom' ), 10, 2 ); // button control style add_action( 'elementor/element/button/section_button/after_section_end', array( $this, 'chursy_button_custom' ), 10, 2 ); // Remove animations style from Elementor add_action( 'wp_enqueue_scripts', array( $this, 'chursy_remove_animations_styles' ) ); } function chursy_add_category( ) { \Elementor\Plugin::instance()->elements_manager->add_category( 'hf', [ 'title' => __( 'Header Footer', 'chursy' ), 'icon' => 'fa fa-plug', ] ); \Elementor\Plugin::instance()->elements_manager->add_category( 'chursy', [ 'title' => __( 'Chursy', 'chursy' ), 'icon' => 'fa fa-plug', ] ); } function chursy_enqueue_scripts(){ $files = glob(get_theme_file_path('/assets/js/elementor/*.js')); foreach ($files as $file) { $file_name = wp_basename($file); $handle = str_replace(".js", '', $file_name); $src = get_theme_file_uri('/assets/js/elementor/' . $file_name); if (file_exists($file)) { wp_register_script( 'chursy-elementor-' . $handle, $src, ['jquery'], false, true ); } } } function chursy_include_widgets( $widgets_manager ) { $files = glob(get_theme_file_path('elementor/widgets/*.php')); foreach ($files as $file) { $file = get_theme_file_path('elementor/widgets/' . wp_basename($file)); if (file_exists($file)) { require_once $file; } } } function chursy_add_animations(){ $animations = array( 'Chursy' => array( 'ova-move-up' => esc_html__('Move Up', 'chursy'), 'ova-move-down' => esc_html__( 'Move Down', 'chursy' ), 'ova-move-left' => esc_html__('Move Left', 'chursy'), 'ova-move-right' => esc_html__('Move Right', 'chursy'), 'ova-scale-up' => esc_html__('Scale Up', 'chursy'), 'ova-flip' => esc_html__('Flip', 'chursy'), 'ova-helix' => esc_html__('Helix', 'chursy'), 'ova-popup' => esc_html__( 'PopUp','chursy' ) ), ); return $animations; } function chursy_enqueue_footer_scripts(){ // Font Icon wp_enqueue_style('ovaicon', CHURSY_URI.'/assets/libs/ovaicon/font/ovaicon.css', array(), null); // Flaticon wp_enqueue_style('flaticon', CHURSY_URI.'/assets/libs/flaticon/font/flaticon_chursy.css', array(), null); } public function chursy_icons_filters_new( $tabs = array() ) { $newicons = []; $font_data['json_url'] = CHURSY_URI.'/assets/libs/ovaicon/ovaicon.json'; $font_data['name'] = 'ovaicon'; $newicons[ $font_data['name'] ] = [ 'name' => $font_data['name'], 'label' => esc_html__( 'Default', 'chursy' ), 'url' => '', 'enqueue' => '', 'prefix' => 'ovaicon-', 'displayPrefix' => '', 'ver' => '1.0', 'fetchJson' => $font_data['json_url'], ]; // Flaticon Chursy $flaticon_chursy = []; $flaticon_chursy_data['json_url'] = CHURSY_URI.'/assets/libs/flaticon/flaticon_chursy.json'; $flaticon_chursy_data['name'] = 'flaticon'; $newicons[ $flaticon_chursy_data['name'] ] = [ 'name' => $flaticon_chursy_data['name'], 'label' => esc_html__( 'Chursy', 'chursy' ), 'url' => '', 'enqueue' => '', 'prefix' => 'flaticon-', 'displayPrefix' => '', 'ver' => '1.0', 'fetchJson' => $flaticon_chursy_data['json_url'] ]; return array_merge( $tabs, $newicons ); } function chursy_social_icons_custom ( $element, $args ) { /** @var \Elementor\Element_Base $element */ $element->start_controls_section( 'ova_social_icons', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Ova Social Icon', 'chursy' ), ] ); $element->add_responsive_control( 'ova_social_icons_display', [ 'label' => esc_html__( 'Display', 'chursy' ), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'inline-block' => [ 'title' => esc_html__( 'Block', 'chursy' ), 'icon' => 'eicon-h-align-left', ], 'inline-flex' => [ 'title' => esc_html__( 'Flex', 'chursy' ), 'icon' => 'eicon-h-align-center', ], ], 'selectors' => [ '{{WRAPPER}} .elementor-icon.elementor-social-icon' => 'display: {{VALUE}}', ], ] ); $element->end_controls_section(); } // Ova text-editor custom function chursy_text_editor_custom( $element, $args ) { /** @var \Elementor\Element_Base $element */ $element->start_controls_section( 'ova_tabs', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Ova Text Editor', 'chursy' ), ] ); $element->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'link_typography', 'selector' => '{{WRAPPER}} a', ] ); $element->add_control( 'link_color', [ 'label' => esc_html__( 'Link Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} a' => 'color: {{VALUE}};', ], ] ); $element->add_control( 'link_color_hover', [ 'label' => esc_html__( 'Link Color Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} a:hover' => 'color: {{VALUE}};', ], ] ); $element->add_responsive_control( 'text_margin', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} p' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $element->add_responsive_control( 'text_padding', [ 'label' => esc_html__( 'Padding', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} p' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $element->end_controls_section(); } // Accordion custom function chursy_accordion_custom( $element, $args ) { /** @var \Elementor\Element_Base $element */ $element->start_controls_section( 'ova_accordion', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Ova Accordion', 'chursy' ), ] ); // Accordion item options $element->add_control( 'accordion_item_options', [ 'label' => esc_html__( 'Item Options', 'chursy' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $element->add_control( 'accordion_item_background_color', [ 'label' => esc_html__( 'Background Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-accordion-item' => 'background-color: {{VALUE}}', ], ] ); $element->add_responsive_control( 'accordion_item_margin', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-accordion-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $element->add_control( 'accordion_item_border_radius', [ 'label' => esc_html__( 'Border Radius', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-accordion-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); // Title options $element->add_control( 'title_options', [ 'label' => esc_html__( 'Title Options', 'chursy' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $element->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'title_active_border', 'selector' => '{{WRAPPER}} .elementor-accordion .elementor-tab-title , {{WRAPPER}} .elementor-accordion .elementor-tab-title.elementor-active', ] ); $element->add_control( 'border_color_title_active', [ 'label' => esc_html__( 'Title Active Border Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title.elementor-active' => 'border-color: {{VALUE}}', ], ] ); // Icon options $element->add_control( 'icon_heading', [ 'label' => esc_html__( 'Icon', 'chursy' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $element->add_responsive_control( 'icon_size', [ 'label' => esc_html__( 'Size', 'chursy' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title .elementor-accordion-icon i' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $element->add_responsive_control( 'icon_margin', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title .elementor-accordion-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $element->end_controls_section(); } function chursy_icon_box_custom($element, $args){ $element->start_controls_section( 'ova_icon_box_customize', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Ova Icon Box', 'chursy' ), ] ); $element->add_control( 'icon_heading', [ 'label' => esc_html__( 'Icon', 'chursy' ), 'type' => \Elementor\Controls_Manager::HEADING, ] ); $element->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'icon_box_shadow', 'selector' => '{{WRAPPER}} .elementor-icon', ] ); $element->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'icon_box_border', 'selector' => '{{WRAPPER}} .elementor-icon', ] ); $element->add_control( 'content_heading', [ 'label' => esc_html__( 'Content', 'chursy' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $element->add_control( 'title_color_hover', [ 'label' => esc_html__( 'Title Color Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-widget-container:hover .elementor-icon-box-title' => 'color: {{VALUE}}', ], ] ); $element->add_control( 'description_color_hover', [ 'label' => esc_html__( 'Description Color Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-widget-container:hover .elementor-icon-box-description' => 'color: {{VALUE}}', ], ] ); $element->add_responsive_control( 'title_margin', [ 'label' => esc_html__( 'Title Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .elementor-icon-box-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $element->end_controls_section(); } function chursy_image_box_custom($element, $args){ $element->start_controls_section( 'ova_image_box_customize', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Ova Image Box', 'chursy' ), ] ); $element->add_control( 'content_heading', [ 'label' => esc_html__( 'Content', 'chursy' ), 'type' => \Elementor\Controls_Manager::HEADING, ] ); $element->add_control( 'title_color_hover', [ 'label' => esc_html__( 'Title Color Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-widget-container:hover .elementor-image-box-title' => 'color: {{VALUE}}', ], ] ); $element->add_control( 'description_color_hover', [ 'label' => esc_html__( 'Description Color Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-widget-container:hover .elementor-image-box-description' => 'color: {{VALUE}}', ], ] ); $element->add_responsive_control( 'title_margin', [ 'label' => esc_html__( 'Title Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $element->end_controls_section(); } function chursy_button_custom ( $element, $args ) { /** @var \Elementor\Element_Base $element */ $element->start_controls_section( 'ova_buton', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Ova Button', 'chursy' ), ] ); $element->add_responsive_control( 'button_display', [ 'label' => esc_html__( 'Display', 'chursy' ), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'block' => [ 'title' => esc_html__( 'Block', 'chursy' ), 'icon' => 'eicon-h-align-left', ], 'flex' => [ 'title' => esc_html__( 'Flex', 'chursy' ), 'icon' => 'eicon-h-align-center', ], ], 'selectors' => [ '{{WRAPPER}} .elementor-button-wrapper .elementor-button' => 'display: {{VALUE}}; justify-content:space-between', ], ] ); $element->add_responsive_control( 'max_width', [ 'label' => esc_html__( 'Max Width', 'chursy' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 90, 'max' => 600, 'step' => 1, ], '%' => [ 'min' => 20, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-button-wrapper .elementor-button' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $element->end_controls_section(); } // Remove animations style from Elementor public function chursy_remove_animations_styles() { // Deregister the stylesheet by handle foreach ( $this->chursy_add_animations() as $animations ) { if ( !empty( $animations ) && is_array( $animations ) ) { foreach ( array_keys( $animations ) as $animation ) { wp_deregister_style( 'e-animation-'.$animation ); wp_enqueue_style( 'e-animation-'.$animation, CHURSY_URI.'/assets/scss/none.css', array(), null); } } } } } return new Chursy_Elementor();