Changes in trunk/wp-includes/formatting.php [12302:12165]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r12302 r12165 180 180 */ 181 181 function wpautop($pee, $br = 1) { 182 183 182 if ( trim($pee) === '' ) 184 183 return ''; … … 186 185 $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee); 187 186 // Space things out a little 188 $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr |fieldset|legend)';187 $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)'; 189 188 $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); 190 189 $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee); … … 218 217 $pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee ); 219 218 $pee = preg_replace( "|\n</p>$|", '</p>', $pee ); 220 221 return $pee; 222 } 223 224 /** 225 * Don't auto-p wrap shortcodes that stand alone 226 * 227 * Ensures that shortcodes are not wrapped in <<p>>...<</p>>. 228 * 229 * @since 2.9.0 230 * 231 * @param string $pee The content. 232 * @return string The filtered content. 233 */ 234 function shortcode_unautop($pee) { 235 global $shortcode_tags; 236 237 if ( !empty($shortcode_tags) && is_array($shortcode_tags) ) { 238 $tagnames = array_keys($shortcode_tags); 239 $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); 240 $pee = preg_replace('/<p>\\s*?(\\[(' . $tagregexp . ')\\b.*?\\/?\\](?:.+?\\[\\/\\2\\])?)\\s*<\\/p>/s', '$1', $pee); 241 } 219 $pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone 242 220 243 221 return $pee; … … 1354 1332 $ret = ' ' . $ret; 1355 1333 // in testing, using arrays here was found to be faster 1356 $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/=?@\[\](+-]|[.,;:](?![\s<]|(\))?([\s]|$))|(?(1)\)(?![\s< .,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret);1334 $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/=?@\[\](+-]|[.,;:](?![\s<]|(\))?([\s]|$))|(?(1)\)(?![\s<]|$)|\)))+)#is', '_make_url_clickable_cb', $ret); 1357 1335 $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret); 1358 1336 $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
Note: See TracChangeset
for help on using the changeset viewer.