1 | <?php |
||
26 | class Url |
||
27 | { |
||
28 | /** |
||
29 | * The cached base URL. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | public static $base; |
||
34 | |||
35 | /** |
||
36 | * Current page URL |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | private static $url; |
||
41 | |||
42 | /** |
||
43 | * Is current application running under HTTPS protocol? |
||
44 | * |
||
45 | * @var boolean |
||
46 | */ |
||
47 | private static $isHttps; |
||
48 | |||
49 | /** |
||
50 | * @param string $url |
||
51 | * @param boolean $isHttps |
||
52 | */ |
||
53 | public static function setup($url, $isHttps) |
||
58 | |||
59 | /** |
||
60 | * Get the full URI including the query string. |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | public static function full() |
||
68 | |||
69 | /** |
||
70 | * Get the full URL for the current request. |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | public static function current() |
||
78 | |||
79 | /** |
||
80 | * Get the URL for the application root. |
||
81 | * |
||
82 | * @param null|bool $https |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | public static function home($https = null) |
||
90 | |||
91 | /** |
||
92 | * Get the base URL of the application. |
||
93 | * |
||
94 | * @return string |
||
95 | */ |
||
96 | public static function base() |
||
112 | |||
113 | /** |
||
114 | * Generate an application URL. |
||
115 | * |
||
116 | * @param string $url |
||
117 | * @param null|bool $https |
||
118 | * @param bool $asset |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public static function to($url = '', $https = null, $asset = false) |
||
134 | |||
135 | /** |
||
136 | * Computes the URl method |
||
137 | * |
||
138 | * @param null|bool $https |
||
139 | * @param bool $asset |
||
140 | * |
||
141 | * @return string |
||
142 | */ |
||
143 | private static function format($https = null, $asset = false) |
||
164 | |||
165 | /** |
||
166 | * Generate an application URL with HTTPS. |
||
167 | * |
||
168 | * @param string $url |
||
169 | * |
||
170 | * @return string |
||
171 | */ |
||
172 | public static function asHttps($url = '') |
||
176 | |||
177 | /** |
||
178 | * Generate an application URL to an asset. |
||
179 | * |
||
180 | * @param string $url |
||
181 | * @param bool $https |
||
182 | * |
||
183 | * @return string |
||
184 | */ |
||
185 | public static function toAsset($url, $https = null) |
||
208 | |||
209 | /** |
||
210 | * Determine if the given URL is valid. |
||
211 | * |
||
212 | * @param string $url |
||
213 | * |
||
214 | * @return bool |
||
215 | */ |
||
216 | public static function valid($url) |
||
224 | |||
225 | /** |
||
226 | * Get cleaner URLs or old-fashioned » RFC 3986 URL-query string. |
||
227 | * |
||
228 | * @param string $route controller/action |
||
229 | * @param array $params |
||
230 | * @param null $https |
||
231 | * @param bool $asset |
||
232 | * |
||
233 | * @return string |
||
234 | */ |
||
235 | public static function compute($route = '', array $params = array(), $https = null, $asset = false) |
||
256 | } |
||
257 |