Make WordPress Core

Changeset 28708


Ignore:
Timestamp:
06/09/2014 07:29:55 PM (10 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r28670 r28708  
    38453845    return false;
    38463846}
     3847
     3848/**
     3849 * Returns the regexp for common whitespace characters.
     3850 *
     3851 * By default, spaces include new lines, tabs, nbsp entities, and the UTF-8 nbsp.
     3852 * This is designed to replace the PCRE \s sequence.  In ticket #22692, that
     3853 * sequence was found to be unreliable due to random inclusion of the A0 byte.
     3854 *
     3855 * @since 4.0.0
     3856 *
     3857 * @return string The spaces regexp.
     3858 */
     3859function wp_spaces_regexp() {
     3860    static $spaces;
     3861
     3862    if ( empty( $spaces ) ) {
     3863        $spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ' );
     3864    }
     3865
     3866    return $spaces;
     3867}
Note: See TracChangeset for help on using the changeset viewer.