Make <!--more--> regex non-greedy. Props Curloso and Viper007Bond. fixes #3698

git-svn-id: http://svn.automattic.com/wordpress/trunk@4821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-01-27 23:31:42 +00:00
parent 7873820f8c
commit c08e55fc61

View File

@ -74,16 +74,16 @@ function &get_children($args = '', $output = OBJECT) {
// get extended entry info (<!--more-->)
function get_extended($post) {
//Match the new style more links
if (preg_match('/<!--more(.+?)?-->/', $post, $matches)) {
list($main,$extended) = explode($matches[0],$post,2);
if ( preg_match('/<!--more(.*?)-->/', $post, $matches) ) {
list($main, $extended) = explode($matches[0], $post, 2);
} else {
$main = $post;
$extended = '';
}
// Strip leading and trailing whitespace
$main = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$main);
$extended = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$extended);
$main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
$extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
return array('main' => $main, 'extended' => $extended);
}