Lose content removal and splitting from get_content_url(). And remove unneeded lines from [24400].

fixes #24484.

git-svn-id: https://develop.svn.wordpress.org/trunk@24554 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2013-07-03 22:36:13 +00:00
parent a6baa90a3d
commit cf6a29cfa1
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 ( strstr( $shortcode[0], $url ) ) {
if ( ! $matched ) if ( ! $matched )
$matched = do_shortcode_tag( $shortcode ); $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 ( strstr( $match[0], $url ) ) {
if ( ! $matched ) if ( ! $matched )
$matched = $match[0]; $matched = $match[0];
// $content = str_replace( $match[0], '', $content, $count );
} }
} }
} }

View File

@ -240,21 +240,18 @@ add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' );
* *
* @since 3.6.0 * @since 3.6.0
* *
* @param string $content A string which might contain a URL, passed by reference. * @param string $content A string which might contain a URL.
* @param boolean $remove Whether to remove the found URL from the passed content.
* @return string The found URL. * @return string The found URL.
*/ */
function get_content_url( &$content, $remove = false ) { function get_content_url( $content ) {
if ( empty( $content ) ) if ( empty( $content ) )
return ''; return '';
// the content is a URL // the content is a URL
$trimmed = trim( $content ); $trimmed = trim( $content );
if ( 0 === stripos( $trimmed, 'http' ) && ! preg_match( '#\s#', $trimmed ) ) { if ( 0 === stripos( $trimmed, 'http' ) && ! preg_match( '#\s#', $trimmed ) ) {
if ( $remove )
$content = '';
return $trimmed; return $trimmed;
// the content is HTML so we grab the first href // the content is HTML so we grab the first href
} elseif ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) { } elseif ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
return esc_url_raw( $matches[2] ); return esc_url_raw( $matches[2] );
@ -264,12 +261,8 @@ function get_content_url( &$content, $remove = false ) {
$line = trim( array_shift( $lines ) ); $line = trim( array_shift( $lines ) );
// the content is a URL followed by content // the content is a URL followed by content
if ( 0 === stripos( $line, 'http' ) ) { if ( 0 === stripos( $line, 'http' ) )
if ( $remove )
$content = trim( join( "\n", $lines ) );
return esc_url_raw( $line ); return esc_url_raw( $line );
}
return ''; return '';
} }