PluginProbe
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 3.3.2
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v3.3.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 in ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor 3.3.2, at elementskit-lite.php

453 lines 10.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use ElementsKit_Lite\Plugin;
4
5 defined( 'ABSPATH' ) || exit;
6
7 /**
8 * Plugin Name: ElementsKit Lite
9 * Description: The most advanced addons for Elementor with tons of widgets, Header builder, Footer builder, Mega menu builder, layout pack and powerful custom controls.
10 * Plugin URI: https://products.wpmet.com/elementskit
11 * Author: Wpmet
12 * Version: 3.3.2
13 * Author URI: https://wpmet.com/
14 *
15 * Text Domain: elementskit-lite
16 * Domain Path: /languages
17 *
18 * ElementsKit is a powerful addon for Elementor page builder.
19 * It includes most comprehensive modules, such as "header footer builder", "mega menu",
20 * "layout installer", "quick form builder" etc under the hood.
21 * It has a tons of widgets to create any sites with an ease. It has some most unique
22 * and powerful custom controls for elementor, such as "image picker", "ajax select", "widget area".
23 *
24 */
25
26
27 final class ElementsKit_Lite {
28 /**
29 * Plugin Version
30 *
31 * @since 1.0.0
32 * @var string The plugin version.
33 */
34 static function version() {
35 return '3.3.2';
36 }
37
38 /**
39 * Package type
40 *
41 * @since 1.1.0
42 * @var string The plugin purchase type [pro/ free].
43 */
44 static function package_type() {
45 return apply_filters( 'elementskit/core/package_type', 'free' );
46 }
47
48
49 /**
50 * Package type
51 *
52 * @since 1.1.0
53 * @var string The plugin purchase type [pro/ free].
54 */
55 static function license_status() {
56 if ( ! class_exists( 'ElementsKit\Libs\Framework\Classes\License' ) ) {
57 return 'invalid';
58 }
59 if ( ElementsKit\Libs\Framework\Classes\License::instance()->status() != 'valid' ) {
60 return 'invalid';
61 }
62
63 return 'valid';
64 }
65
66 public static function license_data() {
67 if ( ! class_exists( '\ElementsKit_Lite\Libs\Framework\Classes\Utils' ) ) {
68 return array(
69 'key' => '',
70 'checksum' => '',
71 'plugin_package' => self::package_type(),
72 );
73 }
74
75 return array(
76 'key' => \ElementsKit_Lite\Libs\Framework\Classes\Utils::instance()->get_option( 'license_key' ),
77 'checksum' => get_option( '__validate_oppai__' ),
78 'plugin_package' => self::package_type(),
79 );
80 }
81
82
83 /**
84 * Product ID
85 *
86 * @since 1.2.6
87 * @var string The plugin ID in our server.
88 */
89 static function product_id() {
90 return '9';
91 }
92
93 /**
94 * Author Name
95 *
96 * @since 1.3.1
97 * @var string The plugin author.
98 */
99 static function author_name() {
100 return 'Wpmet';
101 }
102
103 /**
104 * Store Name
105 *
106 * @since 1.3.1
107 * @var string The store name: self site, envato.
108 */
109 static function store_name() {
110 return 'wordpressorg';
111 }
112
113 /**
114 * Minimum Elementor Version
115 *
116 * @since 1.0.0
117 * @var string Minimum Elementor version required to run the plugin.
118 */
119 static function min_el_version() {
120 return '3.0.0';
121 }
122
123 /**
124 * Minimum PHP Version
125 *
126 * @since 1.0.0
127 * @var string Minimum PHP version required to run the plugin.
128 */
129 static function min_php_version() {
130 return '7.0';
131 }
132
133 /**
134 * Plugin file
135 *
136 * @since 1.0.0
137 * @var string plugins's root file.
138 */
139 static function plugin_file() {
140 return __FILE__;
141 }
142
143 /**
144 * Plugin url
145 *
146 * @since 1.0.0
147 * @var string plugins's root url.
148 */
149 static function plugin_url() {
150 return trailingslashit( plugin_dir_url( __FILE__ ) );
151 }
152
153 /**
154 * Plugin dir
155 *
156 * @since 1.0.0
157 * @var string plugins's root directory.
158 */
159 static function plugin_dir() {
160 return trailingslashit( plugin_dir_path( __FILE__ ) );
161 }
162
163 /**
164 * Plugin's widget directory.
165 *
166 * @since 1.0.0
167 * @var string widget's root directory.
168 */
169 static function widget_dir() {
170 return self::plugin_dir() . 'widgets/';
171 }
172
173 /**
174 * Plugin's widget url.
175 *
176 * @since 1.0.0
177 * @var string widget's root url.
178 */
179 static function widget_url() {
180 return self::plugin_url() . 'widgets/';
181 }
182
183
184 /**
185 * API url
186 *
187 * @since 1.0.0
188 * @var string for license, layout notification related functions.
189 */
190 static function api_url() {
191 return 'https://api.wpmet.com/public/';
192 }
193
194 /**
195 * Account url
196 *
197 * @since 1.2.6
198 * @var string for plugin update notification, user account page.
199 */
200 static function account_url() {
201 return 'https://account.wpmet.com';
202 }
203
204 /**
205 * Plugin's module directory.
206 *
207 * @since 1.0.0
208 * @var string module's root directory.
209 */
210 static function module_dir() {
211 return self::plugin_dir() . 'modules/';
212 }
213
214 /**
215 * Plugin's module url.
216 *
217 * @since 1.0.0
218 * @var string module's root url.
219 */
220 static function module_url() {
221 return self::plugin_url() . 'modules/';
222 }
223
224
225 /**
226 * Plugin's lib directory.
227 *
228 * @since 1.0.0
229 * @var string lib's root directory.
230 */
231 static function lib_dir() {
232 return self::plugin_dir() . 'libs/';
233 }
234
235 /**
236 * Plugin's lib url.
237 *
238 * @since 1.0.0
239 * @var string lib's root url.
240 */
241 static function lib_url() {
242 return self::plugin_url() . 'libs/';
243 }
244
245 /**
246 * Active plugin's textdomain list
247 */
248 static function active_plugins() {
249 require_once ABSPATH . 'wp-admin/includes/plugin.php';
250 $apl = get_option( 'active_plugins' );
251 $plugins = get_plugins();
252 $filter_string = '';
253 foreach ( $apl as $p ) {
254 if ( isset( $plugins[ $p ] ) && isset( $plugins[ $p ]['TextDomain'] ) ) {
255 $filter_string .= ',' . $plugins[ $p ]['TextDomain'];
256 }
257 }
258 return ltrim( $filter_string, ',' );
259 }
260
261 /**
262 * Constructor
263 *
264 * @since 1.0.0
265 * @access public
266 */
267 public function __construct() {
268 // Load the main static helper class.
269 require_once self::plugin_dir() . 'libs/notice/notice.php'; // new notice system
270 require_once self::plugin_dir() . 'libs/banner/banner.php'; // new banner system
271 require_once self::plugin_dir() . 'libs/stories/stories.php'; // new stories system
272 require_once self::plugin_dir() . 'libs/rating/rating.php';
273 require_once self::plugin_dir() . 'libs/pro-awareness/pro-awareness.php'; // pro menu class file
274 require_once self::plugin_dir() . 'libs/forms/forms.php'; // form menu class file
275 require_once self::plugin_dir() . 'libs/our-plugins/our-plugins.php'; // used to display the wpmet other plugins
276 require_once self::plugin_dir() . 'libs/emailkit/emailkit.php';
277 require_once self::plugin_dir() . 'helpers/utils.php';
278
279 // Load translation
280 add_action( 'init', array( $this, 'i18n' ) );
281 // Init Plugin
282 add_action( 'plugins_loaded', array( $this, 'init' ), 100 );
283 }
284
285 /**
286 * Load Textdomain
287 *
288 * Load plugin localization files.
289 * Fired by `init` action hook.
290 *
291 * @since 1.0.0
292 * @access public
293 */
294 public function i18n() {
295 load_plugin_textdomain( 'elementskit-lite', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
296 }
297
298 /**
299 * Initialize the plugin
300 *
301 * Checks for basic plugin requirements, if one check fail don't continue,
302 * if all check have passed include the plugin class.
303 *
304 * Fired by `plugins_loaded` action hook.
305 *
306 * @since 1.0.0
307 * @access public
308 */
309 public function init() {
310 // Load the Plugin class, it's the core class of ElementsKit_Lite.
311 require_once self::plugin_dir() . 'plugin.php';
312
313 \ElementsKit_Lite\Plugin::registrar_autoloader();
314
315 // init notice class
316 \Oxaim\Libs\Notice::init();
317
318 // init pro menu class
319 \Wpmet\Libs\Pro_Awareness::init();
320
321 // Check if Elementor installed and activated.
322 if ( ! did_action( 'elementor/loaded' ) ) {
323 add_action( 'admin_head', array( $this, 'missing_elementor' ) );
324 return;
325 }
326
327 // Check for required PHP version.
328 if ( version_compare( PHP_VERSION, self::min_php_version(), '<' ) ) {
329 add_action( 'admin_head', array( $this, 'failed_php_version' ) );
330 return;
331 }
332
333 // Register ElementsKit_Lite widget category
334 add_action( 'elementor/elements/categories_registered', array( $this, 'elementor_widget_category' ) );
335
336 // initiate elementor custom controls
337 new \ElementsKit_Lite\Modules\Controls\Init();
338
339 add_action(
340 'elementor/init',
341 function() {
342 if ( class_exists( 'ElementsKit' ) && ! class_exists( 'ElementsKit_Comp' ) ) {
343 return;
344 }
345
346 // adding backward classes and methods for older 14 number themes.
347 require_once self::plugin_dir() . 'compatibility/backward/plugin-class-backward-compatibility.php';
348 require_once self::plugin_dir() . 'compatibility/backward/utils-backward-compablity.php';
349
350 // Run the instance.
351 Plugin::instance();
352
353 // adding backward classes and methods for older 14 number themes.
354 require_once self::plugin_dir() . 'compatibility/backward/module-list.php';
355 require_once self::plugin_dir() . 'compatibility/backward/widget-list.php';
356 }
357 );
358 }
359
360 /**
361 * Admin notice
362 *
363 * Warning when the site doesn't have required Elementor.
364 *
365 * @since 1.0.0
366 * @access public
367 */
368 public function missing_elementor() {
369 $btn = array(
370 'default_class' => 'button',
371 'class' => 'button-primary ', // button-primary button-secondary button-small button-large button-link
372 );
373
374 if ( file_exists( WP_PLUGIN_DIR . '/elementor/elementor.php' ) ) {
375 $btn['text'] = esc_html__( 'Activate Elementor', 'elementskit-lite' );
376 $btn['url'] = wp_nonce_url( 'plugins.php?action=activate&plugin=elementor/elementor.php&plugin_status=all&paged=1', 'activate-plugin_elementor/elementor.php' );
377 } else {
378 $btn['text'] = esc_html__( 'Install Elementor', 'elementskit-lite' );
379 $btn['url'] = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' );
380 }
381
382 \Oxaim\Libs\Notice::instance( 'elementskit-lite', 'unsupported-elementor-version' )
383 ->set_type( 'error' )
384 ->set_message( sprintf( '%1$s %2$s+, %3$s',
385 esc_html__( 'ElementsKit requires Elementor version', 'elementskit-lite' ),
386 self::min_el_version() ,
387 esc_html__( 'which is currently NOT RUNNING.', 'elementskit-lite' ),
388 ) )
389 ->set_button( $btn )
390 ->call();
391 }
392
393 /**
394 * Admin notice
395 *
396 * Warning when the site doesn't have a minimum required PHP version.
397 *
398 * @since 1.0.0
399 * @access public
400 */
401 public function failed_php_version() {
402 \Oxaim\Libs\Notice::instance( 'elementskit-lite', 'unsupported-php-version' )
403 ->set_type( 'error' )
404 ->set_message( sprintf( '%1$s %2$s+, %3$s',
405 esc_html__( 'ElementsKit requires PHP version', 'elementskit-lite' ),
406 self::min_php_version(),
407 esc_html__( 'which is currently NOT RUNNING on this server.', 'elementskit-lite' )
408 ))
409 ->call();
410 }
411
412 /**
413 * Rewrite flush.
414 *
415 * @since 1.0.7
416 * @access public
417 */
418 public static function install_activation_key() {
419 add_option( 'elementskit-lite__plugin_activated', self::plugin_file() );
420 }
421
422 /**
423 * Add category.
424 *
425 * Register custom widget category in Elementor's editor
426 *
427 * @since 1.0.0
428 * @access public
429 */
430 public function elementor_widget_category( $widgets_manager ) {
431 $widgets_manager->add_category(
432 'elementskit',
433 array(
434 'title' => esc_html__( 'ElementsKit', 'elementskit-lite' ),
435 'icon' => 'fa fa-plug',
436 ),
437 1
438 );
439 $widgets_manager->add_category(
440 'elementskit_headerfooter',
441 array(
442 'title' => esc_html__( 'ElementsKit Header Footer', 'elementskit-lite' ),
443 'icon' => 'fa fa-plug',
444 ),
445 1
446 );
447 }
448 }
449
450 new ElementsKit_Lite();
451
452 register_activation_hook( __FILE__, 'ElementsKit_Lite::install_activation_key' );
453