PluginProbe
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 2.0.9.2
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v2.0.9.2
4.0.4 4.0.3 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 All 183 releases
elementskit-lite / elementskit-lite.php
elementskit-lite.php
385 lines 8.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit;
3
4 /**
5 * Plugin Name: ElementsKit Lite
6 * Description: The most advanced addons for Elementor with tons of widgets, Header builder, Footer builder, Mega menu builder, layout pack and powerful custom controls.
7 * Plugin URI: https://products.wpmet.com/elementskit
8 * Author: Wpmet
9 * Version: 2.0.9.2
10 * Author URI: https://wpmet.com/
11 *
12 * Text Domain: elementskit-lite
13 *
14 * ElementsKit is a powerful addon for Elementor page builder.
15 * It includes most comprehensive modules, such as "header footer builder", "mega menu",
16 * "layout installer", "quick form builder" etc under the hood.
17 * It has a tons of widgets to create any sites with an ease. It has some most unique
18 * and powerful custom controls for elementor, such as "image picker", "ajax select", "widget area".
19 *
20 */
21
22 final class ElementsKit_Lite{
23 /**
24 * Plugin Version
25 *
26 * @since 1.0.0
27 * @var string The plugin version.
28 */
29 static function version(){
30 return '2.0.9.2';
31 }
32
33 /**
34 * Package type
35 *
36 * @since 1.1.0
37 * @var string The plugin purchase type [pro/ free].
38 */
39 static function package_type(){
40 return apply_filters( 'elementskit/core/package_type', 'free' );
41 }
42
43 /**
44 * Product ID
45 *
46 * @since 1.2.6
47 * @var string The plugin ID in our server.
48 */
49 static function product_id(){
50 return '9';
51 }
52
53 /**
54 * Author Name
55 *
56 * @since 1.3.1
57 * @var string The plugin author.
58 */
59 static function author_name(){
60 return 'Wpmet';
61 }
62
63 /**
64 * Store Name
65 *
66 * @since 1.3.1
67 * @var string The store name: self site, envato.
68 */
69 static function store_name(){
70 return 'wordpressorg';
71 }
72
73 /**
74 * Minimum Elementor Version
75 *
76 * @since 1.0.0
77 * @var string Minimum Elementor version required to run the plugin.
78 */
79 static function min_el_version(){
80 return '2.4.0';
81 }
82
83 /**
84 * Minimum PHP Version
85 *
86 * @since 1.0.0
87 * @var string Minimum PHP version required to run the plugin.
88 */
89 static function min_php_version(){
90 return '7.0';
91 }
92
93 /**
94 * Plugin file
95 *
96 * @since 1.0.0
97 * @var string plugins's root file.
98 */
99 static function plugin_file(){
100 return __FILE__;
101 }
102
103 /**
104 * Plugin url
105 *
106 * @since 1.0.0
107 * @var string plugins's root url.
108 */
109 static function plugin_url(){
110 return trailingslashit(plugin_dir_url( __FILE__ ));
111 }
112
113 /**
114 * Plugin dir
115 *
116 * @since 1.0.0
117 * @var string plugins's root directory.
118 */
119 static function plugin_dir(){
120 return trailingslashit(plugin_dir_path( __FILE__ ));
121 }
122
123 /**
124 * Plugin's widget directory.
125 *
126 * @since 1.0.0
127 * @var string widget's root directory.
128 */
129 static function widget_dir(){
130 return self::plugin_dir() . 'widgets/';
131 }
132
133 /**
134 * Plugin's widget url.
135 *
136 * @since 1.0.0
137 * @var string widget's root url.
138 */
139 static function widget_url(){
140 return self::plugin_url() . 'widgets/';
141 }
142
143
144 /**
145 * API url
146 *
147 * @since 1.0.0
148 * @var string for license, layout notification related functions.
149 */
150 static function api_url(){
151 return 'https://api.wpmet.com/public/';
152 }
153
154 /**
155 * Account url
156 *
157 * @since 1.2.6
158 * @var string for plugin update notification, user account page.
159 */
160 static function account_url(){
161 return 'https://account.wpmet.com';
162 }
163
164 /**
165 * Plugin's module directory.
166 *
167 * @since 1.0.0
168 * @var string module's root directory.
169 */
170 static function module_dir(){
171 return self::plugin_dir() . 'modules/';
172 }
173
174 /**
175 * Plugin's module url.
176 *
177 * @since 1.0.0
178 * @var string module's root url.
179 */
180 static function module_url(){
181 return self::plugin_url() . 'modules/';
182 }
183
184
185 /**
186 * Plugin's lib directory.
187 *
188 * @since 1.0.0
189 * @var string lib's root directory.
190 */
191 static function lib_dir(){
192 return self::plugin_dir() . 'libs/';
193 }
194
195 /**
196 * Plugin's lib url.
197 *
198 * @since 1.0.0
199 * @var string lib's root url.
200 */
201 static function lib_url(){
202 return self::plugin_url() . 'libs/';
203 }
204
205 /**
206 * Constructor
207 *
208 * @since 1.0.0
209 * @access public
210 */
211 public function __construct() {
212 require_once self::plugin_dir() . 'libs/notice/notice.php'; // new notice system
213 require_once self::plugin_dir() . 'libs/banner/init.php'; // new notice system
214 // init notice class
215 \Oxaim\Libs\New_Notice::init();
216
217 // Load translation
218 add_action( 'init', array( $this, 'i18n' ) );
219 // Init Plugin
220 add_action( 'plugins_loaded', array( $this, 'init' ), 100 );
221 }
222
223 /**
224 * Load Textdomain
225 *
226 * Load plugin localization files.
227 * Fired by `init` action hook.
228 *
229 * @since 1.0.0
230 * @access public
231 */
232 public function i18n() {
233 load_plugin_textdomain( 'elementskit-lite', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
234 }
235
236 /**
237 * Initialize the plugin
238 *
239 * Checks for basic plugin requirements, if one check fail don't continue,
240 * if all check have passed include the plugin class.
241 *
242 * Fired by `plugins_loaded` action hook.
243 *
244 * @since 1.0.0
245 * @access public
246 */
247 public function init() {
248 // Load the main static helper class.
249 require_once self::plugin_dir() . 'helpers/notice.php';
250 require_once self::plugin_dir() . 'helpers/utils.php';
251
252
253
254
255 // Check if Elementor installed and activated.
256 if ( ! did_action( 'elementor/loaded' ) ) {
257 add_action( 'admin_notices', array( $this, 'missing_elementor' ) );
258 return;
259 }
260
261 // Check for required PHP version.
262 if ( version_compare( PHP_VERSION, self::min_php_version(), '<' ) ) {
263 add_action( 'admin_notices', array( $this, 'failed_php_version' ) );
264 return;
265 }
266 // Once we get here, We have passed all validation checks so we can safely include our plugin.
267
268 // Register ElementsKit_Lite widget category
269 add_action('elementor/init', [$this, 'elementor_widget_category']);
270
271 add_action( 'elementor/init', function(){
272 if(class_exists('ElementsKit') && !class_exists('ElementsKit_Comp')){
273 return;
274 }
275
276 // adding backward classes and mathods for older 14 number themes.
277 require_once self::plugin_dir() . 'plugin-class-backward-compatibility.php';
278 require_once self::plugin_dir() . 'helpers/utils-backward-compablity.php';
279
280 // Load the Plugin class, it's the core class of ElementsKit_Lite.
281 require_once self::plugin_dir() . 'plugin.php';
282 });
283
284 }
285
286
287
288 /**
289 * Admin notice
290 *
291 * Warning when the site doesn't have required Elementor.
292 *
293 * @since 1.0.0
294 * @access public
295 */
296 public function missing_elementor() {
297 if ( isset( $_GET['activate'] ) ) {
298 unset( $_GET['activate'] );
299 }
300
301 if ( file_exists( WP_PLUGIN_DIR . '/elementor/elementor.php' ) ) {
302 $btn['label'] = esc_html__('Activate Elementor', 'elementskit-lite');
303 $btn['url'] = wp_nonce_url( 'plugins.php?action=activate&plugin=elementor/elementor.php&plugin_status=all&paged=1', 'activate-plugin_elementor/elementor.php' );
304 } else {
305 $btn['label'] = esc_html__('Install Elementor', 'elementskit-lite');
306 $btn['url'] = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' );
307 }
308
309 \ElementsKit_Lite\Notice::push(
310 [
311 'id' => 'unsupported-elementor-version',
312 'type' => 'error',
313 'dismissible' => true,
314 'btn' => $btn,
315 'message' => sprintf( esc_html__( 'ElementsKit requires Elementor version %1$s+, which is currently NOT RUNNING.', 'elementskit-lite' ), self::min_el_version() ),
316 ]
317 );
318 }
319
320
321 /**
322 * Admin notice
323 *
324 * Warning when the site doesn't have a minimum required PHP version.
325 *
326 * @since 1.0.0
327 * @access public
328 */
329 public function failed_php_version() {
330 \ElementsKit_Lite\Notice::push(
331 [
332 'id' => 'unsupported-php-version',
333 'type' => 'error',
334 'dismissible' => true,
335 'message' => sprintf( esc_html__( 'ElementsKit requires PHP version %1$s+, which is currently NOT RUNNING on this server.', 'elementskit-lite' ), self::min_php_version() ),
336 ]
337 );
338 }
339
340 /**
341 * Rewrite flush.
342 *
343 * @since 1.0.7
344 * @access public
345 */
346 public static function flush_rewrites(){
347
348 require_once self::module_dir() . 'dynamic-content/cpt.php';
349
350 new ElementsKit_Lite\Modules\Dynamic_Content\Cpt();
351
352 flush_rewrite_rules();
353 }
354 /**
355 * Add category.
356 *
357 * Register custom widget category in Elementor's editor
358 *
359 * @since 1.0.0
360 * @access public
361 */
362 public function elementor_widget_category($widgets_manager){
363 \Elementor\Plugin::$instance->elements_manager->add_category(
364 'elementskit',
365 [
366 'title' =>esc_html__( 'ElementsKit', 'elementskit-lite' ),
367 'icon' => 'fa fa-plug',
368 ],
369 1
370 );
371 \Elementor\Plugin::$instance->elements_manager->add_category(
372 'elementskit_headerfooter',
373 [
374 'title' =>esc_html__( 'ElementsKit Header Footer', 'elementskit-lite' ),
375 'icon' => 'fa fa-plug',
376 ],
377 1
378 );
379 }
380 }
381
382 new ElementsKit_Lite();
383
384 register_activation_hook( __FILE__, 'ElementsKit_Lite::flush_rewrites' );
385