Lose content removal and splitting from get_content_url(). And remove unneeded lines from [24400].
fixes #24484. git-svn-id: http://core.svn.wordpress.org/trunk@24554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c8853cff92
commit
6ba7413fbd
|
@ -2424,7 +2424,6 @@ function get_the_post_format_image( $attached_size = 'full', &$post = null ) {
|
|||
if ( strstr( $shortcode[0], $url ) ) {
|
||||
if ( ! $matched )
|
||||
$matched = do_shortcode_tag( $shortcode );
|
||||
// $content = str_replace( $shortcode[0], '', $content, $count );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2438,7 +2437,6 @@ function get_the_post_format_image( $attached_size = 'full', &$post = null ) {
|
|||
if ( strstr( $match[0], $url ) ) {
|
||||
if ( ! $matched )
|
||||
$matched = $match[0];
|
||||
// $content = str_replace( $match[0], '', $content, $count );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -240,21 +240,18 @@ add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' );
|
|||
*
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param string $content A string which might contain a URL, passed by reference.
|
||||
* @param boolean $remove Whether to remove the found URL from the passed content.
|
||||
* @param string $content A string which might contain a URL.
|
||||
* @return string The found URL.
|
||||
*/
|
||||
function get_content_url( &$content, $remove = false ) {
|
||||
function get_content_url( $content ) {
|
||||
if ( empty( $content ) )
|
||||
return '';
|
||||
|
||||
// the content is a URL
|
||||
$trimmed = trim( $content );
|
||||
if ( 0 === stripos( $trimmed, 'http' ) && ! preg_match( '#\s#', $trimmed ) ) {
|
||||
if ( $remove )
|
||||
$content = '';
|
||||
|
||||
return $trimmed;
|
||||
|
||||
// the content is HTML so we grab the first href
|
||||
} elseif ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
|
||||
return esc_url_raw( $matches[2] );
|
||||
|
@ -264,12 +261,8 @@ function get_content_url( &$content, $remove = false ) {
|
|||
$line = trim( array_shift( $lines ) );
|
||||
|
||||
// the content is a URL followed by content
|
||||
if ( 0 === stripos( $line, 'http' ) ) {
|
||||
if ( $remove )
|
||||
$content = trim( join( "\n", $lines ) );
|
||||
|
||||
if ( 0 === stripos( $line, 'http' ) )
|
||||
return esc_url_raw( $line );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue