|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use WPEmerge\Response; |
|
4
|
|
|
|
|
5
|
|
|
if ( ! function_exists( 'wpm_response' ) ) { |
|
6
|
|
|
/** |
|
7
|
|
|
* @codeCoverageIgnore |
|
8
|
|
|
* @see Response::response() |
|
9
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
10
|
|
|
*/ |
|
11
|
|
|
function wpm_response() { |
|
12
|
|
|
return Response::response(); |
|
13
|
|
|
} |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
if ( ! function_exists( 'wpm_output' ) ) { |
|
17
|
|
|
/** |
|
18
|
|
|
* @codeCoverageIgnore |
|
19
|
|
|
* @see Response::output() |
|
20
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
21
|
|
|
*/ |
|
22
|
|
|
function wpm_output( $output ) { |
|
23
|
|
|
return Response::output( wpm_response(), $output ); |
|
24
|
|
|
} |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
if ( ! function_exists( 'wpm_view' ) ) { |
|
28
|
|
|
/** |
|
29
|
|
|
* @codeCoverageIgnore |
|
30
|
|
|
* @see Response::view() |
|
31
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
32
|
|
|
*/ |
|
33
|
|
|
function wpm_view( $views, $context = array() ) { |
|
34
|
|
|
return Response::view( wpm_response(), $views, $context ); |
|
35
|
|
|
} |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
if ( ! function_exists( 'wpm_json' ) ) { |
|
39
|
|
|
/** |
|
40
|
|
|
* @codeCoverageIgnore |
|
41
|
|
|
* @see Response::json() |
|
42
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
43
|
|
|
*/ |
|
44
|
|
|
function wpm_json( $data ) { |
|
45
|
|
|
return Response::json( wpm_response(), $data ); |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
if ( ! function_exists( 'wpm_redirect' ) ) { |
|
50
|
|
|
/** |
|
51
|
|
|
* @codeCoverageIgnore |
|
52
|
|
|
* @see Response::redirect() |
|
53
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
54
|
|
|
*/ |
|
55
|
|
|
function wpm_redirect( $url, $status = 302 ) { |
|
56
|
|
|
return Response::redirect( wpm_response(), $url, $status ); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
if ( ! function_exists( 'wpm_reload' ) ) { |
|
61
|
|
|
/** |
|
62
|
|
|
* @codeCoverageIgnore |
|
63
|
|
|
* @see Response::reload() |
|
64
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
65
|
|
|
*/ |
|
66
|
|
|
function wpm_reload( $request, $status = 302 ) { |
|
67
|
|
|
return Response::reload( wpm_response(), $request, $status ); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
if ( ! function_exists( 'wpm_error' ) ) { |
|
72
|
|
|
/** |
|
73
|
|
|
* @codeCoverageIgnore |
|
74
|
|
|
* @see Response::error() |
|
75
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
76
|
|
|
*/ |
|
77
|
|
|
function wpm_error( $code ) { |
|
78
|
|
|
return Response::error( wpm_response(), $code ); |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|