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:
Dominik Schilling 2013-07-03 22:36:13 +00:00
parent c8853cff92
commit 6ba7413fbd
2 changed files with 7 additions and 16 deletions

View File

@ -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 );
}
}
}
@ -2505,9 +2503,9 @@ function img_html_to_post_id( $html, &$matched_html = null ) {
if ( ! preg_match( '#class=([\'"])(.+?)\1#is', $matched_html, $matches ) || empty( $matches ) )
return $attachment_id;
$classes = $matches[2];
if ( ! empty( $classes ) && false !== strpos( $classes, 'wp-image-' ) )
if ( preg_match( '#wp-image-([0-9]+)#i', $classes, $matches ) )
$classes = $matches[2];
if ( ! empty( $classes ) && false !== strpos( $classes, 'wp-image-' ) )
if ( preg_match( '#wp-image-([0-9]+)#i', $classes, $matches ) )
$attachment_id = absint( $matches[1] );
return $attachment_id;

View File

@ -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 '';
}