| 1 | <?php |
||
| 9 | trait UrlToolbox |
||
| 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) |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Validate URL |
||
| 50 | * |
||
| 51 | * @param string $url |
||
| 52 | * @return bool |
||
| 53 | */ |
||
| 54 | protected function urlValidate($url) |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Validate host name |
||
| 66 | * |
||
| 67 | * @link http://stackoverflow.com/questions/1755144/how-to-validate-domain-name-in-php |
||
| 68 | * |
||
| 69 | * @param string $host |
||
| 70 | * @return bool |
||
| 71 | */ |
||
| 72 | protected static function urlValidateHost($host) |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Validate URL scheme |
||
| 84 | * |
||
| 85 | * @param string $scheme |
||
| 86 | * @return bool |
||
| 87 | */ |
||
| 88 | protected static function urlValidateScheme($scheme) |
||
| 98 | } |
||
| 99 |