Changeset 16035 for trunk/wp-includes/formatting.php
- Timestamp:
- 10/28/2010 07:38:00 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r15948 r16035 209 209 $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); 210 210 if ($br) { 211 $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "<WPPreserveNewline />", $matches[0]);'), $pee);211 $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '__autop_newline_preservation_helper', $pee); 212 212 $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks 213 213 $pee = str_replace('<WPPreserveNewline />', "\n", $pee); … … 220 220 221 221 return $pee; 222 } 223 224 /** 225 * Newline preservation help function for wpautop 226 * 227 * @since 3.1.0 228 * @access private 229 * @param array $matches preg_replace_callback matches array 230 * @returns string 231 */ 232 function __autop_newline_preservation_helper( $matches ) { 233 return str_replace("\n", "<WPPreserveNewline />", $matches[0]); 222 234 } 223 235 … … 1556 1568 } else { 1557 1569 $subject = str_replace('_', ' ', $matches[2]); 1558 $subject = preg_replace_callback('#\=([0-9a-f]{2})#i', create_function('$match', 'return chr(hexdec(strtolower($match[1])));'), $subject);1570 $subject = preg_replace_callback('#\=([0-9a-f]{2})#i', '__wp_iso_convert', $subject); 1559 1571 return $subject; 1560 1572 } 1561 1573 } 1574 1575 /** 1576 * Helper function to convert hex encoded chars to ascii 1577 * 1578 * @since 3.1.0 1579 * @access private 1580 * @param $match the preg_replace_callback matches array 1581 */ 1582 function __wp_iso_convert( $match ) { 1583 return chr( hexdec( strtolower( $match[1] ) ) ); 1584 } 1562 1585 1563 1586 /**
Note: See TracChangeset
for help on using the changeset viewer.