Changeset 60665
- Timestamp:
- 08/26/2025 06:21:00 PM (3 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/formatting.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r60630 r60665 5979 5979 * @since 3.6.0 5980 5980 * 5981 * @param string $content A string which might contain a URL.5982 * @return string|false The found URL.5981 * @param string $content A string which might contain an `A` element with a non-empty `href` attribute. 5982 * @return string|false Database-escaped URL via {@see esc_url()} if found, otherwise `false`. 5983 5983 */ 5984 5984 function get_url_in_content( $content ) { … … 5987 5987 } 5988 5988 5989 if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) { 5990 return sanitize_url( $matches[2] ); 5989 $processor = new WP_HTML_Tag_Processor( $content ); 5990 while ( $processor->next_tag( 'A' ) ) { 5991 $href = $processor->get_attribute( 'href' ); 5992 if ( is_string( $href ) && ! empty( $href ) ) { 5993 return sanitize_url( $href ); 5994 } 5991 5995 } 5992 5996
Note: See TracChangeset
for help on using the changeset viewer.