Move get_url_in_content() out of post-formats.php. see #24202.
git-svn-id: http://core.svn.wordpress.org/trunk@24683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4a1e326c1f
commit
7690d7fbeb
|
@ -3410,3 +3410,21 @@ function wp_slash( $value ) {
|
||||||
function wp_unslash( $value ) {
|
function wp_unslash( $value ) {
|
||||||
return stripslashes_deep( $value );
|
return stripslashes_deep( $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract and return the first URL from passed content.
|
||||||
|
*
|
||||||
|
* @since 3.6.0
|
||||||
|
*
|
||||||
|
* @param string $content A string which might contain a URL.
|
||||||
|
* @return string The found URL.
|
||||||
|
*/
|
||||||
|
function get_url_in_content( $content ) {
|
||||||
|
if ( empty( $content ) )
|
||||||
|
return '';
|
||||||
|
|
||||||
|
if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) )
|
||||||
|
return esc_url_raw( $matches[2] );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -234,24 +234,6 @@ function _post_format_wp_get_object_terms( $terms ) {
|
||||||
}
|
}
|
||||||
add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' );
|
add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' );
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract and return the first URL from passed content.
|
|
||||||
*
|
|
||||||
* @since 3.6.0
|
|
||||||
*
|
|
||||||
* @param string $content A string which might contain a URL.
|
|
||||||
* @return string The found URL.
|
|
||||||
*/
|
|
||||||
function get_url_in_content( $content ) {
|
|
||||||
if ( empty( $content ) )
|
|
||||||
return '';
|
|
||||||
|
|
||||||
if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) )
|
|
||||||
return esc_url_raw( $matches[2] );
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Don't display post titles for asides and status posts on the front end.
|
* Don't display post titles for asides and status posts on the front end.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue