Changeset 12302
- Timestamp:
- 12/01/2009 07:46:36 AM (15 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/default-filters.php
r12126 r12302 89 89 // Format text area for display. 90 90 foreach ( array( 'term_description' ) as $filter ) { 91 add_filter( $filter, 'wptexturize' ); 92 add_filter( $filter, 'convert_chars' ); 93 add_filter( $filter, 'wpautop' ); 91 add_filter( $filter, 'wptexturize' ); 92 add_filter( $filter, 'convert_chars' ); 93 add_filter( $filter, 'wpautop' ); 94 add_filter( $filter, 'shortcode_unautop'); 94 95 } 95 96 … … 108 109 add_filter( 'the_content', 'convert_chars' ); 109 110 add_filter( 'the_content', 'wpautop' ); 111 add_filter( 'the_content', 'shortcode_unautop' ); 110 112 add_filter( 'the_content', 'prepend_attachment' ); 111 113 112 add_filter( 'the_excerpt', 'wptexturize' ); 113 add_filter( 'the_excerpt', 'convert_smilies' ); 114 add_filter( 'the_excerpt', 'convert_chars' ); 115 add_filter( 'the_excerpt', 'wpautop' ); 116 add_filter( 'get_the_excerpt', 'wp_trim_excerpt' ); 114 add_filter( 'the_excerpt', 'wptexturize' ); 115 add_filter( 'the_excerpt', 'convert_smilies' ); 116 add_filter( 'the_excerpt', 'convert_chars' ); 117 add_filter( 'the_excerpt', 'wpautop' ); 118 add_filter( 'the_excerpt', 'shortcode_unautop'); 119 add_filter( 'get_the_excerpt', 'wp_trim_excerpt' ); 117 120 118 121 add_filter( 'comment_text', 'wptexturize' ); -
trunk/wp-includes/formatting.php
r12275 r12302 180 180 */ 181 181 function wpautop($pee, $br = 1) { 182 182 183 if ( trim($pee) === '' ) 183 184 return ''; … … 217 218 $pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee ); 218 219 $pee = preg_replace( "|\n</p>$|", '</p>', $pee ); 219 $pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone 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 } 220 242 221 243 return $pee;
Note: See TracChangeset
for help on using the changeset viewer.