FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
WP-API/core-integration.php at develop · WP-API/WP-API · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
WP-API
/
WP-API
Public archive
Notifications
You must be signed in to change notification settings
Fork
638
Star
3.9k
Code
Issues
49
Pull requests
3
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
WP-API
/
core-integration.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
80 lines (73 loc) · 2.1 KB
Breadcrumbs
WP-API
/
core-integration.php
Copy path
File metadata and controls
80 lines (73 loc) · 2.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
71
72
73
74
75
76
77
78
79
80
<?php
/**
* Integration points with WordPress core that won't ever be committed
*/
/**
* Inject `parent__in` and `parent__not_in` vars to avoid bad cache
*
* @see https://core.trac.wordpress.org/ticket/35677
*/
function
wp_api_comment_query_vars
(
$
query
) {
$
query
->
query_var_defaults
[
'
parent__in
'
] =
array
();
$
query
->
query_var_defaults
[
'
parent__not_in
'
] =
array
();
}
add_action
(
'
pre_get_comments
'
,
'
wp_api_comment_query_vars
'
);
if
( !
function_exists
(
'
wp_parse_slug_list
'
) ) {
/**
* Clean up an array, comma- or space-separated list of slugs.
*
* @since
*
* @param array|string $list List of slugs.
* @return array Sanitized array of slugs.
*/
function
wp_parse_slug_list
(
$
list
) {
if
( !
is_array
(
$
list
) ) {
$
list
=
preg_split
(
'
/[\s,]+/
'
,
$
list
);
}
return
array_unique
(
array_map
(
'
sanitize_title
'
,
$
list
) );
}
}
if
( !
function_exists
(
'
rest_get_server
'
) ) {
/**
* Retrieves the current REST server instance.
*
* Instantiates a new instance if none exists already.
*
* @since 4.5.0
*
* @global WP_REST_Server $wp_rest_server REST server instance.
*
* @return WP_REST_Server REST server instance.
*/
function
rest_get_server
() {
/* @var WP_REST_Server $wp_rest_server */
global
$
wp_rest_server
;
if
(
empty
(
$
wp_rest_server
) ) {
/**
* Filter the REST Server Class.
*
* This filter allows you to adjust the server class used by the API, using a
* different class to handle requests.
*
* @since 4.4.0
*
* @param string $class_name The name of the server class. Default 'WP_REST_Server'.
*/
$
wp_rest_server_class
=
apply_filters
(
'
wp_rest_server_class
'
,
'
WP_REST_Server
'
);
$
wp_rest_server
=
new
$
wp_rest_server_class
;
/**
* Fires when preparing to serve an API request.
*
* Endpoint objects should be created and register their hooks on this action rather
* than another action to ensure they're only loaded when needed.
*
* @since 4.4.0
*
* @param WP_REST_Server $wp_rest_server Server object.
*/
do_action
(
'
rest_api_init
'
,
$
wp_rest_server
);
}
return
$
wp_rest_server
;
}
}
Back
|
FazBrowse Home
|
New Git URL