PluginProbe
WidgetKit for Elementor – Lightweight Elementor Addons, Widgets & Templates / trunk
WidgetKit for Elementor – Lightweight Elementor Addons, Widgets & Templates vtrunk
trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.3.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.7.1 1.5.8 2.0 2.1 2.1.1 All 74 releases
widgetkit-for-elementor / widgetkit-for-elementor.php

widgetkit-for-elementor.php in WidgetKit for Elementor – Lightweight Elementor Addons, Widgets & Templates trunk, at widgetkit-for-elementor.php

144 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: All-in-One Addons for Elementor - WidgetKit
4 Description: Everything you need to create a stunning website with <strong>Elementor, WooCommerce, LearnDash, Sensei & LearnPress</strong> and more.
5 Version: 2.5.10
6 Text Domain: widgetkit-for-elementor
7 Author: Themesgrove
8 Author URI: https://themesgrove.com
9 Plugin URI: https://themesgrove.com/widgetkit-for-elementor/
10 License: GPL3
11 License URI: https://www.gnu.org/licenses/gpl-3.0.txt
12 @package WidgetKit_For_Elementor
13 Domain Path: /languages
14 WC requires at least: 5.0.0
15 WC tested up to: 9.5.1
16 */
17
18 /**
19 * Define absoulote path
20 * No access of directly access
21 */
22 if (!defined('ABSPATH')) exit;
23
24 define('WK_VERSION', '2.5.10');
25 define('WK_FILE', __FILE__);
26 define('WK_PATH', plugin_dir_path(__FILE__));
27
28 // Define WK_URL only when plugins_url function is available
29 if (!defined('WK_URL')) {
30 if (function_exists('plugins_url')) {
31 define('WK_URL', plugins_url('/', __FILE__));
32 } else {
33 // Fallback for early loading
34 define('WK_URL', plugin_dir_url(__FILE__));
35 }
36 }
37
38 class WidgetKit_For_Elementor
39 {
40
41 public function __construct()
42 {
43 add_action('init', array($this, 'plugin_setup'));
44 add_action('elementor/init', array($this, 'elementor_init'));
45 add_action('init', array($this, 'elementor_resources'), -999);
46 add_action('admin_head', array($this, 'remove_all_admin_notice'));
47 add_filter('elementor/utils/get_placeholder_image_src', [__CLASS__, 'wk_placeholder_image']);
48
49 // Declare WooCommerce HPOS compatibility
50 add_action('before_woocommerce_init', array($this, 'declare_woocommerce_hpos_compatibility'));
51
52 require_once(WK_PATH . 'vendor/autoload.php');
53 if (!class_exists('Parsedown')) {
54 require_once(WK_PATH . 'vendor/erusev/parsedown/Parsedown.php');
55 }
56 }
57
58 public static function wk_placeholder_image()
59 {
60 return WK_URL . 'dist/images/placeholder.jpg';
61 }
62
63 public function activate()
64 {
65 flush_rewrite_rules();
66 }
67 public function deactivate()
68 {
69 flush_rewrite_rules();
70 }
71
72 /**
73 * Declare WooCommerce HPOS compatibility
74 */
75 public function declare_woocommerce_hpos_compatibility()
76 {
77 if (class_exists('\Automattic\WooCommerce\Utilities\FeaturesUtil')) {
78 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', WK_FILE, true);
79 }
80 }
81
82 public function plugin_setup()
83 {
84 $this->load_admin_files();
85 if (is_admin()) {
86 $this->check_dependency();
87 }
88 }
89 public function load_admin_files()
90 {
91 require_once(WK_PATH . 'includes/appsero-init.php');
92 require_once(WK_PATH . 'includes/widgetkit-pro-init.php');
93 require_once(WK_PATH . 'includes/elements.php');
94 require_once(WK_PATH . 'includes/helper.php');
95 require_once(WK_PATH . 'includes/widgetkit-admin-resources.php');
96 require_once(WK_PATH . 'includes/pro-features.php');
97
98 WKFE_Appsero_Init::init();
99 WKFE_PRO_Init::init();
100 WKFE_Elements::init();
101 WKFE_Admin_Resources::init();
102 }
103
104 public function elementor_init()
105 {
106 require_once(WK_PATH . 'includes/elementor-integration.php');
107 }
108 public function elementor_addons()
109 {
110 require_once(WK_PATH . 'includes/addons-integration.php');
111 WKFE_Addons_Integration::init();
112 }
113 public function elementor_resources()
114 {
115 $this->elementor_addons();
116 }
117
118 public function check_dependency()
119 {
120 require_once(WK_PATH . 'includes/dependency.php');
121 WKFE_Dependency::init();
122 }
123 public function remove_all_admin_notice($hook)
124 {
125 global $wp;
126 $current_url = add_query_arg(array($_GET), $wp->request); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
127 $current_url_slug = explode("=", $current_url);
128 if (count($current_url_slug) > 1) :
129 if ($current_url && $current_url_slug[1] === 'widgetkit-settings') {
130 if (is_super_admin()) {
131 remove_all_actions('admin_notices');
132 }
133 }
134 endif;
135 }
136 }
137
138 if (class_exists('WidgetKit_For_Elementor')) {
139 $widgetkit_for_elementor = new WidgetKit_For_Elementor();
140
141 register_activation_hook(__FILE__, array($widgetkit_for_elementor, 'activate'));
142 register_deactivation_hook(__FILE__, array($widgetkit_for_elementor, 'deactivate'));
143 }
144