PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 3.2.7
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v3.2.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 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / plugin.php
elementskit-lite Last commit date
compatibility 1 year ago config 2 years ago core 3 years ago helpers 2 years ago languages 1 year ago libs 1 year ago modules 1 year ago traits 4 years ago widgets 1 year ago autoloader.php 4 years ago elementskit-lite.php 1 year ago plugin.php 1 year ago readme.txt 1 year ago wpml-config.xml 3 years ago
plugin.php
491 lines
1 <?php
2 namespace ElementsKit_Lite;
3
4 defined( 'ABSPATH' ) || exit;
5
6
7 /**
8 * ElementsKit - the God class.
9 * Initiate all necessary classes, hooks, configs.
10 *
11 * @since 1.0.0
12 */
13 class Plugin {
14
15
16 /**
17 * The plugin instance.
18 *
19 * @since 1.0.0
20 * @access public
21 * @static
22 *
23 * @var Plugin
24 */
25 public static $instance = null;
26
27 /**
28 * Construct the plugin object.
29 *
30 * @since 1.0.0
31 * @access public
32 */
33 public function __construct() {
34
35 // check on-boarding status
36 Libs\Framework\Classes\Onboard_Status::instance()->onboard();
37
38 // Enqueue frontend scripts.
39 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend' ) );
40
41 // migrate old settings db to new format
42 new Compatibility\Data_Migration\Settings_Db();
43
44 // Enqueue admin scripts.
45 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin' ) );
46
47 // Enqueue inline scripts
48 Core\Build_Inline_Scripts::instance();
49
50 // Register plugin settings pages
51 Libs\Framework\Attr::instance();
52
53 // Register default widgets
54 Core\Build_Widgets::instance();
55
56 // Register default modules
57 Core\Build_Modules::instance();
58
59 // register plugin activation actions
60 ( new Core\Activation_Actions() )->init();
61
62 add_action( 'wp_head', array( $this, 'add_meta_for_search_excluded' ) );
63
64 // Register ElementsKit supported widgets to Elementor from 3rd party plugins.
65 add_action( 'elementor/widgets/register', array( $this, 'register_widgets' ), 1050 );
66
67 // Register wpml compatibility
68 Compatibility\Wpml\Init::instance();
69
70 // Compatibility issues
71 Compatibility\Conflicts\Init::instance();
72
73 // Show forms sub menu page
74 \Wpmet\Libs\Forms::instance();
75
76 $is_pro_active = in_array( 'elementskit/elementskit.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
77
78 if ( is_admin() && Libs\Framework\Classes\Utils::instance()->get_settings( 'ekit_user_consent_for_banner', 'yes' ) == 'yes' ) {
79 $filter_string = \ElementsKit_Lite::active_plugins();
80 /**
81 * Show WPMET stories widget in dashboard
82 */
83 \Wpmet\Libs\Stories::instance( 'elementskit-lite' )
84 // ->is_test(true)
85 ->set_filter( $filter_string )
86 ->set_plugin( 'ElementsKit', 'https://wpmet.com/plugin/elementskit/' )
87 ->set_api_url( 'https://api.wpmet.com/public/stories/' )
88 ->call();
89
90 /**
91 * Show WPMET banner (codename: jhanda)
92 */
93 \Wpmet\Libs\Banner::instance( 'elementskit-lite' )
94 // ->is_test(true)
95 ->set_filter( ltrim( $filter_string, ',' ) )
96 ->set_api_url( 'https://api.wpmet.com/public/jhanda' )
97 ->set_plugin_screens( 'edit-elementskit_template' )
98 ->set_plugin_screens( 'toplevel_page_elementskit' )
99 ->call();
100
101 /**
102 * Ask for rating
103 * A rating notice will appear depends on
104 * @set_first_appear_day methods
105 */
106 \Wpmet\Libs\Rating::instance( 'elementskit-lite' )
107 ->set_plugin( 'ElementsKit', 'https://wpmet.com/wordpress.org/rating/elementskit' )
108 ->set_plugin_logo( 'https://ps.w.org/elementskit-lite/assets/icon-128x128.gif', 'width:150px !important' )
109 ->set_allowed_screens( 'edit-elementskit_template' )
110 ->set_allowed_screens( 'toplevel_page_elementskit' )
111 ->set_allowed_screens( 'elementskit_page_elementskit-lite_get_help' )
112 ->set_priority( 10 )
113 ->set_first_appear_day( 7 )
114 ->set_condition( true )
115 ->call();
116
117 }
118
119 /**
120 * Show go Premium menu
121 */
122 $pro_awareness = \Wpmet\Libs\Pro_Awareness::instance('elementskit-lite');
123
124 if(version_compare($pro_awareness->get_version(), '1.2.0') >= 0) {
125 $pro_awareness
126 ->set_parent_menu_slug( 'elementskit' )
127 ->set_plugin_file( 'elementskit-lite/elementskit-lite.php' )
128 ->set_pro_link(
129 ( ( \ElementsKit_Lite::package_type() != 'free' ) ? '' : 'https://wpmet.com/elementskit-pricing' )
130 )
131 ->set_default_grid_thumbnail( \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/support.png' )
132 ->set_page_grid(
133 array(
134 'url' => 'https://wpmet.com/fb-group',
135 'title' => 'Join the Community',
136 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/community.png',
137 'description' => 'Join our Facebook group to get 20% discount coupon on premium products. Follow us to get more exciting offers.'
138 )
139 )
140 ->set_page_grid(
141 array(
142 'url' => 'https://www.youtube.com/playlist?list=PL3t2OjZ6gY8MVnyA4OLB6qXb77-roJOuY',
143 'title' => 'Video Tutorials',
144 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/videos.png',
145 'description' => 'Learn the step by step process for developing your site easily from video tutorials.'
146 )
147 )
148 ->set_page_grid(
149 array(
150 'url' => 'https://wpmet.com/plugin/elementskit/roadmaps#ideas',
151 'title' => 'Request a feature',
152 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/request.png',
153 'description' => 'Have any special feature in mind? Let us know through the feature request.'
154 )
155 )
156 ->set_page_grid(
157 array(
158 'url' => 'https://wpmet.com/doc/elementskit/',
159 'title' => 'Documentation',
160 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/documentation.png',
161 'description' => 'Detailed documentation to help you understand the functionality of each feature.'
162 )
163 )
164 ->set_page_grid(
165 array(
166 'url' => 'https://wpmet.com/plugin/elementskit/roadmaps/',
167 'title' => 'Public Roadmap',
168 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/roadmaps.png',
169 'description' => 'Check our upcoming new features, detailed development stories and tasks'
170 )
171 )
172 ->set_plugin_row_meta( 'Documentation', 'https://wpmet.com/elementskit-docs', array( 'target' => '_blank' ) )
173 ->set_plugin_row_meta( 'Facebook Community', 'https://wpmet.com/fb-group', array( 'target' => '_blank' ) )
174 ->set_plugin_row_meta( 'Rate the plugin �
175
176
177
178
179 ', 'https://wordpress.org/support/plugin/elementskit-lite/reviews/#new-post', array( 'target' => '_blank' ) )
180 ->set_plugin_action_link( 'Settings', admin_url() . 'admin.php?page=elementskit' )
181 ->set_plugin_action_link(
182 ( $is_pro_active ? '' : 'Go Premium' ),
183 'https://wpmet.com/plugin/elementskit',
184 array(
185 'target' => '_blank',
186 'style' => 'color: #FCB214; font-weight: bold;',
187 )
188 )
189 ->call();
190 }
191
192 // Adding pro lebel
193 if ( \ElementsKit_Lite::package_type() == 'free' ) {
194 new Libs\Pro_Label\Init();
195 }
196
197 /**
198 * Show our plugins menu for others wpmet plugins
199 */
200 \Wpmet\Libs\Our_Plugins::instance()->init('elementskit-lite') # @text_domain
201 ->set_parent_menu_slug('elementskit') # @plugin_slug
202 ->set_submenu_name(
203 esc_html__('Our Plugins', 'elementskit-lite')
204 ) # @submenu_name (optional- default: Our Plugins)
205 ->set_section_title(
206 esc_html__('Take Your WordPress Website To Next Level!', 'elementskit-lite')
207 ) # @section_title (optional)
208 ->set_section_description(
209 esc_html__('Our diverse range of plugins has every solution for WordPress, Gutenberg, Elementor, and WooCommerce.', 'elementskit-lite')
210 ) # @section_description (optional)
211 ->set_items_per_row(4) # @items_per_row (optional- default: 6)
212 ->set_plugins(
213 [
214 'getgenie/getgenie.php' => [
215 'name' => esc_html__('GetGenie AI', 'elementskit-lite'),
216 'url' => 'https://wordpress.org/plugins/getgenie/',
217 'icon' => 'https://ps.w.org/getgenie/assets/icon-256x256.gif?rev=2798355',
218 'desc' => esc_html__('Your personal AI assistant for content and SEO. Write content that ranks on Google with NLP keywords and SERP analysis data.', 'elementskit-lite'),
219 'docs' => 'https://getgenie.ai/docs/',
220 ],
221 'gutenkit-blocks-addon/gutenkit-blocks-addon.php' => [
222 'name' => esc_html__('GutenKit', 'elementskit-lite'),
223 'url' => 'https://wordpress.org/plugins/gutenkit-blocks-addon/',
224 'icon' => 'https://ps.w.org/gutenkit-blocks-addon/assets/icon-256x256.png?rev=3044956',
225 'desc' => esc_html__('Gutenberg blocks, patterns, and templates that extend the page-building experience using the WordPress block editor.', 'elementskit-lite'),
226 'docs' => 'https://wpmet.com/docs/gutenkit/',
227 ],
228 'shopengine/shopengine.php' => [
229 'name' => esc_html__('ShopEngine', 'elementskit-lite'),
230 'url' => 'https://wordpress.org/plugins/shopengine/',
231 'icon' => 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061',
232 'desc' => esc_html__('Complete WooCommerce solution for Elementor to fully customize any pages including cart, checkout, shop page, and so on.', 'elementskit-lite'),
233 'docs' => 'https://wpmet.com/doc/shopengine/',
234 ],
235 'metform/metform.php' => [
236 'name' => esc_html__('MetForm', 'elementskit-lite'),
237 'url' => 'https://wordpress.org/plugins/genie-image-ai/',
238 'icon' => 'https://ps.w.org/metform/assets/icon-256x256.png?rev=2544152',
239 'desc' => esc_html__('Drag & drop form builder for Elementor to create contact forms, multi-step forms, and more — smoother, faster, and better!', 'elementskit-lite'),
240 'docs' => 'https://wpmet.com/doc/metform/',
241 ],
242 'emailkit/EmailKit.php' => [
243 'name' => esc_html__('EmailKit', 'elementskit-lite'),
244 'url' => 'https://wordpress.org/plugins/genie-image-ai/',
245 'icon' => 'https://ps.w.org/emailkit/assets/icon-256x256.png?rev=3003571',
246 'desc' => esc_html__('Advanced email customizer for WooCommerce and WordPress. Build, customize, and send emails from WordPress to boost your sales!', 'elementskit-lite'),
247 'docs' => 'https://wpmet.com/doc/emailkit/',
248 ],
249 'wp-social/wp-social.php' => [
250 'name' => esc_html__('WP Social', 'elementskit-lite'),
251 'url' => 'https://wordpress.org/plugins/wp-social/',
252 'icon' => 'https://ps.w.org/wp-social/assets/icon-256x256.png?rev=2544214',
253 'desc' => esc_html__('Add social share, login, and engagement counter — unified solution for all social media with tons of different styles for your website.', 'elementskit-lite'),
254 'docs' => 'https://wpmet.com/doc/wp-social/',
255 ],
256 'wp-ultimate-review/wp-ultimate-review.php' => [
257 'name' => esc_html__('WP Ultimate Review', 'elementskit-lite'),
258 'url' => 'https://wordpress.org/plugins/wp-ultimate-review/',
259 'icon' => 'https://ps.w.org/wp-ultimate-review/assets/icon-256x256.png?rev=2544187',
260 'desc' => esc_html__('Collect and showcase reviews on your website to build brand credibility and social proof with the easiest solution.', 'elementskit-lite'),
261 'docs' => 'https://wpmet.com/doc/wp-ultimate-review/',
262 ],
263 'wp-fundraising-donation/wp-fundraising.php' => [
264 'name' => esc_html__('FundEngine', 'elementskit-lite'),
265 'url' => 'https://wordpress.org/plugins/wp-fundraising-donation/',
266 'icon' => 'https://ps.w.org/wp-fundraising-donation/assets/icon-256x256.png?rev=2544150',
267 'desc' => esc_html__('Create fundraising, crowdfunding, and donation websites with PayPal and Stripe payment gateway integration.', 'elementskit-lite'),
268 'docs' => 'https://wpmet.com/doc/fundengine/',
269 ],
270 'blocks-for-shopengine/shopengine-gutenberg-addon.php' => [
271 'name' => esc_html__('Blocks for ShopEngine', 'elementskit-lite'),
272 'url' => 'https://wordpress.org/plugins/blocks-for-shopengine/',
273 'icon' => 'https://ps.w.org/blocks-for-shopengine/assets/icon-256x256.gif?rev=2702483',
274 'desc' => esc_html__('All in one WooCommerce solution for Gutenberg! Build your WooCommerce pages in a block editor with full customization.', 'elementskit-lite'),
275 'docs' => 'https://wpmet.com/doc/shopengine/shopengine-gutenberg/',
276 ],
277 'genie-image-ai/genie-image-ai.php' => [
278 'name' => esc_html__('Genie Image', 'elementskit-lite'),
279 'url' => 'https://wordpress.org/plugins/genie-image-ai/',
280 'icon' => 'https://ps.w.org/genie-image-ai/assets/icon-256x256.png?rev=2977297',
281 'desc' => esc_html__('AI-powered text-to-image generator for WordPress with OpenAI’s DALL-E 2 technology to generate high-quality images in one click.', 'elementskit-lite'),
282 'docs' => 'https://getgenie.ai/docs/',
283 ],
284 ]
285 ) # @plugins
286 ->call();
287
288 $user_consent = Libs\Framework\Classes\Utils::instance()->get_settings('ekit_user_consent_for_banner', 'yes') == 'yes';
289
290 /**
291 * EmailKit Global Class initialization
292 *
293 */
294 if (
295 class_exists('WooCommerce')
296 && !class_exists('EmailKit')
297 && !did_action('edit_with_emailkit_loaded')
298 && class_exists('\Wpmet\Libs\Emailkit')
299 && $user_consent
300 ) {
301 new \Wpmet\Libs\Emailkit();
302 }
303
304 /**
305 * Initializes the Template Library of the Gutenkit plugin
306 *
307 * This code block checks if certain conditions are met and then initializes the Template Library of the Gutenkit plugin.
308 *
309 * Conditions:
310 * - The action 'edit_with_gutenkit_loaded' has not been performed yet.
311 * - The class '\ElementsKit_Lite\Libs\Template_Library\Init' exists.
312 * - The setting 'ekit_user_consent_for_banner' in the Utils class is set to 'yes'.
313 * - The plugin 'gutenkit-blocks-addon' is not active or install.
314 *
315 * If any of the above conditions are met, the Template Library is initialized by creating a new instance of
316 * the class '\ElementsKit_Lite\Libs\Template_Library\Init'.
317 *
318 * @since 3.1.4
319 */
320 if ($user_consent && class_exists('\ElementsKit_Lite\Libs\Template_Library\Init') && !did_action('gutenkit/init')) {
321 new \ElementsKit_Lite\Libs\Template_Library\Init();
322 }
323 }
324
325 /**
326 * Check the admin screen and show the rating notice if eligible
327 *
328 * @access private
329 * @return boolean
330 */
331 private function should_show_rating_notice() {
332
333 if ( \ElementsKit_Lite::package_type() == 'free' ) {
334 return true;
335 }
336
337 if ( ! function_exists( 'get_current_screen' ) ) {
338 return false;
339 }
340
341 $current_screen = ( get_current_screen() )->base;
342 $current_post_type = ( get_current_screen() )->post_type;
343 $eligible_post_type = array( 'elementskit_template' );
344 $eligible_screens = array( 'plugins', 'dashboard', 'elementskit', 'themes' );
345
346 if ( in_array( $current_post_type, $eligible_post_type ) ) {
347 return true;
348 }
349
350 if ( in_array( $current_screen, $eligible_screens ) ) {
351 return true;
352 }
353
354 return false;
355 }
356
357 /**
358 * Enqueue scripts
359 *
360 * Enqueue js and css to frontend.
361 *
362 * @since 1.0.0
363 * @access public
364 */
365 public function enqueue_frontend() {
366 wp_enqueue_script( 'elementskit-framework-js-frontend', \ElementsKit_Lite::lib_url() . 'framework/assets/js/frontend-script.js', array( 'jquery' ), \ElementsKit_Lite::version(), true );
367 }
368
369 /**
370 * Enqueue scripts
371 *
372 * Enqueue js and css to admin.
373 *
374 * @since 1.0.0
375 * @access public
376 */
377 public function enqueue_admin() {
378 $screen = get_current_screen();
379
380 if ( ! in_array( $screen->id, array( 'nav-menus', 'toplevel_page_elementskit', 'edit-elementskit_template', 'elementskit_page_elementskit-license', 'elementskit_page_elementskit-lite_get_help' ) ) ) {
381 return;
382 }
383
384 wp_register_style( 'fontawesome', \ElementsKit_Lite::widget_url() . 'init/assets/css/font-awesome.min.css', false, \ElementsKit_Lite::version() );
385 wp_register_style( 'elementskit-font-css-admin', \ElementsKit_Lite::module_url() . 'elementskit-icon-pack/assets/css/ekiticons.css', false, \ElementsKit_Lite::version() );
386 wp_register_style( 'elementskit-init-css-admin', \ElementsKit_Lite::lib_url() . 'framework/assets/css/admin-style.css', false, \ElementsKit_Lite::version() );
387
388 wp_enqueue_style( 'fontawesome' );
389 wp_enqueue_style( 'elementskit-font-css-admin' );
390 wp_enqueue_style( 'elementskit-init-css-admin' );
391
392 wp_enqueue_script( 'ekit-admin-core', \ElementsKit_Lite::lib_url() . 'framework/assets/js/ekit-admin-core.js', array( 'jquery' ), \ElementsKit_Lite::version(), true );
393
394 $data['rest_url'] = get_rest_url();
395 $data['nonce'] = wp_create_nonce( 'wp_rest' );
396
397 wp_localize_script( 'ekit-admin-core', 'rest_config', $data );
398
399 wp_localize_script(
400 'ekit-admin-core',
401 'ekit_ajax_var',
402 array(
403 'nonce' => wp_create_nonce( 'ajax-nonce' ),
404 )
405 );
406 }
407
408 /**
409 * Control registrar.
410 *
411 * Register the custom controls for Elementor
412 * using `elementskit/widgets/widgets_registered` action.
413 *
414 * @since 1.0.0
415 * @access public
416 */
417 public function register_control( $widgets_manager ) {
418 do_action( 'elementskit/widgets/widgets_registered', $widgets_manager );
419 }
420
421
422 /**
423 * Widget registrar.
424 *
425 * Retrieve all the registered widgets
426 * using `elementor/widgets/register` action.
427 *
428 * @since 1.0.0
429 * @access public
430 */
431 public function register_widgets( $widgets_manager ) {
432 do_action( 'elementskit/widgets/widgets_registered', $widgets_manager );
433 }
434
435 /**
436 * Excluding ElementsKit template and megamenu content from search engine.
437 * See - https://wordpress.org/support/topic/google-is-indexing-elementskit-content-as-separate-pages/
438 *
439 * @since 1.4.5
440 * @access public
441 */
442 public function add_meta_for_search_excluded() {
443 if ( in_array(
444 get_post_type(),
445 array( 'elementskit_widget', 'elementskit_template', 'elementskit_content' )
446 )
447 ) {
448 echo '<meta name="robots" content="noindex,nofollow" />', "\n";
449 }
450 }
451
452 /**
453 * Autoloader.
454 *
455 * ElementsKit autoloader loads all the classes needed to run the plugin.
456 *
457 * @since 1.0.0
458 * @access private
459 */
460 public static function registrar_autoloader() {
461 require_once \ElementsKit_Lite::plugin_dir() . '/autoloader.php';
462 Autoloader::run();
463 }
464
465 /**
466 * Instance.
467 *
468 * Ensures only one instance of the plugin class is loaded or can be loaded.
469 *
470 * @since 1.0.0
471 * @access public
472 * @static
473 *
474 * @return Plugin An instance of the class.
475 */
476 public static function instance() {
477 if ( is_null( self::$instance ) ) {
478
479 do_action( 'elementskit_lite/before_loaded' );
480
481 // Fire when ElementsKit instance.
482 self::$instance = new self();
483
484 do_action( 'elementskit/loaded' ); // legacy support
485 do_action( 'elementskit_lite/after_loaded' );
486 }
487
488 return self::$instance;
489 }
490 }
491