関数 wp_extract_urls()
定義ファイル :/blog/wp-includes/functions.php 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | /** * Use RegEx to extract URLs from arbitrary content. * * @since 3.7.0 * * @param string $content Content to extract URLs from. * @return array URLs found in passed string. */ function wp_extract_urls( $content ) { preg_match_all( "#(" . "(?:([\w-]+:)?//?)" . "[^\s()<>]+" . "[.]" . "(?:" . "\([\w\d]+\)|" . "(?:" . "[^`!()\[\]{};:'\".,<>?«»“”‘’\s]|" . "(?:[:]\d+)?/?" . ")+" . ")" . ")#", $content, $post_links ); $post_links = array_unique( array_map( 'html_entity_decode', $post_links[0] ) ); return array_values( $post_links ); } |