File: //proc/thread-self/cwd/wp-content/plugins/ftech-plugin/elementor/elementor-init.php
<?php
/**
* All Elementor widget init
* @package ftech
* @since 1.0.0
*/
if ( !defined('ABSPATH') ){
exit(); // exit if access directly
}
if ( !class_exists('Ftech_Elementor_Widget_Init') ){
class Ftech_Elementor_Widget_Init{
/*
* $instance
* @since 1.0.0
* */
private static $instance;
/*
* construct()
* @since 1.0.0
* */
public function __construct() {
add_action( 'elementor/elements/categories_registered', array($this,'_widget_categories') );
//elementor widget registered
add_action('elementor/widgets/register',array($this,'_widget_registered'));
add_action('elementor/editor/after_enqueue_styles',array($this,'editor_style'));
add_action('elementor/documents/register_controls',array($this,'register_ftech_page_controls'));
add_action('wp_enqueue_scripts', [$this, 'register_widget_styles']);
}
/*
* getInstance()
* @since 1.0.0
* */
public static function getInstance(){
if ( null == self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* _widget_categories()
* @since 1.0.0
* */
public function _widget_categories($elements_manager){
$elements_manager->add_category(
'ftech_widgets',
[
'title' => __( 'ftech Addons', 'ftech-plugin' ),
'icon' => 'fa fa-plug'
]
);
}
/**
* _widget_registered()
* @since 1.0.0
* */
public function _widget_registered(){
if( !class_exists('Elementor\Widget_Base') ){
return;
}
$elementor_widgets = array(
// ftech Theme Widgets
'header',
'hero',
'hero-2',
'service-carousle',
'service',
'blog',
'heading',
'pricing-section',
'feature-section',
'moving-text',
'testimonial',
'projects-carousel',
'image-box',
'button',
'list-item',
'brand-carousel',
'about-area',
'newsletter',
'animated-border',
'projects',
'about-info',
'info-box',
'ftech-tab',
'pricing-table',
'team',
'counter',
'faq',
'cta',
'hero-three',
'video-popup',
'video-banner',
'service-list',
'hero-4',
'about-area-2',
'brand-section',
'choose-section',
'cta-area',
'divider',
'gallery',
'hero-5',
'cube-animation',
'progress',
'pricing-item',
'counter-area',
'social',
'footer',
'animation-matter',
'service-sidebar',
'contact-info',
'team-single-info',
);
$elementor_widgets = apply_filters('ftech_elementor_widget',$elementor_widgets);
if ( is_array($elementor_widgets) && !empty($elementor_widgets) ) {
foreach ( $elementor_widgets as $widget ){
$widget_file = 'plugins/elementor/widget/'.$widget.'.php';
$template_file = locate_template($widget_file);
if ( !$template_file || !is_readable( $template_file ) ) {
$template_file = FTECH_DIR_PATH.'/elementor/widgets/'.$widget.'.php';
}
if ( $template_file && is_readable( $template_file ) ) {
include_once $template_file;
}
}
}
}
public function register_widget_styles(){
}
public function editor_style(){
$cs_icon = plugins_url( 'icons.png', __FILE__ );
wp_add_inline_style( 'elementor-editor', '.elementor-element .icon .ftech-custom-icon{content: url( '.$cs_icon.');width: 28px;}' );
}
/**
* Elemenotr Page Settings
*
* @param [type] $document
* @return void Elementor Page Settings
*/
public function register_ftech_page_controls( $document ) {
if ( ! $document instanceof \Elementor\Core\DocumentTypes\PageBase || ! $document::get_property( 'has_elements' ) ) {
return;
}
$document->start_controls_section(
'body_ftech_style',
[
'label' => esc_html__( 'ftech Custom Body Style', 'ftech-plugin' ),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
]
);
$document->add_control(
'body_color',
[
'label' => esc_html__( 'Body Color', 'textdomain' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}' => 'color: {{VALUE}}',
],
]
);
$document->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'label' => esc_html__( 'Page Body Font', 'textdomain' ),
'name' => 'page_body_font',
'selector' => '{{WRAPPER}}',
]
);
$document->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'label' => esc_html__( 'Page Heading', 'textdomain' ),
'name' => 'page_heading_font',
'selector' => '{{WRAPPER}} h1, h2, h3, h4, h5, h6',
]
);
$document->add_control(
'h_color',
[
'label' => esc_html__( 'Heading Color', 'textdomain' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} h1, h2, h3, h4, h5, h6' => 'color: {{VALUE}}',
],
]
);
$document->add_group_control(
\Elementor\Group_Control_Background::get_type(),
[
'name' => 'body_bg_color',
'types' => [ 'classic' ],
'exclude' => [ 'color' ],
'selector' => '{{WRAPPER}} .body-bg-1',
'fields_options' => [
'background' => [
'label' => esc_html__( 'Body Custom BG Image ', 'ftech-plugin' ),
'description' => esc_html__( 'Choose background type and style.', 'ftech-plugin' ),
'separator' => 'before',
]
]
]
);
$document->end_controls_section();
}
}
if ( class_exists('Ftech_Elementor_Widget_Init') ){
Ftech_Elementor_Widget_Init::getInstance();
}
}//end if