Make <!--more--> regex non-greedy. Props Curloso and Viper007Bond. fixes #3698
git-svn-id: https://develop.svn.wordpress.org/trunk@4821 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2fd34af717
commit
24e66041c0
|
@ -74,16 +74,16 @@ function &get_children($args = '', $output = OBJECT) {
|
||||||
// get extended entry info (<!--more-->)
|
// get extended entry info (<!--more-->)
|
||||||
function get_extended($post) {
|
function get_extended($post) {
|
||||||
//Match the new style more links
|
//Match the new style more links
|
||||||
if (preg_match('/<!--more(.+?)?-->/', $post, $matches)) {
|
if ( preg_match('/<!--more(.*?)-->/', $post, $matches) ) {
|
||||||
list($main,$extended) = explode($matches[0],$post,2);
|
list($main, $extended) = explode($matches[0], $post, 2);
|
||||||
} else {
|
} else {
|
||||||
$main = $post;
|
$main = $post;
|
||||||
$extended = '';
|
$extended = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip leading and trailing whitespace
|
// Strip leading and trailing whitespace
|
||||||
$main = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$main);
|
$main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
|
||||||
$extended = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$extended);
|
$extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
|
||||||
|
|
||||||
return array('main' => $main, 'extended' => $extended);
|
return array('main' => $main, 'extended' => $extended);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue