Fix twentyeleven_url_grabber(). props duck_, see #17267.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a55c86ffbc
commit
0b0f3304e3
|
@ -449,24 +449,16 @@ function twentyeleven_content_nav( $nav_id ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grab the first URL from a Link post
|
* Return the URL for the first link found in the post content.
|
||||||
|
*
|
||||||
|
* @since Twenty Eleven 1.0
|
||||||
|
* @return string|bool URL or false when no link is present.
|
||||||
*/
|
*/
|
||||||
function twentyeleven_url_grabber() {
|
function twentyeleven_url_grabber() {
|
||||||
global $post, $posts;
|
if ( ! preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) )
|
||||||
|
|
||||||
$first_url = '';
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
$output = preg_match_all('/<a.+href=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
|
|
||||||
|
|
||||||
$first_url = $matches [1] [0];
|
|
||||||
|
|
||||||
if ( empty( $first_url ) )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return $first_url;
|
return esc_url_raw( $matches[1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue