PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / trunk
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel vtrunk
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / src / Http / Response.php
wp-all-export / src / Http Last commit date
JsonResponse.php 9 years ago Request.php 3 weeks ago Response.php 3 weeks ago Router.php 8 years ago
Response.php
42 lines
1 <?php
2
3 namespace Wpae\Http;
4
5
6 class Response
7 {
8 protected $content;
9
10 protected $status;
11
12 protected $headers = array(
13 'Content-Type' => 'text/html'
14 );
15
16 public function __construct($content, $status = 200)
17 {
18 $this->content = $content;
19 $this->status = $status;
20 }
21
22 public function render()
23 {
24 $this->sendHeaders();
25 $this->sendContent();
26 die;
27 }
28
29 protected function sendHeaders()
30 {
31 foreach($this->headers as $header => $value) {
32 header($header.': '.$value);
33 }
34 http_response_code($this->status);
35 }
36
37 protected function sendContent()
38 {
39 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- generic Response container; subclasses (JsonResponse, etc.) provide already-encoded payloads matching the Content-Type header
40 echo $this->content;
41 }
42 }