PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.0.2
Easy Elements for Elementor – Addons & Website Templates v1.0.2
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / base.php

base.php in Easy Elements for Elementor – Addons & Website Templates 1.0.2, at base.php

274 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 final class Easyel_Elements_Elementor_Extension {
7
8 const VERSION = EASYELEMENTS_VER;
9
10 private static $_instance = null;
11
12 public static function instance() {
13 if ( is_null( self::$_instance ) ) {
14 self::$_instance = new self();
15 }
16 return self::$_instance;
17 }
18
19 public function __construct() {
20 add_action( 'init', [ $this, 'init' ] );
21
22 }
23
24 public function init() {
25 // Safety checks
26
27 add_action( 'elementor/widgets/register', [ $this, 'init_widgets' ] );
28 add_action( 'elementor/elements/categories_registered', [ $this, 'add_elementor_categories' ] );
29
30 add_filter( 'body_class', [ $this, "easy_add_extra_body_class" ] );
31 add_action( 'easy_header', [ $this, 'easyel_before_content_container_hfe'], 20 );
32 add_action( 'easy_footer', [ $this, 'easyel_after_content_container_hfe' ], 5 );
33
34 }
35
36 // Container Full site
37 public function easyel_before_content_container_hfe() {
38 if ( is_admin() ) return;
39 if ( function_exists( 'elementor_theme_do_location' ) && \Elementor\Plugin::$instance->preview->is_preview() ) {
40 return;
41 }
42 echo '<div class="easyel-content-container">';
43 }
44
45 /**
46 * Close container before HFE Footer
47 */
48 function easyel_after_content_container_hfe() {
49 if ( is_admin() ) return;
50 if ( function_exists( 'elementor_theme_do_location' ) && \Elementor\Plugin::$instance->preview->is_preview() ) {
51 return;
52 }
53 echo '</div>';
54 }
55
56 public function easy_add_extra_body_class( $classes ) {
57 if ( is_plugin_active( 'easy-elements/easy-elements.php' ) ) {
58 $classes[] = 'eel-easy-elements';
59 }
60
61 return $classes;
62 }
63
64 public function add_elementor_categories( $elements_manager ) {
65 $elements_manager->add_category( 'easyelements_category', [
66 'title' => esc_html__( 'Easy Elements', 'easy-elements' ),
67 'icon' => 'fa fa-plug',
68 ] );
69 $elements_manager->add_category( 'easyelements_post_category', [
70 'title' => esc_html__( 'Easy Post Type Elements', 'easy-elements' ),
71 'icon' => 'fa fa-file-alt',
72 ] );
73 $elements_manager->add_category( 'easyelements_header_footer_category', [
74 'title' => esc_html__( 'Easy Header Footer Elements', 'easy-elements' ),
75 'icon' => 'fa fa-header',
76 ] );
77 $elements_manager->add_category( 'easyelements_category_form', [
78 'title' => esc_html__( 'Easy Elements Form', 'easy-elements' ),
79 'icon' => 'fa fa-plug',
80 ] );
81 $elements_manager->add_category( 'easyelements_category_pro', [
82 'title' => esc_html__( 'Easy Elements Pro', 'easy-elements' ),
83 'icon' => 'fa fa-plug',
84 ] );
85 }
86
87 public function init_widgets() {
88 $widgets_manager = \Elementor\Plugin::instance()->widgets_manager;
89
90 $widgets = [
91 'site_logo' => [
92 'class' => '\Easyel_Site_Logo_Widget',
93 'file' => __DIR__ . '/widgets/site-logo/site-logo.php',
94 'tab' => 'widget',
95 ],
96 'heading' => [
97 'class' => '\Easyel_Heading_Widget',
98 'file' => __DIR__ . '/widgets/heading/heading.php',
99 'tab' => 'widget',
100 ],
101 'clients_logo' => [
102 'class' => '\Easyel_Clients_Logo__Widget',
103 'file' => __DIR__ . '/widgets/clients-logo-grid/logo.php',
104 'tab' => 'widget',
105 ],
106 'icon_box' => [
107 'class' => '\Easyel_Icon_Box__Widget',
108 'file' => __DIR__ . '/widgets/icon-box/icon.php',
109 'tab' => 'widget',
110 ],
111 'tab' => [
112 'class' => '\Easyel_Tab_Widget',
113 'file' => __DIR__ . '/widgets/tab/tab.php',
114 'tab' => 'widget',
115 ],
116 'testimonials' => [
117 'class' => '\Easyel_Testimonials__Widget',
118 'file' => __DIR__ . '/widgets/testimonials-grid/testimonials.php',
119 'tab' => 'widget',
120 ],
121 'team_grid' => [
122 'class' => '\Easyel_Team_Grid__Widget',
123 'file' => __DIR__ . '/widgets/team-grid/team-grid.php',
124 'tab' => 'widget',
125 ],
126 'search' => [
127 'class' => '\Easyel_Search_Widget',
128 'file' => __DIR__ . '/widgets/search/search.php',
129 'tab' => 'widget',
130 ],
131 'contact_box' => [
132 'class' => '\Easyel_Contact_Box__Widget',
133 'file' => __DIR__ . '/widgets/contact-box/contact.php',
134 'tab' => 'widget',
135 ],
136 'faq' => [
137 'class' => '\Easyel_FAQ_Accordion_Widget',
138 'file' => __DIR__ . '/widgets/faq/faq.php',
139 'tab' => 'widget',
140 ],
141 'blog_grid' => [
142 'class' => '\Easyel_Blog_Grid__Widget',
143 'file' => __DIR__ . '/widgets/blog-grid/blog-grid.php',
144 'tab' => 'widget',
145 ],
146 'video' => [
147 'class' => '\Easyel_Video_Popup_Widget',
148 'file' => __DIR__ . '/widgets/video/video.php',
149 'tab' => 'widget',
150 ],
151 'pricing_table' => [
152 'class' => '\Easyel_Pricing_Table_Widget',
153 'file' => __DIR__ . '/widgets/pricing-table/pricing.php',
154 'tab' => 'widget',
155 ],
156 'pricing_list' => [
157 'class' => '\Easyel_Pricing_Table_List_Widget',
158 'file' => __DIR__ . '/widgets/pricing-list/pricing-list.php',
159 'tab' => 'widget',
160 ],
161 'service_list' => [
162 'class' => '\Easyel_Service_List_Widget',
163 'file' => __DIR__ . '/widgets/service-list/service-list.php',
164 'tab' => 'widget',
165 ],
166 'navigation_menu' => [
167 'class' => '\Easyel_Navigation_Menu_Widget',
168 'file' => __DIR__ . '/widgets/navigation-menu/navigation-menu.php',
169 'tab' => 'widget',
170 ],
171 'page_title' => [
172 'class' => '\Easyel_Page_Title_Widget',
173 'file' => __DIR__ . '/widgets/page-title/page-title.php',
174 'tab' => 'widget',
175 ],
176 'button' => [
177 'class' => '\Easyel_Button_Widget',
178 'file' => __DIR__ . '/widgets/button/button.php',
179 'tab' => 'widget',
180 ],
181 'social_share' => [
182 'class' => '\Easyel_Social_Share_Widget',
183 'file' => __DIR__ . '/widgets/social-share/social-share.php',
184 'tab' => 'widget',
185 ],
186 'typewriter' => [
187 'class' => '\Easyel_Typewriter_Widget',
188 'file' => __DIR__ . '/widgets/typewriter/typewriter.php',
189 'tab' => 'widget',
190 ],
191 'social_icon' => [
192 'class' => '\Easyel_Social_Icon_Widget',
193 'file' => __DIR__ . '/widgets/social-icon/social.php',
194 'tab' => 'widget',
195 ],
196 'breadcrumb' => [
197 'class' => '\Easyel_Breadcrumb_Widget',
198 'file' => __DIR__ . '/widgets/breadcrumb/breadcrumb.php',
199 'tab' => 'widget',
200 ],
201 'domain_search' => [
202 'class' => '\Easyel_Domain_Search_Widget',
203 'file' => __DIR__ . '/widgets/domain-search/domain-search.php',
204 'tab' => 'widget',
205 ],
206 'easy_offcanvas' => [
207 'class' => '\Easyel_Offcanvas_Widget',
208 'file' => __DIR__ . '/widgets/offcanvas/offcanvas.php',
209 'tab' => 'widget',
210 ],
211 'easy_scroll_to_top' => [
212 'class' => '\Easyel_Scroll_To_Top_Widget',
213 'file' => __DIR__ . '/widgets/scroll-to-top/scroll.php',
214 'tab' => 'widget',
215 ],
216 'easy_table' => [
217 'class' => '\Easyel_Table_Elementor_Widget',
218 'file' => __DIR__ . '/widgets/table/table-normal.php',
219 'tab' => 'widget',
220 ],
221 'easy_cf7' => [
222 'class' => '\easyel__CF7_Widget',
223 'file' => __DIR__ . '/widgets/cf7/contact-cf7.php',
224 'tab' => 'widget',
225 ],
226 'easy_gallery' => [
227 'class' => '\Easyel__Gallery_Widget',
228 'file' => __DIR__ . '/widgets/gallery/gallery.php',
229 'tab' => 'widget',
230 ],
231 'image_reveal' => [
232 'class' => '\Easyel_Image_Reveal__Widget',
233 'file' => __DIR__ . '/widgets/reveal/reveal.php',
234 'tab' => 'widget',
235 ],
236 'rotate_text' => [
237 'class' => '\Easyel_Rotate_Text__Widget',
238 'file' => __DIR__ . '/widgets/rotate-text/rotate-text.php',
239 'tab' => 'widget',
240 ],
241
242 'easy_progress' => [
243 'class' => '\Easyel_Progress_Widget',
244 'file' => __DIR__ . '/widgets/progress/progress.php',
245 'tab' => 'widget',
246 ],
247 'typewriter' => [
248 'class' => '\Easyel_Typewriter_Widget',
249 'file' => __DIR__ . '/widgets/typewriter/typewriter.php',
250 'tab' => 'widget',
251 ],
252 ];
253
254 foreach ( $widgets as $key => $data ) {
255 $option_name = 'easy_element_' . $data['tab'] . '_' . $key;
256 $enabled = get_option( $option_name, '1' );
257
258 if ( 1 !== ( int ) $enabled ) {
259 continue; // Skip disabled widgets
260 }
261
262 if ( file_exists( $data['file'] ) ) {
263 require_once $data['file'];
264
265 if ( class_exists( $data['class'] ) ) {
266 $widgets_manager->register( new $data['class']() );
267 }
268 }
269 }
270 }
271
272 }
273
274 Easyel_Elements_Elementor_Extension::instance();