| 1 | <?php |
||
| 9 | trait UrlParser |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * URL encoder according to RFC 3986 |
||
| 13 | * Returns a string containing the encoded URL with disallowed characters converted to their percentage encodings. |
||
| 14 | * @link http://publicmind.in/blog/url-encoding/ |
||
| 15 | * |
||
| 16 | * @param string $url |
||
| 17 | * @return string |
||
| 18 | */ |
||
| 19 | protected function urlEncode($url) |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Validate URL |
||
| 47 | * |
||
| 48 | * @param string $url |
||
| 49 | * @return bool |
||
| 50 | */ |
||
| 51 | protected function urlValidate($url) |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Validate host name |
||
| 63 | * |
||
| 64 | * @link http://stackoverflow.com/questions/1755144/how-to-validate-domain-name-in-php |
||
| 65 | * |
||
| 66 | * @param string $host |
||
| 67 | * @return bool |
||
| 68 | */ |
||
| 69 | protected static function urlValidateHost($host) |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Validate URL scheme |
||
| 80 | * |
||
| 81 | * @param string $scheme |
||
| 82 | * @return bool |
||
| 83 | */ |
||
| 84 | protected static function urlValidateScheme($scheme) |
||
| 92 | } |
||
| 93 |