WordPress.org

Make WordPress Core

Ticket #15657: formatting-wp_strip_all_tags.diff

File formatting-wp_strip_all_tags.diff, 824 bytes (added by trepmal, 10 years ago)

just wp_strip_all_tags

  • wp-includes/formatting.php

     
    29082908 */
    29092909function wp_strip_all_tags($string, $remove_breaks = false) {
    29102910        $string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
    2911         $string = strip_tags($string);
    29122911
     2912        $string = preg_replace( '@</?\s*(P|UL|OL|DL|BLOCKQUOTE)\b[^>]*?>@si', "\n\n", $string );
     2913        $string = preg_replace( '@<(BR|DIV|LI|DT|DD|TR|TD|H\d)\b[^>]*?>@si', "\n", $string );
     2914        $string = preg_replace( "@\n\n\n+@si", "\n\n", $string );
     2915
     2916        $string = strip_tags( $string );
     2917
    29132918        if ( $remove_breaks )
    29142919                $string = preg_replace('/[\r\n\t ]+/', ' ', $string);
    29152920
    2916         return trim($string);
     2921        return trim( $string );
    29172922}
    29182923
    29192924/**