Changeset 34675 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 09/29/2015 01:00:17 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/formatting.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r34674 r34675 2078 2078 $dest = $matches[2]; 2079 2079 $dest = 'http://' . $dest; 2080 $dest = esc_url($dest); 2081 if ( empty($dest) ) 2082 return $matches[0]; 2080 2083 2081 2084 // removed trailing [.,;:)] from URL … … 2084 2087 $dest = substr($dest, 0, strlen($dest)-1); 2085 2088 } 2086 2087 $dest = esc_url($dest);2088 if ( empty($dest) )2089 return $matches[0];2090 2091 2089 return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret"; 2092 2090 } … … 3281 3279 * is applied to the returned cleaned URL. 3282 3280 * 3283 * See RFC39863284 *3285 3281 * @since 2.8.0 3286 3282 * … … 3298 3294 3299 3295 $url = str_replace( ' ', '%20', $url ); 3300 $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\ [\]\\x80-\\xff]|i', '', $url);3296 $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); 3301 3297 3302 3298 if ( '' === $url ) { … … 3311 3307 $url = str_replace(';//', '://', $url); 3312 3308 /* If the URL doesn't appear to contain a scheme, we 3313 * presume it needs http:// prepended (unless a relative3309 * presume it needs http:// appended (unless a relative 3314 3310 * link starting with /, # or ? or a php file). 3315 3311 */ … … 3323 3319 $url = str_replace( '&', '&', $url ); 3324 3320 $url = str_replace( "'", ''', $url ); 3325 }3326 3327 if ( ( false !== strpos( $url, '[' ) ) || ( false !== strpos( $url, ']' ) ) ) {3328 3329 $parsed = parse_url( $url );3330 $front = '';3331 3332 if ( isset( $parsed['scheme'] ) ) {3333 $front .= $parsed['scheme'] . '://';3334 } elseif ( '/' === $url[0] ) {3335 $front .= '//';3336 }3337 3338 if ( isset( $parsed['user'] ) ) {3339 $front .= $parsed['user'];3340 }3341 3342 if ( isset( $parsed['pass'] ) ) {3343 $front .= ':' . $parsed['pass'];3344 }3345 3346 if ( isset( $parsed['user'] ) || isset( $parsed['pass'] ) ) {3347 $front .= '@';3348 }3349 3350 if ( isset( $parsed['host'] ) ) {3351 $front .= $parsed['host'];3352 }3353 3354 if ( isset( $parsed['port'] ) ) {3355 $front .= ':' . $parsed['port'];3356 }3357 3358 $end_dirty = str_replace( $front, '', $url );3359 $end_clean = str_replace( array( '[', ']' ), array( '%5B', '%5D' ), $end_dirty );3360 $url = str_replace( $end_dirty, $end_clean, $url );3361 3362 3321 } 3363 3322
Note: See TracChangeset
for help on using the changeset viewer.