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