-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
70 lines (62 loc) · 1.35 KB
/
functions.php
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
<?php
/**
* A File full of functions.
*
* @package GoogleAuthForWP
*/
use GoogleAuthForWP\Plugin;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! function_exists( 'google_auth_wp' ) ) {
/**
* Get an instance of the plugin
*
* @return Plugin
*/
function google_auth_wp() {
return Plugin::get_instance( __FILE__ );
}
}
if ( ! function_exists( 'gauthwp_rest_permission_callback' ) ) :
/**
* Checks the persmission for rest routes.
*
* @return bool
*/
function gauthwp_rest_permission_callback() {
return ( is_user_logged_in() && current_user_can( 'manage_options' ) ) ? true : false;
}
endif;
if ( ! function_exists( 'gauthwp_rest_validate_callback_boolean' ) ) {
/**
* Validate `boolean` for rest routes;
*
* @param mixed $param The input value.
* @return bool
*/
function gauthwp_rest_validate_callback_boolean( $param ) {
return is_bool( $param );
}
}
if ( ! function_exists( 'gauthwp_rest_validate_callback_string' ) ) {
/**
* Validate `string` for rest routes;
*
* @param mixed $param The input value.
* @return bool
*/
function gauthwp_rest_validate_callback_string( $param ) {
return is_string( $param );
}
}
if ( ! function_exists( 'gauthwp_is_debug' ) ) {
/**
* Check if WP_DEBUG is on.
*
* @return bool
*/
function gauthwp_is_debug() {
return defined( 'WP_DEBUG' ) && ( true === WP_DEBUG );
}
}