url-match.php in Redirection 4.2, at models/url-match.php
| 1 | <?php |
| 2 | |
| 3 | class Red_Url_Match { |
| 4 | private $url; |
| 5 | |
| 6 | public function __construct( $url ) { |
| 7 | $this->url = $url; |
| 8 | } |
| 9 | |
| 10 | /** |
| 11 | * Get the plain 'matched' URL: |
| 12 | * |
| 13 | * - Lowercase |
| 14 | * - No trailing slashes |
| 15 | * |
| 16 | * @return string URL |
| 17 | */ |
| 18 | public function get_url() { |
| 19 | // Remove query params |
| 20 | $url = new Red_Url_Path( $this->url ); |
| 21 | $path = $url->get_without_trailing_slash(); |
| 22 | |
| 23 | // Lowercase everything |
| 24 | $path = strtolower( $path ); |
| 25 | |
| 26 | return $path ? $path : '/'; |
| 27 | } |
| 28 | } |
| 29 |