From b7d411e7244471a2643994f4ab4f61b5745b8739 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 9 Jun 2014 19:29:55 +0000 Subject: [PATCH] Add a function: `wp_spaces_regexp()`. It is not used yet. This function is required by a bunch of patches by miqrogroove. Needs filter docs. Props miqrogroove. See #27588. git-svn-id: https://develop.svn.wordpress.org/trunk@28708 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/formatting.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index a07a020629..56a9c1edd0 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -3844,3 +3844,24 @@ function get_url_in_content( $content ) { return false; } + +/** + * Returns the regexp for common whitespace characters. + * + * By default, spaces include new lines, tabs, nbsp entities, and the UTF-8 nbsp. + * This is designed to replace the PCRE \s sequence. In ticket #22692, that + * sequence was found to be unreliable due to random inclusion of the A0 byte. + * + * @since 4.0.0 + * + * @return string The spaces regexp. + */ +function wp_spaces_regexp() { + static $spaces; + + if ( empty( $spaces ) ) { + $spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ' ); + } + + return $spaces; +} \ No newline at end of file