PluginProbe
WDesignKit – AI Templates, Widget Builder & MCP Workflow / 1.0.7
WDesignKit – AI Templates, Widget Builder & MCP Workflow v1.0.7
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 1.0.17 All 128 releases
wdesignkit / includes / admin / class-wdkit-data-hooks.php

class-wdkit-data-hooks.php in WDesignKit – AI Templates, Widget Builder & MCP Workflow 1.0.7, at includes/admin/class-wdkit-data-hooks.php

124 lines 2.8 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\wdkit_datahooks;
16
17 /**Exit if accessed directly.*/
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit;
20 }
21
22 if ( ! class_exists( 'Wdkit_Data_Hooks' ) ) {
23
24 /**
25 * Wdkit_Data_Hooks
26 *
27 * @since 1.0.0
28 */
29 class Wdkit_Data_Hooks {
30
31 /**
32 * Member Variable
33 *
34 * @var instance
35 */
36 private static $instance;
37
38 /**
39 * Initiator
40 */
41 public static function get_instance() {
42 if ( ! isset( self::$instance ) ) {
43 self::$instance = new self();
44 }
45
46 return self::$instance;
47 }
48
49 /**
50 * Define the core functionality of the plugin.
51 */
52 public function __construct() {
53 add_action( 'wdkit_admin_create_default', array( $this, 'wdkit_create_default' ), 10 );
54 }
55
56 /**
57 * Create Default setting data in db
58 *
59 * @since 1.0.0
60 */
61 public function wdkit_create_default() {
62
63 $wkit_settings_panel = get_option( 'wkit_settings_panel', false );
64 if ( empty( $wkit_settings_panel ) ) {
65 $settings_options = array(
66 'builder' => true,
67 'template' => true,
68 'gutenberg_builder' => true,
69 'elementor_builder' => true,
70 'bricks_builder' => false,
71 'debugger_mode' => false,
72 );
73
74 add_option( 'wkit_settings_panel', $settings_options );
75 }
76
77 $wkit_builder = get_option( 'wkit_builder', false );
78 if ( empty( $wkit_builder ) ) {
79 add_option( 'wkit_builder', array( 'WDesignKit' ), '', 'yes' );
80 }
81 }
82
83 /**
84 * Check Error and Get Response Body Data
85 *
86 * @param string $super_global it is main party of array & file.
87 * @param string $key it is static value for file and array key.
88 * */
89 public static function get_super_global_value( $super_global, $key ) {
90 if ( ! isset( $super_global[ $key ] ) ) {
91 return null;
92 }
93
94 if ( $_FILES === $super_global ) {
95 $super_global[ $key ]['name'] = sanitize_file_name( $super_global[ $key ]['name'] );
96
97 return $super_global[ $key ];
98 }
99
100 return wp_kses_post_deep( wp_unslash( $super_global[ $key ] ) );
101 }
102
103 /**
104 * Check Error and Get Response Body Data
105 *
106 * @param string $data it is main party of array.
107 * @param string $key it is static value for file and array key.
108 * */
109 public static function sanitize_array_recursive( $data, $key ) {
110
111 if ( is_array( $data[ $key ] ) ) {
112 foreach ( $data[ $key ] as $index => $value ) {
113 $data[ $index ] = self::sanitize_array_recursive( $value );
114 }
115
116 return $data;
117 }
118
119 return sanitize_text_field( $data[ $key ] );
120 }
121 }
122
123 Wdkit_Data_Hooks::get_instance();
124 }