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