Changeset 27094 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 02/05/2014 12:45:53 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r27042 r27094 239 239 $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee); 240 240 $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines 241 if ( strpos($pee, '<object') !== false ) { 242 $pee = preg_replace('|\s*<param([^>]*)>\s*|', "<param$1>", $pee); // no pee inside object/embed 243 $pee = preg_replace('|\s*</embed>\s*|', '</embed>', $pee); 244 } 241 242 if ( strpos( $pee, '</object>' ) !== false ) { 243 // no P/BR around param and embed 244 $pee = preg_replace( '|(<object[^>]*>)\s*|', '$1', $pee ); 245 $pee = preg_replace( '|\s*</object>|', '</object>', $pee ); 246 $pee = preg_replace( '%\s*(</?(?:param|embed)[^>]*>)\s*%', '$1', $pee ); 247 } 248 249 if ( strpos( $pee, '<source' ) !== false || strpos( $pee, '<track' ) !== false ) { 250 // no P/BR around source and track 251 $pee = preg_replace( '%([<\[](?:audio|video)[^>\]]*[>\]])\s*%', '$1', $pee ); 252 $pee = preg_replace( '%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $pee ); 253 $pee = preg_replace( '%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $pee ); 254 } 255 245 256 $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates 246 257 // make paragraphs, including one at the end 247 258 $pees = preg_split('/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY); 248 259 $pee = ''; 249 foreach ( $pees as $tinkle ) 260 261 foreach ( $pees as $tinkle ) { 250 262 $pee .= '<p>' . trim($tinkle, "\n") . "</p>\n"; 263 } 264 251 265 $pee = preg_replace('|<p>\s*</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 252 266 $pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee); … … 257 271 $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee); 258 272 $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); 273 259 274 if ( $br ) { 260 275 $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee); … … 262 277 $pee = str_replace('<WPPreserveNewline />', "\n", $pee); 263 278 } 279 264 280 $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee); 265 281 $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
Note: See TracChangeset
for help on using the changeset viewer.