PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.62
Timetics – Appointment Booking Calendar & Scheduling v1.0.62
1.0.62 1.0.63 1.0.61 1.0.60 1.0.59 1.0.58 1.0.57 1.0.56 trunk 1.0.0 1.0.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 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 All 64 releases
timetics / vendor / themewinter / email-notification-sdk / src / Utils / global-helpers.php

global-helpers.php in Timetics – Appointment Booking Calendar & Scheduling 1.0.62, at vendor/themewinter/email-notification-sdk/src/Utils/global-helpers.php

114 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use ENS\Config;
4
5 defined( 'ABSPATH' ) || exit;
6
7 if ( !function_exists( 'ens_get_translatable_strings' ) ) {
8
9 /**
10 * will return strings after translation
11 *
12 * @return array
13 */
14 function ens_get_translatable_strings( $string, $text_domain ) {
15 return $string;
16 }
17 }
18
19 if ( !function_exists( 'ens_verify_nonce' ) ) {
20
21 /**
22 * will verify nonce
23 *
24 * @return array
25 */
26 function ens_verify_nonce( $nonce, $identifier ) {
27 $is_local = isset( $_SERVER['REMOTE_ADDR'] ) && in_array( $_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'] );
28
29 if ( ( isset( $nonce ) && wp_verify_nonce( $nonce, 'wp_rest' ) ) || $is_local ) {
30 return true;
31 }
32
33 $response = [
34 'success' => 0,
35 'status_code' => 403,
36 'message' => __( 'Nonce not verified', get_config_data( $identifier,'text_domain' ) ),
37 'data' => [],
38 ];
39 return new WP_HTTP_Response( $response, 403 );
40 }
41 }
42
43 if ( !function_exists( 'ens_sanitize_recursive' ) ) {
44
45 /**
46 * will sanitize recursive
47 *
48 * @return array
49 */
50 function ens_sanitize_recursive( $input ) {
51 if ( is_array( $input ) ) {
52
53 foreach ( $input as $key => $value ) {
54 $input[$key] = ens_sanitize_recursive( $value );
55 }
56
57 } elseif ( is_object( $input ) ) {
58
59 foreach ( $input as $key => $value ) {
60 $input->$key = ens_sanitize_recursive( $value );
61 }
62
63 } else {
64 if ( filter_var( $input, FILTER_VALIDATE_URL ) !== false ) {
65 $input = sanitize_url( $input );
66 } elseif ( is_email( $input ) ) {
67 $input = sanitize_email( $input );
68 } elseif ( is_int( $input ) ) {
69 $input = intval( $input );
70 } elseif ( is_float( $input ) ) {
71 $input = floatval( $input );
72 } elseif ( is_string( $input ) ) {
73 if ( strpos( $input, '<svg' ) === false ) {
74 $input = wp_kses_post( $input );
75 }
76 }
77 }
78
79 return $input;
80 }
81 }
82
83 if ( !function_exists( 'ens_get_post_status' ) ) {
84
85 /**
86 * will return post status
87 *
88 * @return array
89 */
90 function ens_get_post_status() {
91 return ['publish', 'draft', 'trash'];
92 }
93 }
94
95 if ( !function_exists( 'get_config_data' ) ) {
96
97 /**
98 * will return config data
99 *
100 * @return array
101 */
102 function get_config_data($prefix, $value_of) {
103 $key = $prefix . '_ens_config';
104
105 $data = get_option( $key );
106
107 if (isset($data[$value_of])) {
108 return $data[$value_of];
109 }
110
111 return null;
112 }
113 }
114