diff --git a/wp-includes/media.php b/wp-includes/media.php index 9d43a65446..e8785718b3 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -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; diff --git a/wp-includes/post-formats.php b/wp-includes/post-formats.php index d33cf32ca6..297cde0c1b 100644 --- a/wp-includes/post-formats.php +++ b/wp-includes/post-formats.php @@ -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( '/]*?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 ''; }