File: /mnt/data/mentoring-wp/wp-content/plugins/mentoring-elementor/class-widgets.php
<?php
/**
* Widgets class.
*
* @category Class
* @package ElementorMentoring
* @subpackage WordPress
* @author Dreamslms
* @copyright Dreamslms
* @license https://mentoring-wp.dreamstechnologies.com/
* @since 1.0.0
* php version 7.3.9
*/
namespace ElementorMentoring;
// Security Note: Blocks direct access to the plugin PHP files.
defined( 'ABSPATH' ) || die();
/**
* Class Plugin
*
* Main Plugin class
*
* @since 1.0.0
*/
class Widgets {
/**
* Instance
*
* @since 1.0.0
* @access private
* @static
*
* @var Plugin The single instance of the class.
*/
private static $instance = null;
/**
* Instance
*
* Ensures only one instance of the class is loaded or can be loaded.
*
* @since 1.0.0
* @access public
*
* @return Plugin An instance of the class.
*/
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Registers the widget scripts.
*
* Load required plugin core files.
*
* @since 1.0.0
* @access public
*/
public function widget_scripts() {
//wp_register_script( 'mentoring_elementor', plugins_url( '/assets/js/elementormentoring.js', __FILE__ ), array( 'jquery' ), '1.0.0', true );
}
public function backend_preview_scripts() {
wp_enqueue_script( 'elementor-preview-mentoring', plugins_url( '/assets/js/elementor_preview_mentoring.js', __FILE__ ), array( 'jquery' ), '1.0.0', true );
}
/**
* Include Widgets files
*
* Load widgets files
*
* @since 1.0.0
* @access private
*/
private function include_widgets_files() {
require_once 'widgets/class-headline.php';
require_once 'widgets/class-hero-main.php';
require_once 'widgets/class-iconbox2.php';
require_once 'widgets/class-mentors-carousel.php';
require_once 'widgets/class-imagebox.php';
require_once 'widgets/class-post-grid.php';
require_once 'widgets/class-counter.php';
require_once 'widgets/class-testimonials.php';
require_once 'widgets/class-icon-list.php';
require_once 'widgets/class-accordion.php';
require_once 'widgets/class-post-grid-full.php';
require_once 'widgets/class-portfolio-grid.php';
// home search boxes
}
/**
* Register Widgets
*
* Register new Elementor widgets.
*
* @since 1.0.0
* @access public
*/
public function register_widgets() {
// It's now safe to include Widgets files.
$this->include_widgets_files();
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Headline() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\HomeHeroMain() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\IconBoxTwo() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\MentoringCarousel() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\MentoringImagebox() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\PostGrid() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\IconBoxCounter() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Testimonials() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Menroting_Widget_Icon_List() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Widget_Mentoring_Accordion() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\PostGridFull() );
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\PortfolioGrid() );
}
/**
* Plugin class constructor
*
* Register plugin action hooks and filters
*
* @since 1.0.0
* @access public
*/
public function __construct() {
add_action( 'elementor/elements/categories_registered', array( $this, 'create_custom_categories') );
// Register the widget scripts.
add_action( 'elementor/frontend/after_register_scripts', array( $this, 'widget_scripts' ) );
add_action('elementor/preview/enqueue_styles', array($this, 'backend_preview_scripts'), 10);
//add_action('elementor/frontend/after_register_scripts', array($this, 'cocobasic_frontend_enqueue_script'));
// Register the widgets.
add_action( 'elementor/widgets/widgets_registered', array( $this, 'register_widgets' ) );
}
function create_custom_categories( $elements_manager ) {
$elements_manager->add_category(
'mentoring',
[
'title' => __( 'Mentoring', 'plugin-name' ),
'icon' => 'fa fa-clipboard',
]
);
}
}
// Instantiate the Widgets class.
Widgets::instance();