File: /mnt/data/companiesonthegouk/wp-content/plugins/apper-core/includes/elementor-widgets.php
<?php
/*
* @package AcmThemes Base
* @author AcmeeDesign
* @link https://acmeedesign.com
* @since 1.0
*/
if ( ! defined( 'ABSPATH' ) ) exit;
class AcmThemes_Elementor_Widgets_base {
private static $instance = null;
public static function get_instance() {
if ( ! self::$instance )
self::$instance = new self;
return self::$instance;
}
public function init(){
add_action('elementor/frontend/after_register_scripts', array($this, 'enqueue_scripts'));
add_action( 'elementor/widgets/register', array( $this, 'widgets_registered' ) );
add_action( 'elementor/elements/categories_registered', array( $this, 'add_apper_widgets_category' ), 1 );
}
public function enqueue_scripts() {
wp_enqueue_script( 'admin-scripts', ACMBASE_JS_DIR_URI . 'frontend.js', [ 'jquery' ], ACMBASE_VERSION, true );
}
public function widgets_registered() {
// We check if the Elementor plugin has been installed / activated.
if(defined('ELEMENTOR_PATH') && class_exists('Elementor\Widget_Base')){
foreach (glob(plugin_dir_path(__FILE__) . 'elementor-widgets/acm-*.php') as $template_file)
{
if ( $template_file && is_readable( $template_file ) ) {
include_once $template_file;
}
}
}
}
public function add_apper_widgets_category( $elements_manager ) {
$elements_manager->add_category(
'apper',
[
'title' => esc_html__( 'Apper', 'apper' ),
'icon' => 'fa fa-plug',
]
);
}
}
AcmThemes_Elementor_Widgets_base::get_instance()->init();