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

445 lines 10.6 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: 2.7.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 '2.7.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() . 'helpers/utils.php';
276
277 // Load translation
278 add_action( 'init', array( $this, 'i18n' ) );
279 // Init Plugin
280 add_action( 'plugins_loaded', array( $this, 'init' ), 100 );
281 }
282
283 /**
284 * Load Textdomain
285 *
286 * Load plugin localization files.
287 * Fired by `init` action hook.
288 *
289 * @since 1.0.0
290 * @access public
291 */
292 public function i18n() {
293 load_plugin_textdomain( 'elementskit-lite', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
294 }
295
296 /**
297 * Initialize the plugin
298 *
299 * Checks for basic plugin requirements, if one check fail don't continue,
300 * if all check have passed include the plugin class.
301 *
302 * Fired by `plugins_loaded` action hook.
303 *
304 * @since 1.0.0
305 * @access public
306 */
307 public function init() {
308 // Load the Plugin class, it's the core class of ElementsKit_Lite.
309 require_once self::plugin_dir() . 'plugin.php';
310
311 \ElementsKit_Lite\Plugin::registrar_autoloader();
312
313 // init notice class
314 \Oxaim\Libs\Notice::init();
315
316 // init pro menu class
317 \Wpmet\Libs\Pro_Awareness::init();
318
319 // Check if Elementor installed and activated.
320 if ( ! did_action( 'elementor/loaded' ) ) {
321 add_action( 'admin_head', array( $this, 'missing_elementor' ) );
322 return;
323 }
324
325 // Check for required PHP version.
326 if ( version_compare( PHP_VERSION, self::min_php_version(), '<' ) ) {
327 add_action( 'admin_head', array( $this, 'failed_php_version' ) );
328 return;
329 }
330
331 // Register ElementsKit_Lite widget category
332 add_action( 'elementor/elements/categories_registered', array( $this, 'elementor_widget_category' ) );
333
334 // initiate elementor custom controls
335 new \ElementsKit_Lite\Modules\Controls\Init();
336
337 add_action(
338 'elementor/init',
339 function() {
340 if ( class_exists( 'ElementsKit' ) && ! class_exists( 'ElementsKit_Comp' ) ) {
341 return;
342 }
343
344 // adding backward classes and methods for older 14 number themes.
345 require_once self::plugin_dir() . 'compatibility/backward/plugin-class-backward-compatibility.php';
346 require_once self::plugin_dir() . 'compatibility/backward/utils-backward-compablity.php';
347
348 // Run the instance.
349 Plugin::instance();
350
351 // adding backward classes and methods for older 14 number themes.
352 require_once self::plugin_dir() . 'compatibility/backward/module-list.php';
353 require_once self::plugin_dir() . 'compatibility/backward/widget-list.php';
354 }
355 );
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( esc_html__( 'ElementsKit requires Elementor version %1$s+, which is currently NOT RUNNING.', 'elementskit-lite' ), self::min_el_version() ) )
385 ->set_button( $btn )
386 ->call();
387 }
388
389
390 /**
391 * Admin notice
392 *
393 * Warning when the site doesn't have a minimum required PHP version.
394 *
395 * @since 1.0.0
396 * @access public
397 */
398 public function failed_php_version() {
399 \Oxaim\Libs\Notice::instance( 'elementskit-lite', 'unsupported-php-version' )
400 ->set_type( 'error' )
401 ->set_message( sprintf( esc_html__( 'ElementsKit requires PHP version %1$s+, which is currently NOT RUNNING on this server.', 'elementskit-lite' ), self::min_php_version() ) )
402 ->call();
403 }
404
405 /**
406 * Rewrite flush.
407 *
408 * @since 1.0.7
409 * @access public
410 */
411 public static function install_activation_key() {
412 add_option( 'elementskit-lite__plugin_activated', self::plugin_file() );
413 }
414 /**
415 * Add category.
416 *
417 * Register custom widget category in Elementor's editor
418 *
419 * @since 1.0.0
420 * @access public
421 */
422 public function elementor_widget_category( $widgets_manager ) {
423 $widgets_manager->add_category(
424 'elementskit',
425 array(
426 'title' => esc_html__( 'ElementsKit', 'elementskit-lite' ),
427 'icon' => 'fa fa-plug',
428 ),
429 1
430 );
431 $widgets_manager->add_category(
432 'elementskit_headerfooter',
433 array(
434 'title' => esc_html__( 'ElementsKit Header Footer', 'elementskit-lite' ),
435 'icon' => 'fa fa-plug',
436 ),
437 1
438 );
439 }
440 }
441
442 new ElementsKit_Lite();
443
444 register_activation_hook( __FILE__, 'ElementsKit_Lite::install_activation_key' );
445