-
Notifications
You must be signed in to change notification settings - Fork 0
/
modules.php
49 lines (41 loc) · 1.48 KB
/
modules.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Main Modules class
*/
class Modules {
/**
* @var Module_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/widgets/widgets_registered', array( $this, 'widgets_registered' ) );
add_action( 'elementor/widget/posts/skins_init', array( $this,'skin_registered'), 1 );
}
public function skin_registered($widget) {
// We check if the Elementor plugin has been installed / activated.
if(defined('ELEMENTOR_PATH') && class_exists('ElementorPro\Modules\Posts\Skins\Skin_Cards')){
$path = ECW_PLUGIN_PLUGIN_PATH.'modules/*/skins';
$skin_name = glob($path.'/skin-*.php');
foreach ( $skin_name as $skin ) {
require_once $skin;
}
}
}
public function widgets_registered() {
// We check if the Elementor plugin has been installed / activated.
if( defined('ELEMENTOR_PATH') && class_exists('Elementor\Widget_Base') ){
$path = ECW_PLUGIN_PLUGIN_PATH.'modules/*/widgets';
$module_name = glob($path.'/widget-*.php');
foreach ( $module_name as $widget ) {
require_once( $widget );
}
}
}
}
Modules::get_instance()->init();