PluginProbe
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 3.8.1
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v3.8.1
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 / plugin.php

plugin.php in ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor 3.8.1, at plugin.php

502 lines 18.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 // migrate old settings db to new format.
39 new Compatibility\Data_Migration\Settings_Db();
40
41 // compatibility for element manager.
42 new Compatibility\Element_Manager\Init();
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 = \ElementsKit_Lite\Utils::ekit_is_plugin_active( 'elementskit/elementskit.php');
77
78 // Initialize editor promotion for pro widgets
79 if( ! $is_pro_active ) {
80 add_action( 'elementor/editor/init', function() {
81 if ( class_exists( '\ElementsKit_Lite\Core\Editor_Promotion' ) ) {
82 \ElementsKit_Lite\Core\Editor_Promotion::instance()->init();
83 }
84 } );
85 }
86
87 if ( is_admin() && Libs\Framework\Classes\Utils::instance()->get_settings( 'ekit_user_consent_for_banner', 'yes' ) == 'yes' ) {
88 $filter_string = \ElementsKit_Lite::active_plugins();
89 /**
90 * Show WPMET stories widget in dashboard
91 */
92 \Wpmet\Libs\Stories::instance( 'elementskit-lite' )
93 // ->is_test(true)
94 ->set_filter( $filter_string )
95 ->set_plugin( 'ElementsKit', 'https://wpmet.com/plugin/elementskit/' )
96 ->set_api_url( 'https://api.wpmet.com/public/stories/' )
97 ->call();
98
99 /**
100 * Show WPMET banner (codename: jhanda)
101 */
102 \Wpmet\Libs\Banner::instance( 'elementskit-lite' )
103 // ->is_test(true)
104 ->set_filter( ltrim( $filter_string, ',' ) )
105 ->set_api_url( 'https://api.wpmet.com/public/jhanda' )
106 ->set_plugin_screens( 'edit-elementskit_template' )
107 ->set_plugin_screens( 'toplevel_page_elementskit' )
108 ->call();
109
110 /**
111 * Ask for rating
112 * A rating notice will appear depends on
113 * @set_first_appear_day methods
114 */
115 \Wpmet\Libs\Rating::instance( 'elementskit-lite' )
116 ->set_plugin( 'ElementsKit', 'https://wpmet.com/wordpress.org/rating/elementskit' )
117 ->set_plugin_logo( 'https://ps.w.org/elementskit-lite/assets/icon-128x128.gif', 'width:150px !important' )
118 ->set_allowed_screens( 'edit-elementskit_template' )
119 ->set_allowed_screens( 'toplevel_page_elementskit' )
120 ->set_allowed_screens( 'elementskit_page_elementskit-lite_get_help' )
121 ->set_priority( 10 )
122 ->set_first_appear_day( 7 )
123 ->set_condition( true )
124 ->call();
125
126 }
127
128 /**
129 * Show go Premium menu
130 */
131 $pro_awareness = \Wpmet\Libs\Pro_Awareness::instance('elementskit-lite');
132
133 if(version_compare($pro_awareness->get_version(), '1.2.0') >= 0) {
134 $pro_awareness
135 ->set_parent_menu_slug( 'elementskit' )
136 ->set_plugin_file( 'elementskit-lite/elementskit-lite.php' )
137 ->set_pro_link(
138 ( ( \ElementsKit_Lite::package_type() != 'free' ) ? '' : 'https://wpmet.com/elementskit-pricing' )
139 )
140 ->set_default_grid_thumbnail( \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/support.png' )
141 ->set_page_grid(
142 array(
143 'url' => 'https://wpmet.com/fb-group',
144 'title' => 'Join the Community',
145 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/community.png',
146 'description' => 'Join our Facebook group to get 20% discount coupon on premium products. Follow us to get more exciting offers.'
147 )
148 )
149 ->set_page_grid(
150 array(
151 'url' => 'https://www.youtube.com/playlist?list=PL3t2OjZ6gY8MVnyA4OLB6qXb77-roJOuY',
152 'title' => 'Video Tutorials',
153 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/videos.png',
154 'description' => 'Learn the step by step process for developing your site easily from video tutorials.'
155 )
156 )
157 ->set_page_grid(
158 array(
159 'url' => 'https://wpmet.com/plugin/elementskit/roadmaps#ideas',
160 'title' => 'Request a feature',
161 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/request.png',
162 'description' => 'Have any special feature in mind? Let us know through the feature request.'
163 )
164 )
165 ->set_page_grid(
166 array(
167 'url' => 'https://wpmet.com/doc/elementskit/',
168 'title' => 'Documentation',
169 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/documentation.png',
170 'description' => 'Detailed documentation to help you understand the functionality of each feature.'
171 )
172 )
173 ->set_page_grid(
174 array(
175 'url' => 'https://wpmet.com/plugin/elementskit/roadmaps/',
176 'title' => 'Public Roadmap',
177 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/roadmaps.png',
178 'description' => 'Check our upcoming new features, detailed development stories and tasks'
179 )
180 )
181 ->set_plugin_row_meta( 'Documentation', 'https://wpmet.com/elementskit-docs', array( 'target' => '_blank' ) )
182 ->set_plugin_row_meta( 'Facebook Community', 'https://wpmet.com/fb-group', array( 'target' => '_blank' ) )
183 ->set_plugin_row_meta( 'Rate the plugin �
184
185
186
187
188 ', 'https://wordpress.org/support/plugin/elementskit-lite/reviews/#new-post', array( 'target' => '_blank' ) )
189 ->set_plugin_action_link( 'Settings', admin_url() . 'admin.php?page=elementskit' )
190 ->set_plugin_action_link(
191 ( $is_pro_active ? '' : 'Go Premium' ),
192 'https://wpmet.com/elementskit-pricing',
193 array(
194 'target' => '_blank',
195 'style' => 'color: #FCB214; font-weight: bold;',
196 )
197 )
198 ->call();
199 }
200
201 // Adding pro lebel
202 if ( \ElementsKit_Lite::package_type() == 'free' ) {
203 new Libs\Pro_Label\Init();
204 }
205
206 /**
207 * Show our plugins menu for others wpmet plugins
208 */
209 \Wpmet\Libs\Our_Plugins::instance()->init('elementskit-lite') # @text_domain
210 ->set_parent_menu_slug('elementskit') # @plugin_slug
211 ->set_submenu_name(
212 esc_html__('Our Plugins', 'elementskit-lite')
213 ) # @submenu_name (optional- default: Our Plugins)
214 ->set_section_title(
215 esc_html__('Take Your WordPress Website To Next Level!', 'elementskit-lite')
216 ) # @section_title (optional)
217 ->set_section_description(
218 esc_html__('Our diverse range of plugins has every solution for WordPress, Gutenberg, Elementor, and WooCommerce.', 'elementskit-lite')
219 ) # @section_description (optional)
220 ->set_items_per_row(4) # @items_per_row (optional- default: 6)
221 ->set_plugins(
222 [
223 'getgenie/getgenie.php' => [
224 'name' => esc_html__('GetGenie AI', 'elementskit-lite'),
225 'url' => 'https://wordpress.org/plugins/getgenie/',
226 'icon' => 'https://ps.w.org/getgenie/assets/icon-256x256.gif?rev=2798355',
227 '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'),
228 'docs' => 'https://getgenie.ai/docs/',
229 ],
230 'shopengine/shopengine.php' => [
231 'name' => esc_html__('ShopEngine', 'elementskit-lite'),
232 'url' => 'https://wordpress.org/plugins/shopengine/',
233 'icon' => 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061',
234 'desc' => esc_html__('Complete WooCommerce solution for Elementor to fully customize any pages including cart, checkout, shop page, and so on.', 'elementskit-lite'),
235 'docs' => 'https://wpmet.com/doc/shopengine/',
236 ],
237 'metform/metform.php' => [
238 'name' => esc_html__('MetForm', 'elementskit-lite'),
239 'url' => 'https://wordpress.org/plugins/genie-image-ai/',
240 'icon' => 'https://ps.w.org/metform/assets/icon-256x256.png?rev=2544152',
241 'desc' => esc_html__('Drag & drop form builder for Elementor to create contact forms, multi-step forms, and more — smoother, faster, and better!', 'elementskit-lite'),
242 'docs' => 'https://wpmet.com/doc/metform/',
243 ],
244 'emailkit/EmailKit.php' => [
245 'name' => esc_html__('EmailKit', 'elementskit-lite'),
246 'url' => 'https://wordpress.org/plugins/genie-image-ai/',
247 'icon' => 'https://ps.w.org/emailkit/assets/icon-256x256.png?rev=3003571',
248 'desc' => esc_html__('Advanced email customizer for WooCommerce and WordPress. Build, customize, and send emails from WordPress to boost your sales!', 'elementskit-lite'),
249 'docs' => 'https://wpmet.com/doc/emailkit/',
250 ],
251 'gutenkit-blocks-addon/gutenkit-blocks-addon.php' => [
252 'name' => esc_html__('GutenKit', 'elementskit-lite'),
253 'url' => 'https://wordpress.org/plugins/gutenkit-blocks-addon/',
254 'icon' => 'https://ps.w.org/gutenkit-blocks-addon/assets/icon-256x256.gif?rev=3044956',
255 'desc' => esc_html__('Gutenberg blocks, patterns, and templates that extend the page-building experience using the WordPress block editor.', 'elementskit-lite'),
256 'docs' => 'https://wpmet.com/docs/gutenkit/',
257 ],
258 'popup-builder-block/popup-builder-block.php' => [
259 'name' => esc_html__('PopupKit', 'elementskit-lite'),
260 'url' => 'https://wordpress.org/plugins/popup-builder-block/',
261 'icon' => 'https://ps.w.org/popup-builder-block/assets/icon-256x256.png?rev=3316844',
262 'desc' => esc_html__('Design popups that convert, right in your WordPress dashboard.', 'elementskit-lite'),
263 'docs' => 'https://wpmet.com/docs/gutenkit/',
264 ],
265 'table-builder-block/table-builder-block.php' => [
266 'name' => esc_html__('TableKit', 'elementskit-lite'),
267 'url' => 'https://wordpress.org/plugins/table-builder-block/',
268 'icon' => 'https://ps.w.org/table-builder-block/assets/icon-256x256.jpg?rev=3168211',
269 'desc' => esc_html__('Fully Customizable. Multi-Media Integration. Synch Any Data Files. All Within Block Editor.', 'elementskit-lite'),
270 'docs' => 'https://wpmet.com/docs/gutenkit/',
271 ],
272 'wp-social/wp-social.php' => [
273 'name' => esc_html__('WP Social', 'elementskit-lite'),
274 'url' => 'https://wordpress.org/plugins/wp-social/',
275 'icon' => 'https://ps.w.org/wp-social/assets/icon-256x256.png?rev=2544214',
276 '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'),
277 'docs' => 'https://wpmet.com/doc/wp-social/',
278 ],
279 'wp-ultimate-review/wp-ultimate-review.php' => [
280 'name' => esc_html__('WP Ultimate Review', 'elementskit-lite'),
281 'url' => 'https://wordpress.org/plugins/wp-ultimate-review/',
282 'icon' => 'https://ps.w.org/wp-ultimate-review/assets/icon-256x256.png?rev=2544187',
283 'desc' => esc_html__('Collect and showcase reviews on your website to build brand credibility and social proof with the easiest solution.', 'elementskit-lite'),
284 'docs' => 'https://wpmet.com/doc/wp-ultimate-review/',
285 ],
286 'wp-fundraising-donation/wp-fundraising.php' => [
287 'name' => esc_html__('FundEngine', 'elementskit-lite'),
288 'url' => 'https://wordpress.org/plugins/wp-fundraising-donation/',
289 'icon' => 'https://ps.w.org/wp-fundraising-donation/assets/icon-256x256.png?rev=2544150',
290 'desc' => esc_html__('Create fundraising, crowdfunding, and donation websites with PayPal and Stripe payment gateway integration.', 'elementskit-lite'),
291 'docs' => 'https://wpmet.com/doc/fundengine/',
292 ],
293 'blocks-for-shopengine/shopengine-gutenberg-addon.php' => [
294 'name' => esc_html__('Blocks for ShopEngine', 'elementskit-lite'),
295 'url' => 'https://wordpress.org/plugins/blocks-for-shopengine/',
296 'icon' => 'https://ps.w.org/blocks-for-shopengine/assets/icon-256x256.gif?rev=2702483',
297 'desc' => esc_html__('All in one WooCommerce solution for Gutenberg! Build your WooCommerce pages in a block editor with full customization.', 'elementskit-lite'),
298 'docs' => 'https://wpmet.com/doc/shopengine/shopengine-gutenberg/',
299 ],
300 'genie-image-ai/genie-image-ai.php' => [
301 'name' => esc_html__('Genie Image', 'elementskit-lite'),
302 'url' => 'https://wordpress.org/plugins/genie-image-ai/',
303 'icon' => 'https://ps.w.org/genie-image-ai/assets/icon-256x256.png?rev=2977297',
304 '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'),
305 'docs' => 'https://getgenie.ai/docs/',
306 ],
307 ]
308 ) # @plugins
309 ->call();
310
311 $user_consent = Libs\Framework\Classes\Utils::instance()->get_settings('ekit_user_consent_for_banner', 'yes') == 'yes';
312
313 /**
314 * EmailKit Global Class initialization
315 *
316 */
317 if (
318 class_exists('WooCommerce')
319 && !class_exists('EmailKit')
320 && !did_action('edit_with_emailkit_loaded')
321 && class_exists('\Wpmet\Libs\Emailkit')
322 && $user_consent
323 ) {
324 new \Wpmet\Libs\Emailkit();
325 }
326
327 /**
328 * Initializes the Template Library of the Gutenkit plugin
329 *
330 * This code block checks if certain conditions are met and then initializes the Template Library of the Gutenkit plugin.
331 *
332 * Conditions:
333 * - The action 'edit_with_gutenkit_loaded' has not been performed yet.
334 * - The class '\ElementsKit_Lite\Libs\Template_Library\Init' exists.
335 * - The setting 'ekit_user_consent_for_banner' in the Utils class is set to 'yes'.
336 * - The plugin 'gutenkit-blocks-addon' is not active or install.
337 *
338 * If any of the above conditions are met, the Template Library is initialized by creating a new instance of
339 * the class '\ElementsKit_Lite\Libs\Template_Library\Init'.
340 *
341 * @since 3.1.4
342 */
343 if ($user_consent && class_exists('\ElementsKit_Lite\Libs\Template_Library\Init') && !did_action('gutenkit/init')) {
344 new \ElementsKit_Lite\Libs\Template_Library\Init();
345 }
346 }
347
348 /**
349 * Check the admin screen and show the rating notice if eligible
350 *
351 * @access private
352 * @return boolean
353 */
354 private function should_show_rating_notice() {
355
356 if ( \ElementsKit_Lite::package_type() == 'free' ) {
357 return true;
358 }
359
360 if ( ! function_exists( 'get_current_screen' ) ) {
361 return false;
362 }
363
364 $current_screen = ( get_current_screen() )->base;
365 $current_post_type = ( get_current_screen() )->post_type;
366 $eligible_post_type = array( 'elementskit_template' );
367 $eligible_screens = array( 'plugins', 'dashboard', 'elementskit', 'themes' );
368
369 if ( in_array( $current_post_type, $eligible_post_type ) ) {
370 return true;
371 }
372
373 if ( in_array( $current_screen, $eligible_screens ) ) {
374 return true;
375 }
376
377 return false;
378 }
379
380 /**
381 * Enqueue scripts
382 *
383 * Enqueue js and css to admin.
384 *
385 * @since 1.0.0
386 * @access public
387 */
388 public function enqueue_admin() {
389 $screen = get_current_screen();
390
391 if ( ! in_array( $screen->id, array( 'nav-menus', 'toplevel_page_elementskit', 'edit-elementskit_template', 'elementskit_page_elementskit-license', 'elementskit_page_elementskit-lite_get_help' ) ) ) {
392 return;
393 }
394
395 wp_register_style( 'fontawesome', \ElementsKit_Lite::widget_url() . 'init/assets/css/font-awesome.min.css', false, \ElementsKit_Lite::version() );
396 wp_register_style( 'elementskit-font-css-admin', \ElementsKit_Lite::module_url() . 'elementskit-icon-pack/assets/css/ekiticons.css', false, \ElementsKit_Lite::version() );
397 wp_register_style( 'elementskit-init-css-admin', \ElementsKit_Lite::lib_url() . 'framework/assets/css/admin-style.css', false, \ElementsKit_Lite::version() );
398
399 wp_enqueue_style( 'fontawesome' );
400 wp_enqueue_style( 'elementskit-font-css-admin' );
401 wp_enqueue_style( 'elementskit-init-css-admin' );
402
403 wp_enqueue_script( 'ekit-admin-core', \ElementsKit_Lite::lib_url() . 'framework/assets/js/ekit-admin-core.js', array( 'jquery' ), \ElementsKit_Lite::version(), true );
404
405 $data['rest_url'] = get_rest_url();
406 $data['nonce'] = wp_create_nonce( 'wp_rest' );
407
408 wp_localize_script( 'ekit-admin-core', 'rest_config', $data );
409
410 wp_localize_script(
411 'ekit-admin-core',
412 'ekit_ajax_var',
413 array(
414 'nonce' => wp_create_nonce( 'ajax-nonce' ),
415 )
416 );
417 }
418
419 /**
420 * Control registrar.
421 *
422 * Register the custom controls for Elementor
423 * using `elementskit/widgets/widgets_registered` action.
424 *
425 * @since 1.0.0
426 * @access public
427 */
428 public function register_control( $widgets_manager ) {
429 do_action( 'elementskit/widgets/widgets_registered', $widgets_manager );
430 }
431
432
433 /**
434 * Widget registrar.
435 *
436 * Retrieve all the registered widgets
437 * using `elementor/widgets/register` action.
438 *
439 * @since 1.0.0
440 * @access public
441 */
442 public function register_widgets( $widgets_manager ) {
443 do_action( 'elementskit/widgets/widgets_registered', $widgets_manager );
444 }
445
446 /**
447 * Excluding ElementsKit template and megamenu content from search engine.
448 * See - https://wordpress.org/support/topic/google-is-indexing-elementskit-content-as-separate-pages/
449 *
450 * @since 1.4.5
451 * @access public
452 */
453 public function add_meta_for_search_excluded() {
454 if ( in_array(
455 get_post_type(),
456 array( 'elementskit_widget', 'elementskit_template', 'elementskit_content' )
457 )
458 ) {
459 echo '<meta name="robots" content="noindex,nofollow" />', "\n";
460 }
461 }
462
463 /**
464 * Autoloader.
465 *
466 * ElementsKit autoloader loads all the classes needed to run the plugin.
467 *
468 * @since 1.0.0
469 * @access private
470 */
471 public static function registrar_autoloader() {
472 require_once \ElementsKit_Lite::plugin_dir() . '/autoloader.php';
473 Autoloader::run();
474 }
475
476 /**
477 * Instance.
478 *
479 * Ensures only one instance of the plugin class is loaded or can be loaded.
480 *
481 * @since 1.0.0
482 * @access public
483 * @static
484 *
485 * @return Plugin An instance of the class.
486 */
487 public static function instance() {
488 if ( is_null( self::$instance ) ) {
489
490 do_action( 'elementskit_lite/before_loaded' );
491
492 // Fire when ElementsKit instance.
493 self::$instance = new self();
494
495 do_action( 'elementskit/loaded' ); // legacy support
496 do_action( 'elementskit_lite/after_loaded' );
497 }
498
499 return self::$instance;
500 }
501 }
502