PluginProbe
Redirection / 4.0
Redirection v4.0
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.0, at models/url-match.php

29 lines 466 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 public function __construct( $url ) {
5 $this->url = $url;
6 }
7
8 /**
9 * Get the plain 'matched' URL:
10 *
11 * - Lowercase
12 * - No trailing slashes
13 *
14 * @return string URL
15 */
16 public function get_url() {
17 // Remove query params
18 $path = wp_parse_url( $this->url, PHP_URL_PATH );
19
20 // Lowercase everything
21 $path = strtolower( $path );
22
23 // Trim trailing slash
24 $path = rtrim( $path, '/' );
25
26 return $path ? $path : '/';
27 }
28 }
29