PluginProbe
WDesignKit – AI Templates, Widget Builder & MCP Workflow / 1.0.21
WDesignKit – AI Templates, Widget Builder & MCP Workflow v1.0.21
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.21, at includes/admin/class-wdkit-data-hooks.php

127 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 'gutenberg_template' => true,
73 'elementor_template' => true,
74 );
75
76 add_option( 'wkit_settings_panel', $settings_options );
77 }
78
79 $wkit_builder = get_option( 'wkit_builder', false );
80 if ( empty( $wkit_builder ) ) {
81 add_option( 'wkit_builder', array( 'WDesignKit' ), '', 'yes' );
82 }
83 }
84
85 /**
86 * Check Error and Get Response Body Data
87 *
88 * @param string $super_global it is main party of array & file.
89 * @param string $key it is static value for file and array key.
90 * */
91 public static function get_super_global_value( $super_global, $key ) {
92 if ( ! isset( $super_global[ $key ] ) ) {
93 return null;
94 }
95
96 if ( $_FILES === $super_global ) {
97 $super_global[ $key ]['name'] = sanitize_file_name( $super_global[ $key ]['name'] );
98
99 return $super_global[ $key ];
100 }
101
102 return wp_kses_post_deep( wp_unslash( $super_global[ $key ] ) );
103 }
104
105 /**
106 * Check Error and Get Response Body Data
107 *
108 * @param string $data it is main party of array.
109 * @param string $key it is static value for file and array key.
110 * */
111 public static function sanitize_array_recursive( $data, $key ) {
112
113 if ( is_array( $data[ $key ] ) ) {
114 foreach ( $data[ $key ] as $index => $value ) {
115 $data[ $index ] = self::sanitize_array_recursive( $value );
116 }
117
118 return $data;
119 }
120
121 return sanitize_text_field( $data[ $key ] );
122 }
123 }
124
125 Wdkit_Data_Hooks::get_instance();
126 }
127