PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.1
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.1
4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / core / build-widgets.php
elementskit-lite / core Last commit date
activation-actions.php 4 years ago build-inline-scripts.php 3 weeks ago build-modules.php 4 months ago build-widgets.php 4 months ago config-list.php 4 months ago editor-promotion.php 3 weeks ago handler-api.php 6 months ago handler-widget.php 4 years ago plugin-unsubscribe.php 3 weeks ago
build-widgets.php
98 lines
1 <?php
2 namespace ElementsKit_Lite\Core;
3
4 use ElementsKit_Lite\Libs\Framework\Attr;
5
6 defined( 'ABSPATH' ) || exit;
7
8 class Build_Widgets {
9
10 /**
11 * Collection of default widgets.
12 *
13 * @since 1.0.0
14 * @access private
15 */
16 private $widgets;
17
18 use \ElementsKit_Lite\Traits\Singleton;
19
20 public function __construct() {
21
22 new \ElementsKit_Lite\Widgets\Init\Enqueue_Scripts();
23 $this->widgets = \ElementsKit_Lite\Config\Widget_List::instance()->get_list( 'full' );
24
25 // check if the widget is exists
26 foreach ( $this->widgets as $widget ) {
27 $this->add_widget( $widget );
28 }
29
30 add_action( 'elementor/widgets/register', array( $this, 'register_widget' ) );
31 }
32
33
34 public function add_widget( $widget_config ) {
35 $widget_dir = (
36 isset( $widget_config['path'] )
37 ? $widget_config['path']
38 : \ElementsKit_Lite::widget_dir() . $widget_config['slug'] . '/'
39 );
40
41 $widget_file_path = $widget_dir . $widget_config['slug'] . '.php';
42 $widget_handler_file_path = $widget_dir . $widget_config['slug'] . '-handler.php';
43 if (!file_exists($widget_file_path) && !file_exists($widget_handler_file_path)) {
44 return;
45 }
46
47 include $widget_file_path;
48 include $widget_handler_file_path;
49
50 $base_class_name = (
51 ( isset( $widget_config['base_class_name'] ) )
52 ? $widget_config['base_class_name']
53 : '\Elementor\ElementsKit_Widget_' . \ElementsKit_Lite\Utils::make_classname( $widget_config['slug'] )
54 );
55
56 $handler = $base_class_name . '_Handler';
57 $handler_class = new $handler();
58
59 if ( $handler_class->scripts() != false ) {
60 add_action( 'wp_enqueue_scripts', array( $handler_class, 'scripts' ) );
61 }
62
63 if ( $handler_class->styles() != false ) {
64 add_action( 'wp_enqueue_scripts', array( $handler_class, 'styles' ) );
65 }
66
67 if ( $handler_class->inline_css() != false ) {
68 wp_add_inline_style( 'elementskit-init-css', $handler_class->inline_css() );
69 }
70
71 if ( $handler_class->inline_js() != false ) {
72 wp_add_inline_script( 'elementskit-init-js', $handler_class->inline_js() );
73 }
74
75 if ( $handler_class->register_api() != false ) {
76 if ( \file_exists( $handler_class->register_api() ) ) {
77 include_once $handler_class->register_api();
78 $api = $base_class_name . '_Api';
79 new $api();
80 }
81 }
82
83 if ( $handler_class->wp_init() != false ) {
84 add_action( 'init', array( $handler_class, 'wp_init' ) );
85 }
86 }
87
88
89 public function register_widget( $widgets_manager ) {
90 foreach ( $this->widgets as $widget_slug => $widget ) {
91 $class_name = '\Elementor\ElementsKit_Widget_' . \ElementsKit_Lite\Utils::make_classname( $widget_slug );
92 if ( class_exists( $class_name ) ) {
93 $widgets_manager->register( new $class_name() );
94 }
95 }
96 }
97 }
98