PluginProbe
WDesignKit – AI Templates, Widget Builder & MCP Workflow / 1.0.10
WDesignKit – AI Templates, Widget Builder & MCP Workflow v1.0.10
2.7.0 2.6.6 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5.0 2.4.0 2.3.3 2.3.2 2.3.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 All 129 releases
wdesignkit / includes / class-wdkit-wdesignkit.php

class-wdkit-wdesignkit.php in WDesignKit – AI Templates, Widget Builder & MCP Workflow 1.0.10, at includes/class-wdkit-wdesignkit.php

176 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The file that defines the core plugin class
4 *
5 * A class definition that includes attributes and functions used across both the
6 * public-facing side of the site and the admin area.
7 *
8 * @link https://posimyth.com/
9 * @since 1.0.0
10 *
11 * @package Wdesignkit
12 * @subpackage Wdesignkit/includes
13 */
14
15 namespace wdkit;
16
17 /**
18 * Exit if accessed directly.
19 * */
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit;
22 }
23
24 if ( ! class_exists( 'Wdkit_Wdesignkit' ) ) {
25
26 /**
27 * It is wdesignkit Main Class
28 *
29 * @since 1.0.0
30 */
31 class Wdkit_Wdesignkit {
32
33 /**
34 * Member Variable
35 *
36 * @var instance
37 */
38 private static $instance;
39
40 /**
41 * Initiator
42 */
43 public static function get_instance() {
44 if ( ! isset( self::$instance ) ) {
45 self::$instance = new self();
46 }
47 return self::$instance;
48 }
49
50 /**
51 * Define the core functionality of the plugin.
52 */
53 public function __construct() {
54 /**Dont Move File Used For Create OWN WDkit Hooks*/
55 require_once WDKIT_INCLUDES . 'admin/class-wdkit-data-hooks.php';
56
57 register_activation_hook( WDKIT_FILE, array( __CLASS__, 'wdkit_activation' ) );
58 register_deactivation_hook( WDKIT_FILE, array( __CLASS__, 'wdkit_deactivation' ) );
59
60 add_action( 'plugins_loaded', array( $this, 'wdkit_plugin_loaded' ) );
61
62 add_action( 'activated_plugin', array( $this,'wdkit_activate_redirect') );
63 }
64
65 /**
66 * Check Setting Panal switch On off
67 *
68 * @since 1.0.0
69 *
70 * @param string $type check builder type.
71 */
72 public static function wdkit_is_compatible( $type ) {
73 $wkit_settings_panel = get_option( 'wkit_settings_panel', false );
74
75 if ( empty( $wkit_settings_panel ) ) {
76 do_action( 'wdkit_admin_create_default' );
77
78 return false;
79 }
80
81 $builder = ! empty( $wkit_settings_panel['builder'] ) ? $wkit_settings_panel['builder'] : false;
82 $b_d_type = false;
83 if ( 'elementor' === $type ) {
84 $b_d_type = ! empty( $wkit_settings_panel['elementor_builder'] ) ? $wkit_settings_panel['elementor_builder'] : false;
85 } elseif ( 'gutenberg' === $type ) {
86 $b_d_type = ! empty( $wkit_settings_panel['gutenberg_builder'] ) ? $wkit_settings_panel['gutenberg_builder'] : false;
87 } elseif ( 'bricks' === $type ) {
88 $b_d_type = ! empty( $wkit_settings_panel['bricks_builder'] ) ? $wkit_settings_panel['bricks_builder'] : false;
89 } elseif ( 'builder' === $type ) {
90 $b_d_type = $builder;
91 } else {
92 $b_d_type = false;
93 }
94
95 if ( empty( $builder ) || empty( $b_d_type ) ) {
96 return false;
97 }
98
99 return true;
100 }
101
102 /**
103 * Plugin Activation.
104 *
105 * @return void
106 */
107 public static function wdkit_activation() {
108 do_action( 'wdkit_admin_create_default' );
109 }
110
111 /**
112 * Plugin deactivation.
113 *
114 * @return void
115 */
116 public static function wdkit_deactivation() {
117 }
118
119 /**
120 * Files load plugin loaded.
121 *
122 * @return void
123 */
124 public function wdkit_plugin_loaded() {
125 $this->load_textdomain();
126 $this->wdkit_load_dependencies();
127 }
128
129 /**
130 * Load Text Domain.
131 * Text Domain : wdkit
132 */
133 public function load_textdomain() {
134 load_plugin_textdomain( 'wdesignkit', false, WDKIT_BDNAME . '/languages/' );
135 }
136
137 /**
138 * Load the required dependencies for this plugin.
139 *
140 * - Wdesignkit_Admin. Defines all hooks for the admin area.
141 * - Wdesignkit_Public. Defines all hooks for the public side of the site.
142 *
143 * @since 1.0.0
144 */
145 private function wdkit_load_dependencies() {
146
147 /**
148 * The class responsible for defining all actions that occur in the admin area.
149 */
150 require_once WDKIT_INCLUDES . 'admin/notices/class-wdkit-notice-main.php';
151
152 require_once WDKIT_INCLUDES . 'admin/class-wdkit-enqueue.php';
153 require_once WDKIT_INCLUDES . 'admin/class-wdesignkit-data-query.php';
154 require_once WDKIT_INCLUDES . 'admin/class-wdkit-depends-installer.php';
155 require_once WDKIT_INCLUDES . 'admin/class-api.php';
156
157 require_once WDKIT_INCLUDES . 'widget-load/widget-load-files.php';
158 }
159
160 /**
161 * Activation Reset
162 *
163 * @since 1.0.9
164 */
165 public function wdkit_activate_redirect( $plugin ){
166
167 if( 'wdesignkit/wdesignkit.php' === $plugin ) {
168 exit( wp_redirect( admin_url( 'admin.php?page=wdesign-kit' ) ) );
169 }
170
171 }
172 }
173
174 Wdkit_Wdesignkit::get_instance();
175 }
176