PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.2.4
Kirki – Freeform Page Builder, Website Builder & Customizer v6.2.4
6.2.5 6.2.4 6.2.3 6.2.2 6.2.1 6.2.0 6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / libraries / framework / Http / RedirectResponse.php
kirki / libraries / framework / Http Last commit date
Client 1 week ago Concerns 1 week ago Cookie.php 1 week ago JsonResponse.php 1 week ago RedirectResponse.php 1 week ago Request.php 1 week ago Response.php 1 week ago
RedirectResponse.php
84 lines
1 <?php
2
3 /**
4 * Redirect response for site route controllers.
5 *
6 * @package Framework
7 * @subpackage Http
8 * @since 1.0.0
9 */
10 namespace Kirki\Framework\Http;
11
12 \defined('ABSPATH') || exit;
13 use Kirki\Framework\Http\Concerns\InteractsWithCookies;
14 class RedirectResponse
15 {
16 use InteractsWithCookies;
17 /**
18 * The redirect target URL.
19 *
20 * @var string
21 *
22 * @since 1.0.0
23 */
24 protected $url;
25 /**
26 * The HTTP redirect status code.
27 *
28 * @var int
29 *
30 * @since 1.0.0
31 */
32 protected $status;
33 /**
34 * Create a new RedirectResponse instance.
35 *
36 * @param string $url The redirect target URL.
37 * @param int $status The HTTP status code.
38 *
39 * @return void
40 *
41 * @since 1.0.0
42 */
43 public function __construct(string $url, int $status = 302)
44 {
45 $this->url = $url;
46 $this->status = $status;
47 }
48 /**
49 * Get the redirect URL.
50 *
51 * @return string
52 *
53 * @since 1.0.0
54 */
55 public function get_url()
56 {
57 return $this->url;
58 }
59 /**
60 * Get the HTTP status code.
61 *
62 * @return int
63 *
64 * @since 1.0.0
65 */
66 public function get_status()
67 {
68 return $this->status;
69 }
70 /**
71 * Send the redirect and terminate the request.
72 *
73 * @return void
74 *
75 * @since 1.0.0
76 */
77 public function send()
78 {
79 $this->cookie_manager()->flush_queued_cookies();
80 wp_safe_redirect($this->url, $this->status);
81 exit;
82 }
83 }
84