mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-09 09:57:38 +01:00
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:
parent
7873820f8c
commit
c08e55fc61
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user