class-admin-functions.php
1.52 KB
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
<?php
namespace um\admin;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um\admin\Admin_Functions' ) ) {
/**
* Class Admin_Functions
* @package um\admin\core
*/
class Admin_Functions {
/**
* Check wp-admin nonce
*
* @param bool $action
*/
public function check_ajax_nonce( $action = false ) {
$nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( $_REQUEST['nonce'] ) : '';
$action = empty( $action ) ? 'um-admin-nonce' : $action;
if ( ! wp_verify_nonce( $nonce, $action ) ) {
wp_send_json_error( esc_js( __( 'Wrong Nonce', 'ultimate-member' ) ) );
}
}
/**
* Boolean check if we're viewing UM backend
*
* @deprecated 2.8.0
*
* @return bool
*/
public function is_um_screen() {
_deprecated_function( __METHOD__, '2.8.0', 'UM()->admin()->screen()->is_own_screen()' );
return UM()->admin()->screen()->is_own_screen();
}
/**
* Check if current page load UM post type
*
* @deprecated 2.8.0
*
* @return bool
*/
public function is_plugin_post_type() {
_deprecated_function( __METHOD__, '2.8.0', 'UM()->admin()->screen()->is_own_post_type()' );
return UM()->admin()->screen()->is_own_post_type();
}
/**
* If page now show content with restricted post/taxonomy
*
* @deprecated 2.8.0
*
* @return bool
*/
public function is_restricted_entity() {
_deprecated_function( __METHOD__, '2.8.0', 'UM()->admin()->screen()->is_restricted_entity()' );
return UM()->admin()->screen()->is_restricted_entity();
}
}
}