wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
wp_extract_urls › WordPress Function
Desde3.7.0
Obsoleton/a
› wp_extract_urls ( $content )
Parâmetros: |
|
Retorna: |
|
Definido em: |
|
Codex: | |
Log de mudanças: |
|
Uses RegEx to extract URLs from arbitrary content.
Funções relacionadas: wp_registration_url, wp_get_attachment_url, wp_insert_user, wp_get_update_php_url, wp_get_links
Fonte
function wp_extract_urls( $content ) { preg_match_all( "#([\"']?)(" . '(?:([\w-]+:)?//?)' . '[^\s()<>]+' . '[.]' . '(?:' . '\([\w\d]+\)|' . '(?:' . "[^`!()\[\]{}:'\".,<>«»“”‘’\s]|" . '(?:[:]\d+)?/?' . ')+' . ')' . ")\\1#", $content, $post_links ); $post_links = array_unique( array_map( static function ( $link ) { // Decode to replace valid entities, like &. $link = html_entity_decode( $link ); // Maintain backward compatibility by removing extraneous semi-colons (`;`). return str_replace( ';', '', $link ); }, $post_links[2] ) ); return array_values( $post_links ); }