PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / 1.20
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration v1.20
2.0.15 2.0.12 2.0.10 2.0.4 2.0.1 2.0.0 1.95.3 1.95.2 1.95 1.91.6 trunk 1.11 1.12 1.13 1.20 1.21 1.22 1.23 1.30 1.31 1.32 1.35 1.40 1.41 1.45 All 41 releases
fluent-boards / vendor / wpfluent / framework / src / WPFluent / Http / URL.php

URL.php in FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration 1.20, at vendor/wpfluent/framework/src/WPFluent/Http/URL.php

46 lines 914 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBoards\Framework\Http;
4
5 class URL
6 {
7 /**
8 * Get the current URL
9 *
10 * @return string
11 */
12 public function current()
13 {
14 return get_site_url() . rtrim(preg_replace('/\?.*/', '', $_SERVER['REQUEST_URI']), '/');
15 }
16
17 /**
18 * Parse a url from uncompiled route
19 *
20 * @param string $url
21 * @param array $params
22 * @return string
23 */
24 public function parse(string $url, array $params)
25 {
26 return preg_replace_callback('#\{[a-zA-Z0-9-_]+\}#', function($matches) use ($params) {
27 foreach ($matches as $match) {
28 $match = str_replace(['{', '}'], ['', ''], $match);
29 if (isset($params[$match])) {
30 return $params[$match];
31 }
32 }
33 }, $url);
34 }
35
36 /**
37 * Returns the string representation of the URL object
38 *
39 * @return string Current URL.
40 */
41 public function __toString()
42 {
43 return $this->current();
44 }
45 }
46