| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 10 | public static function sanitize_url( $value ) { |
||
| 11 | |||
| 12 | // Initially this function used also filter_var( $value, FILTER_VALIDATE_URL ) |
||
| 13 | // but URLs with UTF-8 characters are not valid. We store those anyway in the DB as it's up to the browser |
||
| 14 | // to do proper url encoding when requesting the URL. |
||
| 15 | // |
||
| 16 | // see also http://stackoverflow.com/questions/2137080/php-filter-var-filter-validate-url |
||
| 17 | |||
| 18 | if ( ! is_null( $value ) && $value !== '' ) { |
||
| 19 | return $value; |
||
| 20 | } |
||
| 21 | |||
| 22 | return null; |
||
| 23 | } |
||
| 24 | |||
| 25 | } |