Split the content to balance open tags when `<!--nextpage-->` and `<!--more.*?-->` are used. Needs filter inline docs. The 4 unit tests that were previously failing for ticket 6297 now pass.

See #6297. 
Props devesine.


Built from https://develop.svn.wordpress.org/trunk@26050


git-svn-id: http://core.svn.wordpress.org/trunk@25975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2013-11-08 22:22:11 +00:00
parent e15b51efa3
commit 734fe0f6ad
1 changed files with 9 additions and 4 deletions

View File

@ -1169,10 +1169,15 @@ function convert_chars($content, $deprecated = '') {
* @return string Balanced text
*/
function balanceTags( $text, $force = false ) {
if ( $force || get_option('use_balanceTags') == 1 )
return force_balance_tags( $text );
else
return $text;
if ( $force || get_option('use_balanceTags') == 1 ) {
$balance_tags_delimiters = apply_filters( 'balance_tags_delimiters', array( '<!--more.*?-->', '<!--nextpage-->' ) );
// Capture lets PREG_SPLIT_DELIM_CAPTURE return the delimiters
$delimiters_regex = '/(' . implode( '|', $balance_tags_delimiters ) . ')/';
$parts = preg_split( $delimiters_regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
return implode( '', array_map( 'force_balance_tags', $parts ) );
}
return $text;
}
/**