PluginProbe
Redirection / 4.2
Redirection v4.2
5.10.0 5.9.0 5.8.1 5.8.0 3.7.2 3.7.3 4.0 4.0.1 4.1 4.1.1 4.2 4.2.1 4.2.2 4.2.3 4.3 4.3.1 4.3.2 4.3.3 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6.2 4.7.1 All 130 releases
redirection / models / url-match.php

url-match.php in Redirection 4.2, at models/url-match.php

29 lines 460 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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